28 Aug 2012

Ruby on rails, one month after

I started learning ruby on rails this month and I must say I am really impressed by the language and architecture. I have been developing web apps in PHP for a long time and can't help but take a look at where RoR got it better.

MVC and Rest

Rails comes in a MVC architecture by default. If you are new to MVC and its advantages, take a look at Jeff's article about it. In PHP, building your app with the MVC architecture will require using a framework that will saddle your codes with extra unnecessary codes. Not like you can't without a framework though. It just takes a good knowledge of the language to.

But good codes structure and organisation is not only it. Rails also allows clean REST urls like products/new, products/12. Plus it has a great support for the other "non common" HTTP methods you will rarely run into in PHP like DELETE, PUT and HEAD.

Easy Collaboration

Team collaboration is easy with RoR. And not only because of the MVC architecture. Rails offer migrations as a way of tracking (and reversing) database changes.

Helpers

I think this is a very strong part of the framework. Ruby on rails has a lot of helpers to make your coding easier. I can't think of a place you turn without finding helpers - form generation, error message handling through flash messages, form data validation, password hashing, and lots more. Beyond helpers, one of Rails principles is "Convention over configuration" meaning it makes assumptions about what you want to do and how you're going to do it rather than requiring you write all the code. Most times your models will only have few lines of codes. All the heavy work and database reads and writes automatically done for you.

Security

Rails is very conscious of security. It provides extra measures to block security holes. An example is that it generates and embeds an authenticity_token in html forms to prevent cross-site request forgery. It also provides encryption helpers for cookies, sessions and passwords.

 

These are just the few. There are lots of others like integrated unit testing and asset pipline to concatenate, minify and manage JavaScript and CSS assets. Ruby on Rails is a great framework. I really see myself learning more about it. One of the cons though is that the learning curve is stepier especially if you have no programming experience. PHP on the other hand is a very simple language anyone can easily pick up.

If you want to give it a shot, Rails Guides is a very good place to start. A lot of other tutorials I saw around were introducing other frameworks and made it even more complex. A good programming language tutorial/book should start by teaching you the core language and basics and not already start showing you the other ways by introducing you to other frameworks.

 

Looking for a simple marketing automation tool to automate your customer onboarding, retention and lifecycle emails? Check out Engage and signup for free.

 

My name is Opeyemi Obembe. I build things for web and mobile and write about my experiments. Follow me on Twitter–@kehers.

 

Next post: The Twitter API changes BS