At the moment, PHP is undoubtedly the leading development language of online applications. It’s simplistic syntax and the prevalent amount of tutorials for it makes it a perfect starter language for online developers. The ability to include miniature chunks of code on any ordinary HTML web page makes getting started with PHP exceptionally easy.
However, there’s a new player on the block, Rails. With the recent release of Rails 3, building the next new killer application seems much easier and faster to accomplish. Rails 3 facilitates the development of online applications by providing developers with a powerful, scalable & expandable framework. Rails 3 has arguably introduced web developers with one of the finest object oriented programming languages.
There are a fair amount of powerful PHP frameworks that can be named. However, they all lack the powerful OOP features that Rails 3 provides. Models can be created as objects, then can be modified/saved into a database and destroyed at anytime. The powerful framework handles sessions, security, XSS, SQL injections and secures everything. However, the best part of this is the ActiveRecord ability to make optimized SQL queries without spending up all your time.
The workflow of creating a blog would be the following:
- Create a new Rails 3 application
- Create a post model (using a built-in simplistic scaffold application) with the following values
- Create a comment model (same scaffold application) with the following values:
- Content ID
- Related Post ID
- Use the automatically generated Post controller and write the following in it:
- Use the automatically generated Comment controller and write the following:
There is much more to it, however, everything just makes sense. I strongly suggest taking a look at Rails for Zombies which is a simple introduction to Rails. Also, watching the Rails 3 screencasts won’t take more than a couple of minutes of your time but you will undoubtedly be interested.
Frankly, here’s a small comparison of a little query that gets the 5 latest comments for a blog, both in PHP and Rails. You be the judge.
<?php mysql_query("SELECT * FROM comments WHERE id=1 LIMIT 5"); ?>
comments = Comment.where(:id => 1).limit(5)
Also, if you have nested objects, you can obviously do the following with Ruby:
hard_drive = Client.where(:id => 50).computer.hard_drive
I don’t even want to start thinking of how complex and time consuming writing a query for the above code, where it’s all done and completed within minutes. I personally think that any advanced (or beginner) programmers should give it a shot. Nothing but advantages so far here, I’ve yet to run into a Rails issue. I’d love to hear others constructive output regarding this, I know I might sound a bit biased however I have been very impressed by Rails.
Request a Free Trial along with a Free Cloud Strategy Session with our Experts.
Spend 30 minutes with our experts to discuss how to design, migrate and/or architect your cloud solution to help you meet your objectives. Following the expert session, we'll set you up with a free trial that is personally tailored to your needs.
Don't have any questions? Simply let us know and we can skip the expert session.