IBM Developer Works has an interview with Grady Booch. He has some mildy interesting things to say, and tries yet again to explain aspect oriented programming. Unfortunately, I still don’t exactly get it. Here’s his description:
Moreover, if I polish off my crystal ball I foresee the rise of aspect-oriented programming (see Resources). Today’s large software systems, systems of quality economic value, include tens of thousands of moving parts, so we tend to never turn them off.
This is easy enough to understand. Total agreement here.
Therefore, the challenge becomes how to morph such systems without turning them off and yet add value with many stakeholders as part of the solution. Stakeholders can range from graphic artists, to network types, to security people, to business experts.
So he’s saying that we need a way to make changes to systems that have to have as close to 100% uptime as possible. I’ll buy that. It would be great to have a way to improve existing systems without taking them down or more often, completely rewriting them using the latest and greatest tools.
In such cases, you can’t face the problem as a traditional programming problem. In fact, you’re no longer building a program — it’s morphing parts of a large system with those parts interconnected with each other.
So the problem aspect oriented programming attempts to address is modifying a part of an interconnected system without having to make changes to the other parts that are connected to the part that you’re changing?
In that context, with aspects you build those systems from threads that cross-cut through those pieces and let domain experts from those particular views express an aspect. In the next two years or so I think aspect-oriented programming will bear fruit in testing, deployment, and business rules.
Here’s where I get confused. Don’t we already build systems using “threads” that cross-cut through various parts of a system? I’m not sure what “thread” means in this context, but when I build a large application, I use a common logging system for all parts, a commond database driver for all parts, and many other common pieces of all parts. I generally refer to these pieces as libraries. How is an “aspect” different? How is abstraction achieved so that you can modify one of these so-called “threads” without changing everything that uses it? Let’s say changes are made to my logging system of choice — log4j. Either the changes are all internal and the outward facing interfaces remain the same, or the change is radical enough that the interface changes. If the API doesn’t change, I can probably just drop it in and reap the benefits. If the API changes, everything that calls that API has to be updated. How does a logging “aspect” differ? Is there something going on here on the tools side that enables the application that uses the aspect to be modified on the fly to take advantage of changes to the logging system’s API?
Cognitive dissonance
I often tell my wife that cognitive dissonance makes the world go round. When people encounter facts that are opposite their beliefs, they adjust their mental model to rationalize things, or simply ignore the new facts. There are plenty of Arabs and Muslims who believed that Saddam Hussein wasn’t such a bad guy, mainly because he opposed the Americans and because he was a staunch backer of the Palestinians in their struggle against Israel. Cognitive dissonance enabled (or, rather, forced) them to rationalize the fact that he horribly mistreated his own people, fellow Muslims, because he was probably the Arab leader who most strongly stood against things that they wanted to someone powerful to stand against.
Last night I had the horrible misfortune of watching 15 minutes or so of Fox News while waiting for takeout. They cited a poll in which 62% of Americans said that we can declare victory even if “weapons of mass destruction” are never found. Of course most people say that — the war is already all but won and who doesn’t want to declare victory at this point? Just as we can look at the typical Arab reaction and see cognitive dissonance is the prime mover, so too can we look at these poll results and see exactly the same thing. The poll also shows that 81% support taking military action against Iraq. Again, what’s the surprise there? We’ve already taken military action and we have, for all intents and purposes, already won. Again, cognitive dissonance at work. Is it too much to ask for polls that actually give us some illuminating information?
Anyway, once I learned what cognitive dissonance was, I became almost infinitely fascinated with it. In fact, my favorite moments come when I realize that it’s having an effect on me. When someone I admire does something really stupid, embarrassing, or malicious, and I start making excuses to myself on their behalf, I always get a little chuckle about good ol’ cognitive dissonance. Try it, you may enjoy it too.