Rails is definitely FOR beginners, whatever @DHH says
There are few topics in programming more likely to cause dissent than the ideal way for beginners to learn a programming language1 or even to program at all, and whilst I’ve read some great posts on the subject – I think many of them are missing the point. A lot of the posts I’ve read are 6 months old now, but little has changed to frame their arguments differently – I apologise for rehashing the subject, but I wanted to offer my own take.
Not for Beginners?
There seems to be a reasonably broad consensus that Rails is ‘not for beginners’, with comments from the very top of the ecosystem down (see @dhh tweet below).
@sryche Rails was never primarily about being friendly to beginners. We encourage improvement and for people to live up to the state-of-art.
— DHH (@dhh) November 30, 2011
An oversimplification of many of the arguments (presented more eloquently by Rob Yurkowski, some horse called Oscar, Richard Bucker, Michael Bleigh, and more) is that Rails’ complexity means that it is too difficult for beginners to learn, and even that the interest in Rails of beginners in some way might harm the project itself.
Having read most of the prominent posts on the subject, it strikes me that the people writing fall into a broadly similar camp – having some prior programming experience, encountered Rails in some previous incarnation of the framework, feel that the ongoing changes to the codebase make it increasingly difficult for beginners to programming to learn how to get started, and/or feel that the community has become hostile and unhelpful to requests for assistance from beginners.
A beginner, what’s that again?
I think the most important thing to stress, and the point that gets lost by lumping all ‘beginners’ in together in some kind of Rails Programming Draft, is that there are many many different types of beginner, with many different goals. Rob Yurkowski touches on a couple of types – young and enthusiastic or refugee from PHP seeking redemption – but this only scratches the surface.
Dealing with difference creates complexity – this is a fundamental law of dealing with any system or network. Looking after Apache is simple, Apache + Passenger is quite simple, Apache + Passenger + MySQL is less simple, Apache + Passenger + MySQL + Memcached is less simple again. By the time you build up to a full application stack with reverse proxy caches, load balancers and the like – that ends up being a complex environment. In many cases, this is one of the main arguments against Rails for beginners – it is too complex, it has too many moving parts.
Certainly this can be an issue – if someone wants to learn Rails in order to put a one page static site on the Internet, then it is certain they have not understood why they might like to learn Rails, or indeed any web application framework. Within this kind of use subset, I certainly support the idea that Rails is not for beginners, but then again it is not for this kind of use either and thus is no co-incidence in the former being true as well. We, as programmers, only have ourselves to blame though for people believing that they need to learn more complex skills and frameworks for domain problems that are well and truly solved without them.
We need to stop being snobby
Much of the problem of these ill-advised beginners believing they need to explore Rails is in the general superior attitude and snobbery that we possess as a coding community. Possibly, it started with FrontPage and the identikit style that it produced. I’d feel smug if once again another problem could be placed at Redmond’s door2, their condoning and encouraging a lack of flair and original thought in FrontPage directly leading into those that knew better looking down on the work it produced. Certainly though, I have lost count of the times that I have heard (and sometimes made) disparaging comments about using Dreamweaver without understanding a thing of how the underlying technologies work. The general feeling amongst ‘serious’ coders that if you aren’t developing with Emacs or Vim you aren’t really ‘getting it’3 is another, smaller scale example.
In the case of those people who really just need a small, static site and some encouragement, this snobbery is not helpful. Telling a man who needs a manual on how to saw wood he needs to be using the latest industrial scale automatic logging device would be ridiculous, and in most industries and walks of life there is a grudging respect for those who do things the hard way. I am sure that anyone cutting down a tree with nothing but sweat, wheatabix and an axe will get respect – not someone laughing at them for hand-coding CSS rather than writing SASS or LESS.
It is our responsibility as a community to encourage those who have no need of the complexity of going deeper, and are likely to suffer for doing so, that they can achieve what they want with simple tools. Learning Rails won’t suddenly make a website look any good, nor find visitors and pageviews. If people shouldn’t be beginners, we should ensure that they feel valued and proud of the level they need to be at.
The other fish in the Sea
Having ruled out those who shouldn’t be here, we get left with the rest. At this point, realism starts to bite as there are broadly three classes who remain – those that can’t, those that won’t and those that might. I’ll discuss each of these in turn.
Those that can’t
Unfortunately, not all of us are equal – it’d be lovely if we were, but it’s not true4. Some people are not born to be web application developers – either through ability or available time – and that’s ok – it doesn’t even mean they can’t come to the party. There are some fantastic tools such as SquareSpace which lower the boundary to having a reasonably custom web presence, and for some people this is the kind of developing that they should be doing – it’s enjoyable, productive, and can end up with phenomenal results. It takes a level of intellect to get to grips with the enormity of the task of building a web application – from choosing the underlying technologies (RDBMS vs NoSQL), live web technologies (Goliath, Faye, learn Node, or pay a company like Pusher?) to considering caching patterns to ensure responsiveness for users – there is a lot you need to know, regardless of which language you choose, and unfortunately you need to understand it too. Using a tool, like SquareSpace or iWeb shouldn’t be derided – they are viable options for many many people who want to be part of the Internet, but don’t have either the intellect, or even the time to get to grips with the technologies needed to code your own. Here, yeah – Rails is not for these beginners, but no Framework is – the responsible approach is to guide them into a more suitable channel.
Those that won’t
Some people have enough intellect, have enough time, and even have enough inclination to learn how to use Rails – normally with some dream of writing a new social networking site that will make them rich. And that’s where it stops with these beginners for Rails as they will never learn – they aren’t trying to learn to use Rails, they are trying to reach some end result without caring how they get there. These beginners are the problem ones, and the ones that really most of the people who say that Rails isn’t for beginners are seeing and railing5 against. Nobody who builds houses only knows which bits go where – no brickie can only tell you which shape brick he will use. To become accomplished in a trade or skill, you have to have a desire to understand “why” rather than “what”, and fixating on the “what” with Rails will bite you in the arse very quickly.
There are thousands of Stack Overflow posts, or Rails forum posts, or IRC messages that just want solutions to relatively basic Rails problems, without the posters wanting to take the time to understand why they are in trouble. Ultimately, I could categorise those that won’t very simply – do they google for their problem before asking for help? If they don’t then yeah, sure, Rails isn’t for them.
Those that might
Here, this is the crux of it though – those that might. People with enough intellect, time, energy and a desire to learn. For those beginners, who genuinely want to master a new technology, then it is imperative that they are encouraged to adopt the best techniques and most cutting-edge practices; this industry moves too fast not to. This is where Rails, more than any other framework, is the right choice for beginners – by being, to quote @DHH again:
@sryche Rails was never primarily about being friendly to beginners. We encourage improvement and for people to live up to the state-of-art.
— DHH (@dhh) November 30, 2011
Rails sets itself as the gold medal target for learning – learn Rails, and you’ll be ahead of 95%6 of developers in your outlook, and preparedness for the approaching trends of the Internet. I came to Ruby web development from PHP, and when flicking back every now and then I am amazed by how backward it seems. I don’t want to TROLL the PHP community – it’s a very capable language, and achieves lots of good things, but it hasn’t moved with the times, probably through its fragmentation into the 35million different frameworks on offer. Things such as the asset pipeline have no match in PHP-land, or even in the rest of Ruby web development, but they are the future – for example consolidated, efficient asset handling promotes quality, robust front-end code.
If you are going to learn, learn the best – as anything else is a false economy, and a waste of your time.
It will be hard
Don’t get me wrong – I agree with many people who say that Rails is very hard for a beginner to learn and understand. In fact I gave up learning it, the very first time I tried (back in early 1.x), due to it not making much sense coming from spaghetticode PHP. I can totally agree with people saying that the newest functions and features further increase the learning curve too. Well, what do beginners expect? It to be a walk in the park? With a decent grounding in Ruby, such as following Why’s guide, and blitzing through the Ruby Koans, you could expect to be in a position to grapple with Rails as a complete beginner to Ruby web development. Yes, Sinatra possibly might seem more approachable and easier to “learn”, but what do you really learn by doing this?
|
1 2 3 4 5 6 |
require 'rubygems'
require 'sinatra'
get '/' do
"#{Time.now}"
end |
And then running ruby yourfile.rb? Yes, it is essentially a dynamic web application, yes it is awesomely simple – but learning how to make Sinatra run a blog application with several resources (Posts, Categories, Tags, Authors, etc) and an Admin area – that’s really rather harder – in fact it’s a lot harder to write a Sinatra CRUD application and tie it all together than it is to learn how to do the same in Rails.
Maybe it’s not all that hard
A lot of this comes down to snobbery again – ‘scaffolding is evil’ is a normal refrain amongst experienced developers, and in many ways it can be, and certainly can lead to bad habits, but really – for a beginner – is it?
rails g scaffold post title byline body:text gets you an awfully long way, and more importantly writes some decent code to learn from as a beginner – what better way to learn how to respond to request types than to actually see a respond_to block? Yes, ultimately hand crafting controllers and models is preferable, but when talking about beginners, it’s really important to remember that there can be steps to wisdom.
Finally
Ultimately, the question of whether Rails is for beginners or not comes down to this: do we want new developers pushing old techniques and slowing the adoption of new practices, or do we want the next developers to believe in best practices and are agents for change? Rails may have reached widespread adoption and acceptance, but it still disrupts. Surely we need to encourage beginners to buy in to this, not the old ways?
Actually, it turns out I was wrong – @dhh is actually explaining why Rails is the only choice for beginners when he said Rails sets out to “encourage improvement and for people to live up to the state-of-art”. After all, these should be the only criteria when choosing an ideal framework for beginners.
- Some that come to mind are: Choice of RDBMS, Whether to use a RDBMS at all, Which NoSQL technology is best, Evented vs Threaded, MVC purity, VM choice… Actually, there are a lot, come to think of it – I’ll let the point stand for effect though! ↩
- Although in doing so, I violate the commandment of the title of this section and perpetuate the problem ↩
- I use Sublime Text 2 on my linux boxes, and TextMate on the Mac, and would need an army to shift me from them. Unless TextMate released for linux, in which case I’d solely use that. ↩
- Darwin. Need I say more? ↩
- Yep, slight pun there ↩
- 97% of statistics are created to suit the argument being made, 53% of the time. ↩
Recent Comments