Tuesday, September 25, 2007

big requirements

Put your big requirements up front. This is a great little article.

This is just what I'm trying to do with the rewrite of the sunshine organics website. It's tough to keep this in mind, the tendancy is to make the application as cool as possible, with all the features that the client wants, but I think the primary goal should be to launch a site, and then when the site is launched, to incrementally add features to it.

Rails is great for this, it has tons of tools for incrementally moving forward, like migrations and built in unit/functional/integration testing.

I just recently took out a whole level of complexity out of the application, this level of complexity was actually in the original application, and I was trying to replicate it, but I realized that by taking out this complexity, I could make the whole application much simpler.

The layer of complexity that I took out was to have the City as part of the database. It made a lot of sense to have the City inside the application, with it inside, you could just have one database to keep track of, you could do lots of neat shortcuts, and potentially cut out a bunch of work for the client to do each week.

However, this layer of complexity got into just about every model in the database, just about every model would have to reference the City model, but not all of them could reference it, so it wasn't just boilerplate code, it was a lot of very complex code to keep the two cities apart.

What did I do instead? I decided to remove the City model from the application, and instead just run two different Ruby on Rails servers, one for each City. Wow, that totally simplified things, and made this project much more manageable. I'm so happy I did this, I was totally dreading writing all this City code into every model, and was holding back as long as possible before I did it.

So, for me the moral of the story is to not be afraid of simplifying your application if it's getting too complex. Luckily Ruby on Rails made this easy, and the decision I made this morning to remove the City controller and split the application is already implemented and running.