Monthly Archive for April, 2010

ActionScript 3.0 Developers Caught in the Middle

The Pincers

The Pincers

Why Me?

When two companies that are intertwined with my fate get into a spat, I get itchy. Because we are all linked to ActionScript 3.0 in one way or another, and Adobe is linked to ActionScript 3.0 through Flex and Flash this sad state of affairs may have consequences for us all. However, those of us who do our primary development using Apple computers (Macs), our fates are doubly impacted.

Until now, I’ve always considered ActionScript 3.0 to be a friend of the world. A large proportion of Apple’s success can be traced to the applications produced by Adobe, and yet this current parting of the ways seems to be more than a hiccup in a long symbiotic relationship between these two high technology giants.

Many of this group were primed to begin writing applications for the iPhone and iPad (and some may have), but now that seems out of the question. In a strongly worded broadside against Adobe, Steven Jobs, Apple’s Boss. Now, look what we’ve got…

With Ate by his side come hot from hell,
Shall in these confines with a monarch’s voice
Cry ‘Havoc,’ and let slip the dogs of war;
That this foul deed shall smell above the earth
With carrion men, groaning for burial.

So Adobe responded to Jobs rant.

Anyway, here are my comments, and we’d like to hear from you as well:

1. He rightfully acknowledges that Apple was one of Adobe’s initial customers. However, Apple needed Adobe’s fonts as well as the PostScript language that made their initial laser printer more than really good dot-matrix printer.

2. Also, while Jobs is probably correct in noting that about half of Adobe’s products are purchased by Apple owners; most of the Apple upgrades we purchase are because of the improvements Adobe makes in its CS5 suite. I’d still have my old iMac GooseNeck were it not for the fact that Adobe’s new products required new Apple hardware.

3. In looking at the apps in my Dock, the ones I use the most are by Adobe. Were it not for iTunes, I would not use Apple software (aside from the OS) all that often. The second most-used is Microsoft Office. It’s down the line when I find Apple software not related to iTunes that I find using a good deal. QT is sometimes used, but rarely anymore because Adobe Media Player is more responsive.

4. Several software developers have argued that, “It’s just not worth it to create Macintosh versions.” Adobe was always there for Apple when a lot of other software developers threw in with PCs only.

Being a fan of both camps, I truly hope that Apple and Adobe find a common ground. Even the Mafia knows it’s more profitable to cooperate than bicker.

What do you all think?

Design Patterns with Missing Pieces

Why are Participants Missing? Note: Gentle reader, This article was written for our new PHP Design Pattern blog, but the points apply as well to ActionScript 3.0. As a result, I decided to include it here. The links in this post have been changed to go to the relevant ActionScript 3.0 posts, but otherwise, the article is the same. After writing design patterns in PHP for a while, I’ve come to appreciate the strongly typed structure of ActionScript 3.0. Programming to the interface in PHP is tricky, but possible. However, when you have strong typing as ActionScript 3.0 does, you really appreciate it more once you’ve worked with a dynamic language without strong data typing.

The Case of the Missing Participants

Recently I was working on a Decorator pattern and struggling through PHP’s way of doing things. So naturally I thought why not take a look at how others have solved these same problems. The Gang of Four refer to the different classes and interfaces that make up a design pattern, as participants, and when I look at a design pattern, the first thing I do is to see how the developer handles the different participants. What I found was surprising—they left out chunks of a design pattern in their examples. Alternatively, they just did some kind of workaround that effectively made it work (run), but it was no longer a design pattern or had the advantages of a design pattern.

The Strategy with the Missing Context

The Strategy pattern decouples the algorithms from the Client by using a Context class. All of the requests for the algorithms (found in concrete Strategy classes) go through the Context to the Strategy interface and on the the implemented strategies in the form of concrete classes. However, in many of the PHP examples, they leave out the Context class and Strategy interface and go directly from an Object to concrete Strategies. In several examples, the code authors chose to ignore the interfaces and even the abstract classes and have fairly direct connections between concrete strategies and some kind of object. Figure 1 shows the kinds of UMLs that accompany these kinds of PHP design pattern implementations—if indeed they are implementations.

Figure 1: Minimalist UML

You can see clearly that the UML in Figure 1 has little in common with the class diagram we used that was an exact replica of the Strategy pattern that the Gang of Four uses.

The authors of this kind of “explanation” of the Strategy pattern seem to think that the separation of the algorithms from the object is a matter of nothing more than taking the algorithms out of some object and using them independently of the main object. However, while that is an improvement on cramming everything into a single object (class), it is not a design pattern. Yes, it does add flexibility because more than one class can use the same concrete strategies. So, it’s a step away from single-class programming and even procedural programming. However, it is not a design pattern and it does not have the design pattern’s flexibility. The Context class uncouples the request from the strategy and without it, that concrete strategies are tightly linked to the “object”—whatever that may be.
Continue reading ‘Design Patterns with Missing Pieces’