Introduction & Context
I just wanted to start by first saying thank you to everyone involved in this initiative, I truly think this is such a wonderful way to bring things to the surface which otherwise would get lost for various reasons. This is such a fantastic example of some of the things that I think makes this community truly special and stand out from others in the field.
I’ve been playing around with Rails now for a couple of years on the side but I think it seems somewhat relevant to mention that I am not and never have been a professional developer. I work full time in marketing and as such I am coming to this discussion from the point of view of someone who seems to fit the audience you are trying to reach.
I feel like I have taken a lot from the Rails community in terms of knowledge and this is one of the first ways I have felt comfortable giving anything back no matter how small this may be. However, this is a serious effort to try and document the ways in which I feel Rails could be improved to newcomers and others like myself who “aren’t experts”.
Issue #1: Running
rails new is usually a 45+ minute ordeal for me
I will preface this by saying that I have never seen anyone talk about this as a metric before but I consider it to be a reasonable one from the perspective of a framework. The time it take for me to get from “OMG I have a cool idea” and writing my first line of business logic is usually somewhere between 45 minutes to an hour.
Two quick points come to mind here for me:
- That is more than enough time to kill a substantial amount of motivation and generally feels like a big friction point to me.
- That is a world away from the Rails 15 minute blog reputation that proceeds it (I will concede this isn’t necessarily a fair comparison).
It might be fair to assume that I am doing all kinds of crazy customizations and that is perhaps why it takes so long so I wanted to explore this from the perspective of what specifically happens in a scenario like this.
As a developer my primary motivation is to setup a project with as many “best practices” as I can from the start.
I put best practices in quotes here because they are almost exclusively opinions but they aren’t fringe ones by any means as far as I can tell. So this involves first running:
rails new app_name --webpack=stimulus --database=postgresql --skip-sprockets --skip-coffee --skip-test
Followed by the these 5 steps (each of which has a number of subtasks):
- Using a test framework other than
minitest(RSpec is my personal preference since this is how I learned through most books and online tutorials so it is what I am comfortable with).
- Moving all asset handling to use Webpacker rather than the asset pipeline because I want to take advantage of things like PostCSS and other modern approaches to front end.
- A couple of gems here and there to make sure I am not shooting myself in the foot as I code like
- Hook up my code repository to Github and if I am feeling especially daring I might add a YAML file that I stole from somewhere on the internet in order to try and run my tests in a CI kind of fashion.
Then once that is all done I have to go and write a sample controller and test to go with it just so that I can actually be confident that I really did set things up the correct way because this is a manual haphazard process that I manage to somehow screw up more often than I care to admit.
As a side note… the other month I tried to go down the path of setting up a Dockerized developer environment. That took me multiple days.
Comparing and Contrasting
rails new with other mature web frameworks
A couple of weeks ago I was trying to learn some fundamental OO patterns by watching videos on YouTube where I was thrown into the world of Java for a brief moment. One of the things that struck me however was what is the equivalent experience like on a platform like Spring.
As the presenter began introducing the Spring equivalent of
rails new it I had this very smug feeling of:
I can’t wait to see how they do it because Java is notoriously configuration heavy and I bet this is going to be a huge pain.
Honestly 5 minutes later I felt like a massive dick for thinking that.
The Spring experience is this quite pleasant web interface experience where you just answer a couple of questions around the kind of setup you want to work with and click go. It’s not even just bare bones setup like I described above either.
For example if your app needs to handle things like:
- OAuth2 / PubSub / Web Components and a bunch of other common patterns
- Deploying to any major cloud provider
- Setting it up to work with any major observability tools like Datadog or Prometheus for example
Once again, just click the button and it is done. I was blown away.
Despite the fact that they are totally realistic scenarios they are often huge amounts of work and reading a various mish-mash of StackOverflow, outdated and conflicting tutorials, documentation and muttering “Why the fuck doesn’t this work?” to myself.
Suggestions for improvement
- I have looked so far at a grand total of 1 other framework so far to see how they handle this problem. Collectively it would be nice to see how others are solving this problem as well in order to see what we can learn from it.
- I have been watching this pull request from @DHH since it first turned up about The Rails Conductor because I think it’s a exceptionally nice idea. But maybe it’s scope should also consider handling something like
rails newso that you can give users a really nice visual interface.
- I feel like we should also start taking a serious kind of look at what does a “cloud native” development experience look like? There is always a challenge here of drowning in buzzword bingo but maybe we just start with a goal of fully portable development environments that work reliably.
Note: I have like 4 or 5 other suggestions like this which I am more than happy to write up. I just want to make sure that this kind of feedback and the format of it is something that is actually helpful. I didn’t want to make this post any longer than it already is.