Back to writing
DispatchPersonal · technology· Mar 18, 2009 · 3 min read

Choices, choices, choices.

I’ve been trying to explain away my absence from the interscape by citing work (lots of work, even). But that’s only half the story. Most of the work has involved…

I’ve been trying to explain away my absence from the interscape by citing work (lots of work, even). But that’s only half the story. Most of the work has involved making choices that will affect my life, and the nature of my work over the next couple of years (perhaps, longer). So, I decided to explain some of those choices, today I’ll focus on technology.

I’m working on an enterprise app. For the moment, the team comprises me, myself and a domain expert who can’t code to save his life [for eg. $.hanging_from_cliff( function() { fly(); }); ] … It’s a web app and should eventually (fingers crossed) morph into a SAAS. The team of developers will also grow over the next few months. And the app needs to be able to scale (vertically, horizontally, and morphologically).

The first thing I had to do was figure out what frameworks I would use. The last time I was coding apps, I was using C/C++, Java, Clipper, Cobol, ASP (no .net, just ASP) … we’re talking turn of the century stuff here. The world has changed since then, so I decided to ask people I know who’ve helped change the world. Three choices came up:

  1. Drupal
  2. Zend
  3. CodeIgniter

I was clear on a couple of things: I am a huge fan of MVC code. Basically, that means I love to separate code into three parts: the bit that handles interaction with databases (the model), the bit that handles all the program or business logic (the controller), and the bit that shows stuff to people (the view). I like these bits to be separate enough so that I can make changes to one without needing to make changes to any of the others. Drupal fell by the wayside very quickly because I found that while it calls itself a content management framework, it isn’t an app dev framwork and there was no MVC to speak of.

So, that left me with Zend and CodeIgniter. Which is when Ruby on Rails decided to put in an appearence thanks to someone who makes sense on and off (I think it has to do with the phase of the moon, but further research is needed here.) Now RoR is very attractive. She’s a girl, with all these curves in just the right places. But I did not want to invest time in learning a new language, even one as intuitive and English-like as Ruby (Funny that someone in Japan came up with it). I was super comfortable with PHP, and decided I wanted something that worked like the Rails framework.

Now, I’m not very fond of templating engines, I’d much rather just write my views in HTML/CSS/Javaquery then be forced to used a templating engine to show stuff. I’m also old fashioned in the way I view resources (last century hangover). So, I really wanted something with a small footprint that let me be me.

Shyam turned out to be right .. this is not something new, he usually is right, but after a point, it is a bit galling : The framework that I liked best was CodeIgniter, a throwaway suggestion from him during a phone conversation that he will now promise to remember, and pretend to have put deep thought into.

I quickly found a couple of libraries that helped me write better code. Most notably, DataMapper, an ORM implementation for CodeIgniter. Basically, it takes all the headache out of relational database models.

For eg.

// Person Model

class Person extends DataMapper() {
  $has_many = array('address', 'phone');
  function Person() {
    parent::DataMapper();
  }
}

// Address Model

class Address extends DataMapper() {
  $has_one = array('person');
  function Address() {
    parent::DataMapper();
  }
}

// Phone Model

class Phone extends DataMapper() {
  $has_one = array('person');
  function Phone() {
    parent::DataMapper();
  }
}

That’s all the code I needed to write to create three models with one to many relationships defined, and a host of functions that let me perform all the CRUD I want to do. Pretty sweet, eh And yes, it is a lot like Rails.

With the backend framework out of the way, I turned to the frontend. Since I like pretty frontends, and care about User Interfaces, and get hot and bothered when an interface isn’t as efficient as I can make it, this was a fundamentally important choice. My options:

  1. Prototype / Scriptaculous
  2. JQuery
  3. YUI
  4. etc.

I played around with Prototype / Scriptaculous, before recoding all my views to work with JQuery. Mostly because JQuery had far better documentation that I could find, and was far, far lighter. Again, my whole last century psychosis had some role to play in this. And, again, Shyam was right. Bugger.

So, here’s where we’re at: App, codename Candy, is progressing well, chugging along at a merry pace, with all the repetitive drudge coding taken care of by fantastic, lean frameworks that I like more with every passing day.

Recovered from the site’s WordPress archive, where it was published on 2009-03-18.