Friday, June 23, 2006

PHP vs Ruby on Rails

Boy this is a tough topic. Let me say this... Ruby on Rails, based purely on its merits, is a better solution. I like the Ruby language (although it does take some getting used to), and the Rails framework is beautifully done. The MVC architecture, ActiveRecord, helper functions, all good stuff. However from a business standpoint, it does have some problems. First and most important, good luck finding skilled Ruby programmers. They are few and far between, and this is very important. I could write my app in Ruby on Rails and be very happy, but time is at a premium for me. I need other programmers to do the bulk of the work and maintain the application. Finding PHP programmers is very easy. A lot of people, despite all the hype, have not even heard of Ruby on Rails. Secondly, the documentation is not very good. I've read the "Agile Web Development with Rails" book, and although it is a great introduction, there are a lot of details left out which you later have to piece together through web searches as you start seriously developing. There are an almost endless supply of books on PHP. Also one important thing to keep in mind is that whether you're developing with Ruby for the Rails framework or PHP, how readable/maintainable the code is depends heavily on the individual programmers. You could write all your Ruby code directly into the HTML views and almost totally ignore the models and controllers if you wanted to with Rails. On the other hand you could structure your code very well with PHP and potentially come up with a more readable solution.

Again don't get me wrong, I think Ruby on Rails is great. But it more suited, at least at this point, to the individual programmer who is completely writing/designing the site himself or herself. For a business, the framework simply isn't popular enough or mature enough quite yet. I hope this changes.

The Ruby language itself can present some problems. A large part of the market for the framework & language would presumably be PHP programmers, but I found that the learning curve for them is steep with Ruby. Objects are not an easy topic for many of them, this is why PHP5 has been slow to catch on.

Ultimately we will have to see if the advantages of Ruby on Rails is enough to dislodge the huge installed base of PHP. PHP is free, open source, and very powerful in it's own right. And there are frameworks such as Cake that can give you an MVC architecture. I still think Cake with PHP is inferior to Rails with Ruby, but is the advantage large enough? Time will tell.

Introduction

The purpose of this blog, as the title would suggest, is to chronicle my foray into web development. A little background on myself... I am a former software engineer, I developed Windows applications using MFC/C++ for about 10 years, and also during my last year as a software engineer developed a web application using J2EE, I've tried to block out that experience as much as possible... :) I quit software engineering because I couldn't take endless meetings and politics at my company, and I became a real estate developer. As a real estate developer I found the need for some web applications, and after three years away from programming I find myself, for better or worse, doing it again. This time I can do it on my own terms and have fun with it, so hopefully it should be more enjoyable. My first application, one that will be very useful for my business, is a real estate auction web site. I've decided that I want to use Linux & MySQL, and the best options for that combination, based on my research, are Ruby on Rails and PHP. Stay tuned...