Courtesy of a massive hardware failure, I embarked on a journey about 6 months ago to move from a Windows infrastructure to a LAMP infrastructure for the ePartment54 website. The language of choice on Linux was obvious at the beginning, PHP of course. PHP wasn't that much different than anything else I had programmed in, but I quickly learned it got ugly real fast.
Sorting through the gobs of code which was my initial stab at a PHP version of the site, I decided to adopt something that was being hyped in the programming community...Ruby on Rails. To my surprise, it was a kind language that preferred a framework that forced you to do the right kind of things instead of allowing you to make a mess of it. It uses an MVC architecture which stands for Model, View, Controller.
Models – The model is where the 'business logic' takes place. It defines the important 'domain objects' like user, product, etc., and the relationships between them, and the processing that takes place. It's the heart of the system.
Views – The view is the way in which the system interacts with users. In web applications, this means generating HTML, Javascript, and perhaps images and Flash. It's the skin of the system.
Controllers – The controller ties the model and the view together. In a web application, the controller receives the user's request, interacts with the model to process and/or receive data, and makes the data available to the view. It's the nervous system of the application.
So that's an overview of the MVC architecture. I don't claim to be a software developer by any means of the imagination, but I sure like MVC better than anything I've tried before.
Now down to business. Obviously it's taken me quite a while to get this blog section done and functional...too long. When it comes to the total lines of code (business logic code, not presentation), here are the results:
That's right folks, only 1134 lines of code. You might also notice that my code to Test Ratio is pathetic. I haven't written a functional or unit test yet and I'm sure that probably slowed me down a bit. I can't tell you how many times I had to trace back problems due to small changes I made in the code. That's where those kind of tests come in handy. Prior to moving onto the next section of the site, I'm going to write a few tests for the blogs section just to get the hang of it. I'll then use that knowledge so that I can have better testing for the next section.
As far as the Ruby and Rails languages are concerned, I'm quite pleased. I've been able to go back to code I haven't touched in months and understand the flow just fine. This is something that I couldn't do a week later in PHP. The learning curve for me was about 1 month, but after that it was simply enjoyable to program in Ruby. I can't think of a language I've said that about before, but I think I feel comfortable saying it in this case. In fact, it is almost fun.
So to wrap things up, RoR blogs RoR. I'm pretty much 100% complete with the Blog section aside from user testing. I'll need to code up a bug reporting section for that first. Hope you all like the blogs and let me know what you think!


