Posts filed under 'Cairngorm'

Improving Cairngorm’s ModelLocator Part 6 - Conclusion

In the previous articles I’ve outlined some alternatives to the standard practice of using a Singleton as the ModelLocator in Cairngorm. I’ve tried all three of the alternatives I outlined in a real project so here’s a summary of my opinions about them and the standard singleton…

Improving Cairngorm’s ModelLocator Part 5 - The singleton factory

So far, I’ve looked at two possible replacements for Cairngorm’s use of the Singleton pattern in its ModelLocator. I want to briefly introduce a third alternative before concluding this long string of posts.

Improving Cairngorm’s ModelLocator Part 4 - The monostate

In the first article in this ad-hoc series I expressed my desire to replace the Cairngorm developers expressed preference for implementing the ModelLocator as a singleton with an alternative implementation as a monostate. … The monostate pattern describes a class that can be instantiated as often as one likes and where each instance uses the same set of data - there is only one state shared by all instances, hence the name…

Improving Cairngorm’s ModelLocator Part 3 - Hiding the singleton II

In the previous post in this series, I showed how we can use a second class to access the ModelLocator singleton. This enables instances of this second class to be created, modified, bound to and disposed of as often as one wishes while maintaining the integrity of the data in the core singleton. Each instance of the second class mirrors the data in the singleton, modifying the data in an instance modifies the singleton, and modifications to the singleton are immediately reflected back out to every instance of the second class…

Improving Cairngorm’s ModelLocator Part 2 - Hiding the singleton

Following on from yesterday’s post about Cairngorm’s ModelLocator, I’ve devised some improvements to the code. This doesn’t alter the technique, but it does remove most of the repetition in the code.

Improving Cairngorm’s ModelLocator Part 1 - The problem

Neil Webb recently wrote about the problems with singletons in Cairngorm, and in particular the ModelLocator. In fact, there’s been a lot of criticism of Cairngorm’s over-dependence on singletons - sometimes, when working with Cairngorm it seems that everywhere you turn there’s a singleton waiting to bite you…