Tetris - Aspects - and the Factory
Yesterday I was talking with someone about how the Factory is basically a cool aspect-modeling tool for software. During the discussion, I had an idea that "aspect modeling" is really like playing Tetris.
Here's what I mean...
When you play Tetris, you lay down a bunch of blocks into "sedimentary layers". You have to quickly spin each block as it falls, so it best fits into the context of what's already there, so you fill all the space efficiently. You know what I mean...

Playing this game is kind of like writing software. You add code to a program in layers - or passes. You write the code so that it fits into what's there. You continue, writing code, changing code, adding layer upon layer, until it's done.
Think of an aspect as being similar to a layer in this sandwich of code that grows over time. An aspect has the ability to cut across any, some, or all parts of a program. It can touch a few places, or a lot of places. The next aspect can be laid in on top of the previous one, and so forth. Aspects can be isolated and very self-contained in a program - like when you add a class or method, or they can be spread out, like when you add a set of calls to invoke a logging mechanism - all over the place.
Now let's relate this to the Factory. I mentioned in my previous blog entry that the Factory has a formal software construct called a "builder". A builder is a powerful implementation of an "aspect writer". A builder has the ability to apply an aspect automatically to your program. Builders are really "the" most important concept to grasp in the Factory.
Next, let's take a look at how the Factory's builder approach is more powerful than traditional aspect modeling tools. Remember how I said program writing is like Tetris, where you apply a whole bunch of layers in succession? Well, the Factory is the same - you add a whole bunch of builders to a model in succession. The Factory is essentially an Eclipse-based tool for composing collections of "aspect-writers" a.k.a. builders. And there's more... When you're done building a model out of builders, you can go back and turn on and off the different builders in the model, as well as change the parameters that drive them. We use the term regeneration to mean the "re-execution" of the builders in a model - from one end to the other. When you regenerate a model, it's like rebuilding your program one aspect at a time - all fuly automatically.

Comparing this again to Tetris... Imagine if you were playing Tetris and a certain shape block came along one time, but not the next time. This would completely change the whole game outcome - because the layers of blocks would be different from that point on.
With the Factory, you can alter the parameterization of a builder - which alters its "aspect-writing" behavior - as well as that of all its successors. This changes the whole regeneration process in a way that causes an intelligent ripple throughout all the aspects of your program.
Older style aspect modeling tools don't have this ablity to coordinate the re-execution of a whole set of aspect writers in an intelligent - hands off - manner. the Factory does, and that's actually what's at the core of its patented IP.
I definitely would encourage people to download and check out the Factory, looking at it from the point of view of being a super-powerful "aspect modeling" tool - unlike anything else that's ever been done in the AOP space. You'll find that not only can you use the 100 or so builders we provide out of the box, but you can build your own collections of builders that encapsulate your own aspect-writing patterns.
More to come on cool subjects of "aspect oriented programming" using the Factory. For example, building your own builders that programmatically invoke collections of other builders - i.e. using the Factory to create your own compound "aspect writers".
11:31:28 AM
|