Shaun Mccran

My digital playground


My natural development pattern - software layer-ification

Whilst reflecting on some of the projects I'd been through in 2011 I noticed a pattern that became more and more prominent as the year wore on.

All of my project functionality was naturally splitting itself into independent service layers.

[ More ]


Web Accessibility 101 - Compliance and Standards

This article will discuss UK based Accessibility Compliance and the development standards around ensuring that your project will pass Accessibility testing and validation.

This is the second in a series of planned articles dealing with Web Accessibility. In this series I will cover what is Accessibility, how to build Accessibility into web projects, how to test and validate for Accessible users and a few other factors to keep in mind when dealing with Accessibly minded projects.

[ More ]


Lionhead studios launches GPS based fable 3 mobile App - Kingmaker

Lionhead studios have just launched 'Kingmaker', a mobile application that uses your GPS data to mark locations as 'owned' by you. You work on behalf of one of two teams, and receive gold coins to be spent within the game, every time you log a location in the application.

From a technology point of view this is an interesting example of many different platforms all converging to drive people towards pre ordering and buying a game.

The initial interaction is through several different mobile platforms (iPhone, Android, Blackberry and Windows 7 mobile). Each GPS 'tagging' posts to social media platforms, such as Facebook and Twitter, and the virtual gold is credit to your account. The account itself is an Xbox 360 account (windows live account), which will interface with the game, and you're in-game character ends out with the gold you have accrued.

It's an interesting proposition, and is trying to integrate several differing data platforms into one cohesive direction. It really is joined up thinking.


Pre loading object (CFC) references in your Application.cfc

One of the best practices that I've been using more and more is ColdFusion's ability to add CFC object references to scopes. By this I mean that it is possible to create a shorter friendlier scoped variable that you use to reference your CFC's.

In your Application.cfc you can map out all your CFC references, this gives you a much shorter variable name to type each time, and it caches the CFC.

view plain print about
1<cffunction name="onApplicationStart">
3<!--- scope out all the objects as application level vars --->
4<cfset application.formObj= createObject('component','dir.objName ')>
5<cfset application.siteObj= createObject('component','dir.objName')>
6<cfset application.mailObj= createObject('component','dir.objName')>
7<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>

Put any references like this in the 'onApplicationStart' function. You do not need to lock the scope in this function, and if the code within it does not run successfully then it does not continue running the application. It will try again on the next page request.

The caching functionality here is great, not only will Coldfusion create a handy short name for CFC, but it will actually run through the code, and stop on any errors. If you deliberately introduce a code error into one of your objects you will see the Application halt and show you the error. For me this is reason enough to move all my business logic into CFC's. This essentially means that it is not possible for a user to get part of the way through a application and find an object based error.

Using this in conjunction with a framework such as FuseBox allows you to load, parse and cache the CFC object, all before your actual display layer has been invoked.

The example below uses the FuseBox function 'onFuseboxApplicationStart' of starting an Application.

view plain print about
1<cffunction name="onFuseboxApplicationStart">
2    <cfset super.onFuseboxApplicationStart() />
3<!--- scope out all the objects as application level vars --->
5<cfset application.formObj= createObject('component','dir.objName ')>
6<cfset application.siteObj= createObject('component','dir.objName')>
7<cfset application.mailObj= createObject('component','dir.objName')>
8<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>

Changing the 'fusebox_parameters.mode' value allows you to set this caching at an environmental level, so no caching for development, or caching for live

view plain print about
1<cfset FUSEBOX_PARAMETERS.mode = "development-full-load">
3<cfset FUSEBOX_PARAMETERS.mode = "production">