Archive for December, 2007

Is Rails suffering the same problems as PHP?

I know that mentioning Rails and PHP in the same sentence is taboo and can incite many flame wars. But hear me out — Some say one of the “downfalls” of PHP is that its so easy to write applications and just about anybody can write a PHP if they put their mind to it and learn the syntax. As a result, PHP Applications have a long history of badly written, insecure code and has really been shunned by many advanced developers (aside from many poorly named methods, I think PHP is alright!).

In recent months I’ve been recruiting for a Rails Developer at my company, in Chicago. I did a phone interview and the guy couldn’t name me any rails sites he reads, or name the 7 rest actions, or even tell me what version(s) he uses. Now, I’m not claiming to be an expert, but I would think that even an average Rails developer would know that.

I’ve also seen code where the developer doesn’t quite get MVC. You don’t need to be validating values in your controller and adding error messages to @model.errors.add for example. You don’t need to be setting up display labels in your model. You don’t need to be counting things in a helper method. I was thinking, why is it so hard? Is it because in mostlanguages we have had free reign to interpret MVC however we pleased? I know I spent many years in PHP trying to develop a DAO. I made an object that returned a row of data, with methods to access the fields. But what about a collection? what is that? I experimented with an array of objects but I felt that was too wasteful. Iexperimented with a DaoSet that was made to hold a collection — complete with iterators! I even struggled with MVC and knowing what went where…when I saw Rails it was like someone who met their true love — this is it!

After experiencing Rails, I realized hey I can do some of this in PHP! I wrote a simple MVC framework in PHP. I called it StupidlyEasyMVC Framework. I was able to use it at work (at the time, I was still at a PHP job. Some say I talk about that time in my life as if it were a prison sentence haha). SO I was able to apply things I learned from Rails, into an existing structure at work. Just like the guy from CDBaby — I couldn’t drop my existing PHP site and just start converting to Rails, but by starting to gradually switch from what I had to an MVC structure, it made my code cleaner and easier to work with.

So as I look for advanced rails developers, I find they are far and few between. Either they are hotshot consultants or working on their own startup. What makes a rails programmer “get it” and really work with the framework instead of against it - still trying to write as they always have?

Here are some things you can do if you feel you are still writing PHP or .NET code in rails..

Get a project. You can read and dabble all you want, but if you don’t have a project, you won’t be forced to learn. Along with that, you need a timeline to force you to keep at it!

Watch all the Peepcodes! especially the REST and rspec episodes. I’ve search hard and long enough for answers, to find comprehensive training in ONE spot, in such an easy to learn format is awesome. I constantly talk about peepcode and I won’t work with anyone who hasn’t watch them.

Peepcode Code Review - their first book, full of helpful hints and gotchas that will really help you move beyond a beginning developer

Ruby Inside Blog - www.rubyinside.com

Jay Fields - http://blog.jayfields.com/

Obie Fernandez - obiefernandez.com

Books:
Agile Web Development with Rails - If you are doing Rails and don’t have this book, get it! It is the bible of rails! I don’t care if you have the first edition already, this will save you time!
The Ruby Way by Hal Fulton - because if you don’t know ruby, you will never be a good rails developer.
The Rails Way by Obie Fernandez - its good because I tech edited it before publication! It is a comprehensive instructional and reference book — all in one. I cannot wait to get my hands on a paper copy of this to keep at home and one for work. (just got one this week…I’m ecstatic)

Well this has been mostly a rant but hopefully a help resource to move into more advanced development of rails. If you have other insights into this problem or suggestions for how to improve, please leave a comment!

Comments (3)