Sunday, April 13th, 2008
Archive for the 'Design patterns & theory' Category
Sunday, March 30th, 2008
One thing that bugs me with event handling is that usually I’m not interested in every event that comes my way. This makes my event handlers more about filtering events than handling them — for example checking that shift is pressed when a
KeyboardEvent comes around, or checking that a
MouseEvent is above a specific area of a panel. To separate the concerns of filtering and handing I’ve come up with some AOP-like looking ActionScript. Read on for the full explanation.
Sunday, October 28th, 2007
The asynchronous API:s in Flash, Flex and AIR don’t all work the same in regards to garbage collection. I discovered this the other day when testing out file uploading in Flash. I made the mistake of not keeping a reference to the object that was going to dispatch events when the user had selected a file. It took me half an hour to figure out what was happening, and once I did I cursed myself for not seeing it straight away. However, after having thought about it I think that the the Flash, Flex and AIR API:s are inconsistent and a bit unintuitve on this point.
Friday, May 11th, 2007
Namespaces in ActionScript is a concept which I’m not aware of existing in any other language*. I’ve tried to find an example of why they are needed and how they can solve problems that cannot be solved without them, or at least less elegantly without them. Reading Colin Moock‘s Essential ActionScript 3.0 I came accross an example that showed just that. In two paragraphs Moock has convinced me of the beauty of namespaces.
Tuesday, May 8th, 2007
The most common argument against using singletons can be summarised in this quote:
When you mention singletons it’s common to get a dismissive reply, something in the lines of “singletons are only glorified global variables”.
This is not unlike how I have treated suggestions to use the singleton design pattern as a solution to a problem. However, there are good uses of the pattern too, and in this post I outline one of them.
Saturday, March 24th, 2007
In this article I’m going to show you how to use dependency injection in Flex and how to use that to support parallel development in Flex and Apollo. Along the way I’m also going to talk about the Data Access Object pattern.
Friday, March 16th, 2007
An object of type
Boolean cannot contain
null. You may find it obvious, but I find it weird and disturbing. Disturbing enough to include it in my series on architectural atrocities in ActionScript.
Friday, February 9th, 2007
I am a huge fan of the Spring framework for Java because it helps me to build applications that are very loosely coupled. When I look at MXML it seems to me that it could be used in a similar fashion to Spring’s application context. In this article I’m going to explore that possibility and talk a little about why loose coupling is good.
Saturday, December 30th, 2006
What does the classes Stage, Key, Mouse, Selection, ExternalInterface from the ActionScript 2.0 API:s have in common? They are bastadized singletons.
The really sad part is that of the five, three are still in the API:s in ActionScript 3.0 and of those Mouse and ExternalInterface are still bastardized singletons. Stage has been refactored completely and Key and Selection have been replaced or removed.
Monday, October 16th, 2006
XML is perhaps the worst programming language ever conceived.
As usual, Holub is right on the spot. He talks about the perversities XML is used for, in the name of “simplicity” or other lunacies. In this blog I have occationally noted the lack of understanding of what XML really is, and Allens article is on the same lines.
Read on for a link to the article and some more commentary.