Skip to main content

Slightly slimmed down Cairngorm

Currently, I am in the finishing stages of a Flex 2 project (actually a pet project of mine and 2 buddies). We have chosen to use Cairngorm for the client-side architecture. Generally, I am quite happy with this choice because it saved us from having to re-invent the wheel and it works quite well for us.

But.

At the beginning of the project we felt that Cairngorm introduces too much bureaucracy into our client-side architecture. It was simply too heavy for our needs (more like J2EE in 2001 than Ruby on Rails in 2007). So we stripped out two parts that we thought are adding unnecessary complications:

  • The most annoying bit for us were the value objects (VOs). We already have a model and we have an event object. We simply had no reason to create another object for transporting data. If we want to pass a model object to the business delegate we simply pass this model. I we want to pass some very simple set of variables (say, a string and an integer) we simply add that into the event. No need for VOs in our case.
  • We use only one business delegate. This delegate encapsulates all available services. To be honest, I am not sure if Cairngorm is even meant to be implemented like this, but anyway, it saves us from creating a new delegate whenever we add a service. All we need to do is add a new method to our delegate.
So adding a new service boils down to
  • adding a method in the delegate and the controller respectively
  • creating a new event class
  • creating a new responder/command class
Even coming from a RoR background where DRY is the dogma we can live with that.

Comments

Popular posts from this blog

Python script to set genre in iTunes with Last.fm tags

Now that I have started to seriously use iTunes I figured it might be nice to have the genre tag set in a meaningful way. Since I have a reasonably large collection of mp3s doing that manually was out of question - I wrote me a Python script to do that. There seems to be a large demand for such a functionality (at least I found a lot of questions on how to automatically set the genre tag) so maybe someone else finds the script useful. It is pasted below. General Strategy The basic idea is to use Last.fm's tags for genre tagging. In iTunes the genre tag is IMO best used when it only contains one single genre, i.e. something like "Electronica", not something like "Electronica / Dance". On the other hand dropping all but one tag would lose a lot of information, so I decided to use the groupings tag for additional information that is contained in the list of tags that an artist has on Last.fm. In the example above that would be something like "Electronica, Dan

Running the iTunes genre tagger script with OS X Automator

Due to public demand here's a little recipe how to run last post's mp3 tagger without using the command line on OS X: Open Automator Start a new "Application" project Drag the "Run Shell Script" action into the right workflow panel, set the "pass input" drop-down to "as arguments" and edit the script to (see screenshot below): for f in "$@" do /opt/local/bin/python /Users/michaelmarth/Development/Code/mp3tagger/tag_groupings.py -d "$f" done (you will have to adapt the paths to your local setup) Save the application and happily start dropping mp3 folders onto the application's icon.