Sunday, September 23, 2007

Ruby Rails advocate switches back to PHP after two years

I'm referencing this article on the O'ReillyNet website.

I've been watching the Ruby/Rails phenomenon for several years now. It has always reminded me of what Java Servlets were like about 8 years ago when I first started working with them. The only difference is that there is a nice framework to create CRUD applications. If I had no idea of how far the Java world had come in the last several years, I would still be using PHP as well. The reality is that Ruby isn't even a consideration for me. Its a no brainer because Java kicks both PHP and Ruby's ass.

With Java, I couldn't imagine living without features like method level security, annotations, generics, Hibernate and its second level distributed cache, proper 3-tier MVC object models, fully transactional EJB3 entities, EJB3 services and most importantly, the ability to re-factor code at will with Eclipse. I even question unit testing. How do you ever develop proper unit tests for PHP? What if you re-refactor some code by moving a method around? The only tools available to properly do that are grep and sed. With Eclipse its two keystrokes and you know it worked or not because you actually compile your codebase. I see this problem all the time with PHP.

At work, we have this 7+ year old legacy PHP codebase that is complete utter dog crap. While it has enabled the creation of a successful company, it has really come in the way of growing the company exponentially. The codebase has been worked on by several people over the years, has no standards and does crazy things like PHP generating PHP code which then generates HTML.

Thankfully, my job has been to replace the crap entirely with Java and things are progressing nicely. We have a great framework that is similar to what we did with the SubEtha Mail project. The code is well documented, each subversion commit is reviewed, built and unit tested with cruisecontrol. Javadoc is rebuilt nightly. We use Trac to provide ticketing and websvn. If we introduce a bug in the business logic, we know about it almost instantly. We even have unit tests for the more complex portions of the HTTP layer (Single Sign On, Login, Logout).

I guess the point of this posting is that I can't see how anyone thinks that they can develop a 'robust', 'scalable', 'enterprise' PHP/Ruby application without the tools that are available in the Java domain. Sure, it can be more complex and 'wordy' to develop in Java than PHP, but the features and end result (highly maintainable code that scales to virtually any size application with great reliability) far outweigh the additional learning or cost/time to develop.