Rails is Definitely Not for Beginners
Rails is a framework not only comprised of a series of substantial components, but also dependent on non-trivial technologies to enable the productivity and happiness gains that veteran programmers often see. Most complaints about the framework bely the nature of the problem, which is that beginners are underprepared for introduction to the advanced concepts inherent in Rails, resulting in vocabulary confusion. Furthermore, this is a feature, not a bug; Rails's value comes with its complication, and attempts to simplify it to be more beginner-friendly are simply misinterpreting the problem.
Rails is Definitely Not For Beginners
First observation: Rails is awesome. I don't think anyone is disputing this. It's a hot commodity right now, and with good reason.
Second observation: Because Rails is so awesome and because it's such a hot commodity right now, a lot of people are trying to learn it.
Third observation: A lot of people are failing to learn it in a reasonable amount of time.
I came across this post by Oscar again, and my recent experiences on IRC inside #rubyonrails and a few other Rails-related channels have spurred me to address the issue that it raises.
But why is that?
- DHH says, in short, that beginner-optimized projects suck because they're front-end laden—they sacrifice complexity for ease of learning.
- Oscar says no because Rails is too big: it's too hard to understand the whole thing.
- Richard says that beginner programmers suck, and that Rails's dependencies / third-party dependencies are too intertwined to separate them easily enough to learn them properly.
I disagree with all of them as to the root cause, though I think they're seeing three sides of the same issue. It's important to note that they are focusing on Rails itself as opposed to its knowledge dependencies. I think that's fair, and if you want to make the argument that Rails—as a framework, separate from the technologies that make it up—is too complicated, I'd certainly listen, though I'm inclined to disagree. But I think we need to address the shortcomings of those people new to Rails.
There are two problems with our beginners:
- They know nothing; and
- They're getting shit advice or no advice at all.
Let's talk about #2, because that's what makes #1 become a problem.
How many times have you heard someone say "Don't use scaffolding"? Probably a few, if you sit around
#rubyonrails. But why? It's because scaffolding generates a bunch of code you don't need, and it also holds your hand too much. You don't learn the structure of your application, or how a typical RESTful controller works without taking one apart and building one yourself. And that's a legitimate reason why you should avoid a scaffold generator.
But where this advice falls to pieces is in its lack of recognition of the skill level of the beginner. While this is stereotypical, here's a picture of the beginner who encounters problems:
- He's probably 18 - 24;
- He's got no formal experience in Computer Science or Programming, though he knows some basic HTML — or, conversely, he's programmed in another language, but he doesn't actually know anything other than how to work an operant conditioning box (put PHP tags here, get right output there);
- He uses Windows, or if he uses Mac or Linux, it's without any working understanding of how the system works.
[ED: At the time, he was also very likely a man, though I'm very happy this is changing. - RY 11/2014]
I know this person pretty well because he was me five years ago.
Let's emphasize that there's nothing wrong with this person being interested in Rails. On the contrary; I think it's great that someone has found a technology that makes them eager to learn. A round of applause for everyone.
The other beginner is the redeemed PHP programmer. A lot of programmers want to jump into Rails without knowing any Ruby, and that, bar none, is their biggest source of frustration. I see a lot of PHP developers who are trying things out and get mad at how difficult it is to do simple things. Hint: if you feel this way, it's likely because you don't understand Ruby.
In short, you cannot hope to achieve an outcome in any sort of optimal fashion if you don't learn to use each of the tools in turn. Rails is an abstraction built upon a language with very high abstraction. If you want to achieve the sort of efficient outcome that Rails is known for, you have to suck it up and learn how to do it properly. You don't have to be a master, but you have to have at least passing familiarity.
How do I Google that?
Where the problem starts for our beginner is when he or she starts getting answers to the questions he asks about Rails. It usually goes something like this:
<Beginner> How do I make a user log in on my Rails project? <RailsChamp> You should google 'rails authentication' — there are plenty of easy existing solutions. <Beginner> ... <Beginner> How do I do that?
Basically, he asks an innocuous question that is then answered honestly. At this point, he then continues to ask questions that are rudimentary at best. It becomes clear very quickly thereafter that he knows nothing about Ruby, nothing about using the command line, nothing about basic web programming paradigms, and sometimes nothing about how to use a computer.
The problem is that people will continue to answer these questions, or they'll ignore them—our time is limited, after all—until the person asks again and again until he or she gives up or someone else answers the question.
What happens once this person has received a few answers is what I like to call vocabulary confusion. Now he or she has cobbled together half a site without really getting any of it. It's bullshit programming—constructed from half-consumed tutorials and Gists from pitying benefactors. Now, any sort of explanation is bound not to stick because the beginner is in way over his or her head. It's like the swimmer who dog-paddles his way into deep water, and then realizes that he can't touch the bottom. At that point, you have to hope there's a competent lifeguard on duty.
Or, to use another metaphor, Rails is the Ulysses of web programming. It expects a vocabulary of 20,000, and a good understanding of grammar, technique and history to actually appreciate it. By contrast, a kindergartener can probably sound out most of the words in Ulysses, but he'll have no idea whatsoever what he's reading. This is bullshit reading, just the way most utter beginners bullshit program.
My point: You can learn to read by reading Ulysses, but you're going to spend your time looking up words in a dictionary, trying to understand what each sentence says. You won't appreciate what is happening in the book because you will be spending your time fighting the wrong battle. If you're learning to swim in the deep end, you'll expend too much energy just trying not to drown, rather than learning proper technique to avoid getting in that situation in the first place.
Remember #1—beginners know nothing? This is what I'm talking about. Of course they know nothing: they're beginners; that's just common sense. But what I mean is that they have no ability to differentiate between the basic vocabulary that's given to us by C-style programming languages, or by Ruby, or by Rails. To these beginners, it's all incomprehensible. Being this far out of depth means that problems they know the answer to will bewilder them. Lack of knowledge is confidence's biggest foe.
They get shit advice because too few people tell them that Rails isn't for beginners. It really isn't. There's too many precursors to learn. If you don't know Ruby, you can't honestly hope to do well at Rails. Maybe you could muddle through a simple app, but even that's doubtful.
Why is it not for beginners?
In addition to the fact that your command of basic Ruby dictates your ability to customize absolutely anything at all inside your application, Rails also heavily utilizes the following concepts, just to cherry-pick a few:
- Database abstraction
I don't think that this is overwhelming to learn on its own. Difficult, maybe; but overwhelming and impossible, no. There are quite a few good guides that walk through this stuff. These are what you want to spend your time learning.
If you try to make Rails work without understanding these, you are going to fight the wrong battles. Fighting the wrong battle means you're losing efficiency. You need to know which fights you should be fighting to be efficient. When you're programming in Rails, you shouldn't be battling the command line, or basic Enumerable syntax. You need to learn these basic skills to legitimately program in Ruby on Rails.
So What's My Recourse?
That might be depressing to hear if you're a beginner. It's exciting to start something new and shiny, and it's frustrating to see requirements stack up in front of you. It could take you weeks or even months to become proficient in all these other requirements, and you need to build a website now!
The good news is this: you don't have to be exhaustively knowledgeable about a technology to use it. You do have to descend to the level of abstraction where it makes sense to you, though. For most utter beginners, that's going to be the command line. Learn how to use that. Then, learn how to write a Ruby program. That's not hard—actually, I maintain that learning rudimentary Ruby is easier than learning pretty much any other programming language. You don't have to be a genius or understand the implementation of the language to be able to write a basic script. You might need a bit more understanding to get good at it, but the issue is that many people fail to reach even this point, where they have basic proficiency.
If you spend the time up-front to learn the dependencies upon which the more advanced tech like Rails is built upon, you'll spend less time fighting the wrong battles. I personally guarantee that every minute you invest in these lower-level technologies will be earned back two-fold.
#rubyonrails people: please make sure that you give good advice. If a person is asking questions they should know the answer to, make sure their fundamentals are sound. Point them to this post if you have to. Rails is too complicated to bullshit program your way through.
If they have learned enough to get by, then I recommend Ryan Bigg's Rails 3 in Action. I just finished it last week, and it's a great way to lead people gently into Rails with good practices.
If they haven't learned enough to get by, or if their knowledge is suspect, run them through this gauntlet of skill-testing questions.
But if our goal is to get people through the Rails wringer, then we need to be clear to newcomers that they'll drown if they dive into the deep end.