Post from June, 2008

Cairngorm Getting Started Part One : Overview

Thursday, 19. June 2008 21:58

First things first I need to acknowledge David Tucker for this fantastic post that got me started.

As David Tucker says in his post, though I think he’s lying, I’m no Cairngorm Expert either.  But I have used it recently and I like it.  What I’m doing with this post is to explain it as I get it, so if I’ve made any glaring errors please let me know.  This is also an aide memoir to myself too so I apologise for the slightly jovial tone, I like to keep myself amused while I’m writing.  What I can say with authority though is that I really like Cairngorm even though I’m currently using the PureMVC framework (I hope to post a similar getting started for that framework).

The Cairngorm framework appears to be the main framework suggested by Adobe for use when creating RIAs with Flex.  There are lots of other frameworks, Pure MVC being one of them, but this one is really being pushed as they bought the company that created it (Iteration II – acutally they were bought by Macromedia, who were then bought by Adobe, but the essential theory stands).

Cairngorm is an MVC (Model, View, Controller) framework that aims to seperate these different parts of an application so it is easy to maintain and also easier for large development teams to work on.  As each part of the application is seperate a different developer can work on each bit, after planning the application of course.

In essence with an MVC design pattern the Model should deal with the data, the Controller with telling the Model what to do and the View should site there happily being told by the model what it’s supposed to be display.

I’ll have a go at some pretty diagrams of the MVC pattern (you’ll see I’m no designer) but I’ll mainly explain the way I understand it.

At the most simple level : -

A user interacts with the view.  The view dispatches an event which is mapped to the controller (known as a command), the command makes a change in the model and the model then tells the view what to display.

Image of a simple MVC interaction

Now this is all well and good, but really the whole point of framework is to make it easy to manage the application and that includes data connections.  So the next step is : -

A user interacts with the view.  The view dispatches an event which is mapped to the controller (command).  The command creates a delegate to make a call to a data source and a responder that the result from the data call is mapped to.  The responder makes a change to model (which it is allowed to do as it is a controller) and the model tells the view what to display.

Data MVC interaction

So for a simple app that loads some XML the flow would be : -

  • Application Inititialises
  • Dispatches an “I’m alive” event to a controller class
  • The controller class creates a “GetXMLDelegate” class that calls to load the XML
  • The XML is delivered back to responder (at the control level)
  • The responder changes the model
  • The view displays the data the model holds

OK, OK, I’m laboring the point – but that sort of is the point. It seems very obvious but this is really important.  View talks to Control, Control changes the model, model gets the view to display what it tells it to.

The most important and cardinal rule is ONLY CONTROLLERS (ie. Commands or Responders) CAN CHANGE THE MODEL!  If you stick to this cardinal rule your life with Cairngorm will be much more fruitful.

One other bit of advice is to try and keep things simple. One command does one function. This means you’ll end up with loads of classes, but if something does go tits up then you’ll probably have a good idea as to exactly where the application is failing, and probably the filename of the class that is the problem.

OK – part 2 – lets set up the environment for developing with Cairngorm.

Category:Cairngorm, Flex, Flex Builder, Frameworks, Tutorials | Comments (1) | Author: admin

Google Ads

Thursday, 19. June 2008 10:15

Ok – I’ve popped some advertising on the site.  If it gets too intrusive I’ll take it off, and if google can’t work out that I’m actually in the UK and NOT spain then I’ll definately take it off!!

I hope that the ads don’t detract from the rest of the content. but hey – I’m a freelancer now and I need to fund my website hosting habbit somehow (I’m hosting 5 sites and this is the only one really doing anything – I’ve got a blog for my 18month old son for goodness sake!)

Category:Uncategorized | Comment (0) | Author: admin

Firefox 3 released

Thursday, 19. June 2008 8:28

Firefox 3 has been released and there are a few new feaures that are cool.

I like the new address bar drop down, lots of extra info on the sites you’ve visited displayed really nicely.  Icons are very web 2.0 now, but I suppose that was to be expected.  I’m slightly irritated that the refresh button has moved to the right as I’ve been clicking on the wrong side from habit, though I’m sure that I’ll finally get the hang of it.

The new bookmarks system is very nice – allowing you to easily add links and tag them so you can add extra info.

I’ve heard that it runs a lot quicker too – but lets see.

The only irritation is that FireBug was knocked out by this latest release, I’m keeping my fingers crossed that they get that sorted soon.

Category:Browsers | Comment (0) | Author: admin

Twitter and Twitterfox

Wednesday, 18. June 2008 11:05

I’ve not been all that bothered by twitter, and to be quite frank I didn’t really get it.  Recently someone sent me a link to a FireFox plugin called TwitterFox a seriously easy to use browser plugin for Twitter.  Just install it and then the twitter icon appears in the bottom right hand corner of the browser.  Pop in your Twitter username and password and boom!  All your ‘tweets’ are polled by this little tool – the number of latest tweets are displayed when you log in, and every time it makes another call to get the most recent posts.  What’s even better you can use it to directly tweet yourself from the browser.  Very nice!

Category:Cool Code | Comment (0) | Author: admin

Onto the big wide world of Freelancing

Wednesday, 18. June 2008 8:56

Those of you that know me will be aware that I used to run an agency called e-Smartz with my colleague Patrick Reynolds.  Paddy set up the business early in the 00s and I joined around 5 or 6 years ago, and soon we were fully fledged business partners.  After the ‘difficult’ start up period – no money and lots of late nights (and grumpy wife-me / girlfriend-Paddy) we really started to make some in roads.

After a few really cool projects working for Allianz Cornhill (now Allianz), the BBC, Sony pictures and a few others we picked up a megga job redeveloping the Emirates Bank website.  Yep the one that works out of Dubai.  We’ve been working on this project for around 18 months, jetting back and forth from our development offices in England and the office we’d set up in Dubai.  Wow – so why the f*ck have I left?  Especially now the work (and more importantly money) is coming in?

Well my little boy, Charlie, is now about 18 months himself.  I thought it’d be fine to crack on with running the team, being a good husband, father and vanishing off to Dubai every month or so for a few weeks.  Well ladies and gents – it doesn’t work like that and after 6 months hard thought I realised that something had to give.  So, as anyone with a family will tell you there is only one decision that I could have made.

I think e-Smartz is a cracking agency with some really talented designers and developers working there, headed up be a technical architect who has (forgive me for this Padz) been in the industry for donkeys years.  I’d happily recommend them to anyone who wants / needs a new technology solution to their web or communication issues.

I wish them all the best in the future and look forward to collaborating with them as time goes by.  I’d especially like to thank my team, Sam, Mike, Luke and Jess for being cracking guys to work with!

To e-Smartz : Later t ;)

Category:Uncategorized | Comment (0) | Author: admin