Friday, September 26, 2014

Content-heavy sites, choosing between Ruby-on-Rails and PHP

"Easy training, hard battle. Hard training, easy battle!" -- http://www.leonardteo.com/2012/07/ruby-on-rails-vs-php-the-good-the-bad/


While reading Leonard Teo's article on when to choose Ruby-on-Rails or PHP, reading the first few paragraphs I wanted to learn RoR, then on next few paragraphs I'm leaning towards to learn PHP again, then on the middle paragraphs it seems like learning RoR is a wiser choice, but then on the last few paragraphs it felt to me PHP is not that bad; and then when while reading the comments, I'm gravitating again towards RoR, oh well.. :-) It took some six swings when choosing between RoR vs PHP while reading the article up to the last comment


Can't blame me :-) The article was written in 2012 and then updated this year and there are many insightful comments on that article too, having read the entire article and comments, it looks like there is now a renaissance on PHP. There are now new PHP frameworks which doesn't carry the crufts of the older PHP versions and only the language's latest capabilities are applied to new frameworks, making those newer frameworks cleaner and developer-friendly. A PHP MVC framework like Laravel is such an example



I tweeted:

RoR is a mature framework now, it's boring: http://www.leonardteo.com/2012/07/ruby-on-rails-vs-php-the-good-the-bad/

RT @nguerrera Great code is often boring. Exciting code is often wrong.



While RoR is mature now, I'm gravitating towards Laravel; not because it is exciting, but that helps too :-) I used PHP for about half a year on my first job a long time ago, so I'm new to PHP MVC frameworks now. The insightful thoughts from Pierre sealed the deal for me:

As others have suggested here you really should look at Laravel. The frameworks you mention (with the exception o possibly symphony) are what I would call "legacy" frameworks. They all have a long history going back to PHP 4 and are burdened by that legacy.

Laravel lacks that. The author of the framework was not a PHP developer originally. He came from a .NET/Ruby background and arrived on the scene only a few years ago. As such he started by supporting php 5.3 and didn't bother with legacy support.

So Laravel has some of the best features from Rails and .NET baked in: ORM, Active Records, robust routing, generators, migrations, BLADE (think Razor in .NET) etc.... In addition serious PHP frameworks now use Composer for all their components and most of their core. Just like Ruby Gems and Node's packages everything is centralized and not coupled to a particular framework. So you're only updating components via composer using the command line and not your entire framework. (Symphony is using this method as well)

In short, PHP has grown up in some respects. Laravel really is the closest thing PHP has to Rails, if you want to compare something closer in scope have a look at it.



With the author of Laravel experience in ASP.NET MVC, I'm curious to learn how much of the good ideas in ASP.NET MVC are injected into Laravel


So why not just adopt ASP.NET MVC for content-heavy sites since I have experience with ASP.NET MVC too? PHP is ubiquitous, cloud choices is definitely a plus. Microsoft having decided Windows on Azure should carry a premium price tag, Linux on Azure is budget-friendly



As compared to Ruby-on-Rails, Laravel has the controllers done right. See: http://lostechies.com/derickbailey/2014/01/30/playing-with-laravel-4-the-php-mvc-framework-and-telerik-ui/



And how about Java MVC frameworks? You can forgot Java when your server's resources is limited



Happy Coding!

No comments:

Post a Comment