Friday, May 7, 2010

Loading with Commands

View tutorial

This is a sequel to my previous tutorial, Thinking in Commands part 1 and part 2.

This time I talked about how to encapsulate external data loading functionalities into commands, so that they can be arranged together with other commands. Also, I've introduced the DataManager class, which essentially acts like a global variable aggregator. However, as Rich pointed out in the comment. This class is not type-safe, thus requiring type casting through the entire application. Actually, I also think this could be a problem for large applications. When I was writing the class, I was thinking of the Proxy class from PureMVC. The class also acts like a global variable aggregator that is not type-safe, since this is how you obtain a reference to a custom proxy object.

Not type-safe as it is, it actually served me quite well in most applications. But yet I agree with Rich that it's not friendly in large applications. Unfortunately, this is the best solution I can come up with right now. I'll see if I can conceive something better in handling data.

No comments: