MVC Marathon

Over the last few years, I’ve spent a fair amount of time on the same projects, using the same tools, in the same languages. By day, I’m a mild mannered .NET programmer. By night, I fly the Perl flag, and spend a lot of time using Catalyst, one of the Perl based MVC frameworks. While I’m not abandoning those technologies, I think it’s time for something new.

They say you should learn a new programming language every year or so, and I’m long over due. Why not learn three languages at the same time to make up for lost time? :-)

The Challenge

The challenge is to build the same mvc application on all of the frameworks listed below. While I’m comfortable with Catalyst/Perl and ASP.NET, I’d like to be able to work on any project that comes along rather than simply answering “Sorry, I can’t help. I don’t program in that frameowork/language.” I started my career as a Windows-only web programmer and over time, learned my way through FreeBSD, Apache, Perl and Catalyst.

Will I be an ‘expert’ in Ruby or Python when I’m done? Surely not. But 3 years ago, I couldn’t program in Perl either and 10 years ago, I could’t even begin to get a *nix OS installed and configured to run Apache.

The Frameworks

For this adventure, I’ve picked what might be considered the most popular mvc framework for each language. These frameworks will be:

ASP.NET MVC: Preview 3

While my day job includes programming in ASP.NET 2.0 WebForms and I have followed the MVC progress, I have not yet created an ASP.NET MVC app. Just to be a little more challenging, I will be doing this project in C# instead of the usual VB.NET that we use at work.

CakePHP: 1.2RC2

I’ve read as much of the manual as I can at this point. This will be my first CakePHP application and my first PHP programming since PHP4 was released.

Catalyst: 5.7

Catalyst is one of the many MVC frameworks written in Perl. I’ve been using Perl and Catalyst for about 3 years. While this could be my strongest framework, I’ll be using none of my existing bag of tricks.

Django: 0.96

I’ve never written a single line of Python before. After looking at the Python and Ruby syntax on multiple occasions in the past, Python seems to be the language furthest from how my brain works now compared to Perl/C#.

Ruby on Rails: 2.1

Just like Django/Python, I’ve never written a line if Ruby in my life. I’ve been through the screen casts and sifted around a few articles and book excerpts. However, unlike Python, Ruby seems to fit how my brain works with Perl a littler cleaner.

The Application

I’m sick of the usual blog demo applications so I’m going to go with something a little closer to my heart. Those who know me know that I’m a big fan of hot food: If you don’t sweat, it’s not hot enough. So for this challenge, I’m going to build a site that tracks lists of restaurants and a list of menu items for each eatery hot dish.

The application will be built in stages. Each stage will be built in every framework before moving on to the next step. After completing each stage, I’ll post a new blog entry covering what code needed to be created in each framework and the pros and cons each framework provides. You can follow the source code progress in my GitHub repository:

http://github.com/claco/mvc-marathon/

Step by Step

  1. Part 1. Creating a New Application
  2. Part 2. Creating a Database and Model
  3. Part 3. Creating a Restaurants Controller and View

5 Comments (Add)

1
On July 1, 2008 11:57 am, Chess wrote:

If you can keep all the variations of dialect straight enough to properly compare my hats off to you. Why not build the application once and complete in one framework, then pit that against another in the second round, winner progresses, etc etc.

For Rails I suggest that before you tackle a section, review the relevant RailsCasts.com (Ryan Bates) on that section. Also grab the WhatsNew in Rails 2.1 pdf (2nd Edition).

Good luck!

2
On July 1, 2008 12:31 pm, Christopher H. Laco wrote:

I chose to complete each step in all frameworks together is that I should be able to better compare each step across all frameworks. My fear with completing the project on one framework before moving to another was that I would forget my thoughts and grievances byt the time I moved on to a new framework.

I guess time will tell.

3
On July 1, 2008 3:06 pm, Samori Gorse wrote:

You should definitely replace django 0.96 with trunk.

4
On July 1, 2008 3:35 pm, Christopher H. Laco wrote:

I’ll have to think about that. I am using the RC2 of CakePHP. My fear with trunk Django is that if I run into problrms, I might be in new territory. Whereas if I stick with .96, plenty of people have made it through that already.

Plus, I installed using fink on my MBP as I didn’t want to fight any install issues…just get it all up an running asap.

5
On July 1, 2008 9:55 pm, Samori Gorse wrote:

I think you should more fear the fact that 0.96 is one year old and that plenty of enhancements have been made since. :-)

I guess most of the people currently working with django use trunk, and a lot of useful applications are based on django-trunk (e.g django-registration, django-evolution, etc…)

Anyway, good luck ;)