Last Tuesday (10th of June) Obie Fernandez gave a presentation on
the RubyenRails conference in Amsterdam about The
Worst Rails Code
You’ve Ever Seen.
To be honest he had some really bad examples, he showed us for example an user controller of 1131 lines (of pure FAIL)!!
But a lot of examples were more in the line of not knowing there is a better alternative in Ruby or a better alternative provided by the Rails framework.
Obie came with an example like this:
1 2 3 4 5 6 7 8 9 |
|
(Of course, you can do the same with hash.values.)
I don’t think this is bad at all and I even think it happened to almost all of us. Most people working with Ruby On Rails were attracted by the power (and the beauty) of the Rails framework and had never worked with Ruby before (and most of the times had no or little experience with web development like myself). For a newbie it takes time to get used to and to find your way and understand the ins and outs of the language and the framework. And sometimes it is more simple or quicker to come up with your own little method like the example above. In fact, it’s a great way (or maybe the way) to learn a new language like Ruby.
The main point of Obie was that you need to learn the fundamentals, read some books and pair with senior people. All true, but it takes time and it’s more difficult for someone starting this year with Rails instead of let’s say 2005.
Rails is becoming a ‘big’ framework and if you know it really well (and keep up with all the new developments) it can make you really productive. But the learning curve is becoming steeper and steeper …….
If I look at available Rails jobs, everybody seems to look for a rails ninja, rock star, kick ass developer, killer rails developer, crazy rails hacker or even an inspiring Ruby god. I think they are difficult to find.
If you want my advise, find a place where they see your learning potential and don’t mind that you make mistakes like the ones Obie is talking about. It is all about learning by doing (and making mistakes along the way).
One more thing, Obie wrote The Rails Way, which is IMHO the best Rails book at this moment. At the end of his presentation Obie announced he is going to write a Rails Antipatterns book. I think this is not the right approach, please write a Rails patterns book, that is much more positive!