Tuesday, December 16, 2008

Announcing JumpShip 4.0

JumpShip 4.0 has been released. The new version, although not significantly different from the last, takes a slight philosophical departure from the last. And since it was a significant enough change to possibly break compatibility with older version, I've decided to call it a new major revision.

The most significant change in JumpShip 4.0 is that, now the framework actively discourages the use of Singleton that have become widely popular in other frameworks. Although JumpShip has always touted it's diminished use of Singletons and therefore it's advantage when using it a an application framework or a component framework, the framework itself has never taken an opinion on the use of the Singleton pattern and in face included a few Singletons itself.

There has been a recent backlash against the Singleton pattern in the design pattern world ( See the post on http://www.as3dp.com, Scott Densmore's post, or Miško Hevery's thoughts ). The Singleton has been used as a substitue for global variables ( you know, those things good programmers never use ), and have all of the drawbacks of globals. They can be very convenient but make your code hard to read, hard to test, and hard to debug.

For all these reasons, the latest version of JumpShip has removed ( almost ) all of the Singletons in the Framework. The one exception being the JSRuntimeEnvironment class which is used to make your application behave slightly differently ( logging, throwing errors, etc. ) in a development environment than it does in a production environment ( stability at all costs ).

Eliminating Singletons meant eliminating some classes from the framework, namely the service locator classes, and changing others, JSApplicationState and JSRailsGatewayBase, so that they do not have Singleton implementations.

This has effected the Rails Gateway classes the most and hopefully made the easier to use. You now no longer need to extend JSRailsGatewayBase in order to use it. Instead of having to define a service locator in the implementation, you simply pass in the base path of your Rails app when you create a new JSRailsGatewayBase instance.

The JSApplicationState class is also no longer a Singleton which means you can have as many different state objects as you want.

The other big change in JumpShip 4.0 is that now the JSDataRecord class recognizes when another JSDataRecord instance has been added as an attribute and will automatically listen for data binding events, rebroadcasting them upward if one is received. This allows multi-dimensional data structures that maintain data binding all the way down the tree. Although, JumpShip still encourages flat data structures, there may be occasions when you need data binding for multi-dimensional data.

Finally, JumpShip 4.0 includes improved documentation and a few bug fixes for potential memory leaks.