Why my next project will run on RUBY and not PHP

01 Jul

We have this thing we do with a few close programmer friends of mine….we never recycle the programming language if we can help it. Unless the project scope is identical,we always try to do it in another language. So far this has seen me learn a few cool languages (Python was the best one). So this time round….its ruby time…the gems be calling.


So why Ruby over the already known PHP,In a technical level, it beats PHP hands down. The same way as Python or Java also do. But from a cultural stand point and simple plain inertia, PHP still is the champion of the web.

PHP was made in the right time with the right set of features. Easier than C/C++ CGI. Easier to learn than Perl with its plethora of options. Python and Ruby wasn’t ready for that and few people knew about them. Java was not ready for prime time for the internet. ASP was not created. .NET was not created. Right place at the right time. Hard to beat that.

But PHP is showing its age. Sure, caching systems and lots of other tools can help it survive longer, but PHP was never meant to serve as a platform. You can’t possibly write an application server for PHP the same way you can with Java. You can’t have long lasting PHP processes because of how much it leaks. So the only possible architecture for PHP is to kill it off every once in a while and reload everything again later. And the bigger the framework, the longer it will take to respawn a PHP process.

The promised Facebook/PHP (HipHop for PHP)  was never actually released to the public. Quercus (PHP in Java) never became mainstream. So PHP is stuck with web pages. And the simpler the better.

Ruby (and Python, and Perl, similarly), were designed as general purpose languages. You do can build TCP servers, you can leverage OS level libraries such as libevent for highly concurrent connections. You can build web application servers. You can build message queueing systems. You can build desktop applications. You can build long lasting processes, even though Ruby still only has a rudimentary garbage collector (compared to Java or .NET).

And yes, it does surpass PHP for web development. But nothing comes for free and I don’t believe in free lunches as well. Of course, it is much more demanding for the programmer. You do have to have your computer science in check here. With PHP and the LAMP stack you just copy and paste some random code, press F5 to reload the browser and you’re good to go.

With more complex frameworks, it helps if you know what’s going on underneath. You do need to know real OOP. You do need to understand at least the basics of functional programming if you really want to take advantage of the language. There are tons of different libraries to learn.

So it is not easy. But I think that if you do like the career of programming, you should seriously look outside of your little box and earn many different languages to get your work done, Ruby being one of them (but not the only other one).

Leave a comment

Posted by on July 1, 2013 in Uncategorized


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: