Authored by Primate

A rather awesome, informative
and witty blog about all things web

Learning Ruby on Rails

Learning Rails, one step at a time

Learning Rails, one step at a time

Although I’m not the Head of Development at Primate (I’ve got plenty of other things to keep me busy), I was a developer and web programmer for many years and it’s still something I find hugely enjoyable and a valuable skill I never want to lose. Aside from the fact that actually being able to program competently is a huge advantage in understanding the technical needs of clients and the general operation of web systems, it’s also a great way to keep up to date with the rapid developments that bombard our industry. Plus, I’m also one of those people who has to know everything about everything and I don’t feel comfortable until I understand something enough to the point of being able to break it down completely and rebuild it from ground up. Until then, I just worry like hell.

Anyway, as our company is a Ruby on Rails (RoR) development house, I’ve recently taken it upon myself to buckle up and learn Rails myself. Partly this is due my unrelentingly fear of anything I don’t understand (see above), partly because it’s going to really benefit us to have another proficient part-time developer on the team (that would be me) and also partly because I figured it would just be a heck of a lot of fun.

The transition from PHP

As someone who’s been programming with PHP for over six years, I was a little anxious about the shift into not only a new web framework, but a whole new language (Ruby). Would I be able to cross train? Would I manage to get to grips with the new syntax and development style? Would I even like it? Turns out all of those concerns were unfounded.

Some of its features, such as a database migrations, are also mind-blowingly good.

Although the Ruby syntax is certainly very strange to a diehard PHPer and some of the things in it are a little weird to get to grips with (I still don’t fully understand symbols yet) the core basics of Ruby on Rails are actually very easy to pick up. I can’t say I’m massively experienced in MVC frameworks but I’m familiar with the concept and have worked with platforms such as CodeIngiter and (shudder) Symfony, something which no doubt made my transition a little easier.

Perhaps the strangest, and most pleasantly surprisingly, thing of all though is the small amount of code you find yourself writing. In fact, as someone who’s used to working with older PHP systems, it was a downright shock not to have to manually add fields to database tables, corresponding properties and Get and Set methods to a class, and then manually update a form with the right code and markup. I know, of course, that plenty of PHP MVC frameworks out there cut that overhead down considerably but even great ones like CodeIgniter still seem to require a lot of code writing when compared to RoR. I’m not sure I’m ever going to get used to it.

Ultimately, if you’ve never used a MVC web framework before you may struggle with RoR but if you have I think you’ll be in for a real treat, discovering something that’s very natural and intuitive to pick up and quick and easy to get stuck into. Some of its features, such as a database migrations, are also mind-blowingly good.

Built for web

Ruby on Rails is a very modern and purpose built web framework and soon after first using it that fact becomes incredibly apparent. It’s built for the web. Yeah, I know that’s a slightly moronic statement considering all web languages and frameworks are but somehow RoR manages to stands out from the crowd by offering functionality and features specifically designed for a web developers life. Gems, its kind of version of plug-ins, database migrations and integral compatibility with services like GitHub and Capistrano just make perfect sense in the web industry and help deal with the issue of constant, small tweaks or continually changing specifications.

This agility is no doubt a big reason why the web community has embraced the framework so much. It’s speed of development, whether it be from command line file generations or the small amount of code required to perform actions, makes RoR incredibly agile and flexible to develop with, perfect for web systems where the requirements are often constantly in flux. Instead of being resistant to changes and alterations, changing and adding functionality becomes a lot less of a chore and a lot quicker to accomplish. For instance, adding a new field to a database and form becomes a moments work rather than a laborious headache.

there’s a reason why sites like Groupon and Shopfiy are built with Rails and why it’s the favoured language of new Internet start-ups

Is it for everyone?

As much as I love Rails and would like to endorse it for everyone to use, the pragmatist in me realises that it’s not a simple undertaking to just switch from years of PHP or .Net development to a new language and framework. Indeed, in some cases it may be completely impossible or at least too hard and time consuming to justify the benefits RoR may bring. Plus, in the world of open source CMS’ and blogging platforms, PHP still has the edge and I can appreciate that it’s not always practical or money efficient to ditch these systems, especially when RoR doesn’t have the same out-of-the-box platforms to compete. And let’s not forget that PHP has some decent web frameworks of its own.

Obligatory diplomatic statement out of the way, I really need to end by saying  that Ruby on Rails is a terrific framework and I’ve had a hugely enjoyable time learning it. It frees you up from writing endless boring repetitions of code and lets you focus on the stuff that counts – functionality, testing, usability – all the things that take an app or site from good to great. It also makes a whole lot of business sense in a lot of cases because its agility and rapid speed of development allow you to put together functional systems in a short period of time with lower overheads, meaning smaller investment and larger profit margins. At the end of the day there’s a reason why sites like Groupon and Shopfiy are built with Rails and why it’s the favoured language of new Internet start-ups.

If you liked this article then why not subscribe to our RSS feed.

Author: Gordon McLachlan

Gordon is uncomfortably good looking.



Showing 16 Comments

Leave a comment
  1. amcl August 30, 2011 at 11:36 pm

    Thanks for recommending a book on RoR! So far so good. I’ve got the Hello World site up and running :) Ship it!

  2. Reuben September 17, 2011 at 2:31 pm

    I’d like to think that CakePHP is the closest I’m going to get to RoR in the PHP world. It keeps me from crying myself to sleep at night.

    Upon investigation, my small collection of Ruby books (including the first one you mentioned, Gordon. I think 1.9.1 was very new when I purchased them) are being used as weights to dry flowers from my recent wedding.

    • Gordon September 17, 2011 at 10:37 pm

      I haven’t used CakePHP much so I can’t really comment. I have used CodeIgniter a far bit though and Rails isn’t entirely dissimilar especially in the fact that are both pretty easy to pick up. Rails is a lot more complete and comprehensive than CI though as that lacks even basic things like form helpers. I also know Symfony tried to do similar things to RoR and have generates for scaffolding etc but I found it ridiculously complex and hard to learn.

  3. Kevin September 21, 2011 at 6:42 am

    My only problem with RoR (a good problem to have) is that it is too advanced. I find myself writing very little code to perform something that would take me about a paragraph’s worth of PHP code to do. This leaves me uneasy thinking that I’m doing something wrong and that somewhere in the background a database field is being relentlessly and wrongfully overwritten or something of the sort.

    I’ve been working with rails for about a month now, after coming from 3 years of PHP and I have to say it’s a pretty awesome system. Takes a bit of getting used to, but knowing how powerful it is is worth riding the learning curve.

    • Gordon September 21, 2011 at 9:15 pm

      The lack of code in Rails definitely takes a while to get used to as do other features like the Rails Console and DB migration. Still, once you’ve got your head around them all, you wonder how you ever lived without them!

  4. porno avanture March 17, 2016 at 7:12 am

    It’s fantastic that you are getting thoughts from this article as well as from our discussion made
    at this time.

  5. Photoshop Tutorial March 13, 2017 at 6:14 am

    …Websites you should visit

    [...] What web host are you the usage of? Can I get affiliate hyperlink to your host? I wish web site loaded up as quickly as yours lol[...]

  6. adult friend ifnder August 16, 2017 at 5:19 am

    This page truly has all of the info I needed concerning this subject and didn’t know who to ask.

  7. adult friend.finder March 22, 2018 at 8:56 pm

    I do consider all the concepts you’ve introduced for your post.
    They are really convincing and will certainly work. Nonetheless, the posts are too short for starters.
    Could you please prolong them a little from next time?
    Thanks for the post.

  8. Adultfrienfrinder April 5, 2018 at 2:03 am

    Aw, this was a very good post. Spending some time and actual effort to produce a good article… but what can I say… I
    procrastinate a lot and don’t manage to get
    anything done.

  9. adultfrind April 6, 2018 at 7:44 am

    Thanks , I have just been looking for info about this subject
    for ages and yours is the best I have found
    out till now. However, what in regards to the conclusion? Are you certain concerning the source?

  10. fuck app April 6, 2018 at 11:12 pm

    Great article.

  11. bordojska doga prodam April 8, 2018 at 6:33 pm

    What’s up to every body, it’s my first go to see of this webpage; this web site consists
    of remarkable and in fact fine material in favor of readers.

  12. adam4adamn dating April 12, 2018 at 7:10 pm

    Hi, I want to subscribe for this webpage to obtain hottest updates,
    so where can i do it please help.

  13. adam4adamn login April 25, 2018 at 12:33 pm

    What’s up, yes this post is really nice and I have learned lot of things from it regarding blogging.

Leave a Reply