In this section, I will attempt to define the roles of each Cairngorm object. This goes beyond the technical implementation details, as it addresses the spirit of each object. I use personification to drill down and separate the layers more clearly.

  1. View. The only reason the view exists in any application is because text-only command-line applications have become increasingly unpopular since GUI's were invented. The View works for the user, and represents the interests and intentions of the user. The view only wants to look at data that is useful to the user, and the view only dispatches events that represent user gestures.

  2. View Events.

  3. Front Controller. This guy listens to View events, and dispatches commands. Arguably this is architecturally useless because the View could easily invoke commands instead of dispatching events, and having the front controller dispatching commands. There is truly no value-add to having a front controller be the middle-man between events and the command.

  4. Command object. The command works for the application. It is picky about what format it recieves data in, and it doesn't care about the server's concerns. It goes to it's business delegates and says "I want this information, and I want it to be useful because I only care about solving a specific equation in the application right now."

  5. Business delegate. When a delegate receives a request from the command object to gather information, the most important thing to keep in mind is that the delegate should make no assumptions about why the data is being requested, and what it is going to be used for. It should parse or translate the data so that the data format is as useful as possible given what the command is asking for. The business delegate has no business telling any other class what to do or updating any other class's data.

  6. Service Locator. The service locator contains a list of all services.

  7. Service. The service exists to gather raw data from the server, and to speak in the language of the particular server (or external data source) that it's talking to.

changed October 4, 2007