|||

Rake Routes

Rails isn’t for beginners

There’s been some talk online about how Rails is losing its focus on beginners or that it’s getting too complex for its own good. I have a different take: Rails was never written for beginners. Let’s go through a bit of Rails history and philosophy.

Rails wasn’t written as a way to make writing web applications easier. It was written to be a set of opinions that alleviate the pain of working on web applications and allow us to write them in Ruby. Check out DHHs announcement of Rails from way back in 2004.

After almost a year of incognito development, I’ve released Rails in its entirety. It’s aimed as a step up for PHP programmers and a release of pain for the Java/C# crowd. Oh, and it’s all done in Ruby.

DHH Ruby on Rails: Fully stacked web-app framework

Think back to 2001 web applications. Whether you used Java, mod_perl, or PHP you had to make a ton of decisions about your applications before you even started them. Where do the stylesheets live? Where do the backend pieces live? Do you even separate the business logic from the presentation layer? Which JavaScript framework should you use, if any? Should you use an HTML template language? Which one? How should you talk to a database? How should you develop your web application? Where and how should you attach testing and what should you test?

With Rails, you get decisions made for every one of those questions. That’s what it’s for. Rails wasn’t created to make things so easy even an absolute beginner could code it. It was created to make lots of decisions out of the box so you could get to the fun part of building web applications right away. That’s the meaning of convention over configuration”. Even better, none of the conventions are set in stone.

Don’t like ERB? Ok, use HAML. (Although ERB is awesome.)

Don’t like jQuery? Sure use … something else.

Don’t like test unit? Sure use RSpec.

jQuery became the default in Rails 3.1 (replacing prototype) and that highlights one of the best things about Rails: the conventions will always be a guide to good practices. I, for one, didn’t really even have CoffeeScript on my radar until I saw it become the default in Rails. That made me actually sit up and pay attention to the language, and I’m glad I did.

To get a bit poetic: Rails is a well-travelled path through the scary woods of web development. But wait, Stephen.”, you might say, A path through the woods sounds an awful lot like Rails is helping out beginners.” Well you’d be technically correct (the best kind of correct). By helping out everyone who wants to program a web application Rails is helping out beginners. But Rails isn’t for beginners. Rails is the path not the destination.

Learning to program is all about learning mental abstractions. A beginner will have no conceptualization of what a web application can or should do. Where an experienced web programmer from any language will hear requirements and immediately (and almost unconsciously) start building up a mental model of the problem domain, the beginner will still be struggling with how the system itself works. That will be true in any web development framework, because there’s simply no way for any framework to think through the problem for you.

Rails isn’t a hayride. You, the web programmer, are still required to make many decisions about your web application. The great, awesome thing about Rails is that you get to skip right to the fun decisions and the actual programming.

Up next How to use bundler instead of rvm gemsets Listening to the latest Ruby Rogues I was intrigued to hear André Arko describe how using bundler can completely obviate using rvm gemsets. He said Things Most Interviewees Fail to Discover It’s a great time to be a Rails developer. Companies left and right are turning to Rails or using it already for efficient web development. If you
Latest posts Shrink your data into bitfields (and out again) Every “if” statement is an object waiting to be extracted Choose Generic Tools Hyperlinks you might find interesting — #4 Running bundle install on rails master Use tldr for command line examples Friday Lunch Links — #3 Friday Lunch Links — #2 Logical Solver: Turn facts into conclusions Programming with jq Command line tools - jq Friday Lunch Links — #1 Why diversity matters Music for coding - October 2019 Code puzzles are a poor way to gauge technical candidates Add vim to a pipeline with vipe Connecting Objects with Observable Let’s write a shell script What’s a $PATH anyway? Let’s Use Hwacha to Scan URLs Deliberate Git Customize Your IRB Program Like a Videogamer Gem Spotlight: interactive_editor Things Most Interviewees Fail to Discover Rails isn’t for beginners How to use bundler instead of rvm gemsets How to write (and test) a gem to serve static files on the Rails asset pipeline A Taste of Metaprogramming Fun with Rock, Paper, Scissors Let’s Write a Gem: Part 2