Sunday, February 13, 2005

Aspects

One of the big buzzwords in programming today is 'aspects'. More and more systems claim to be aspect oriented. Just what does this mean?

An aspect is like a perspective. If you look at the back of your hand, you will see those things that are about its backside. That is an aspect. If we do the same with software, this gives us a useful tool. If we take a video game for example, we might have several aspects:

- Display
- Sound
- User input
- Game rules and behavior

What is the point of all this? If we work hard to write libraries of code about these parts of the game, where these different parts of the program don't refer to each other, this gives us a useful level of interdependence, or decoupling as it's calling in software engineering. This is what aspects are for.

If we make each aspect of our programs independent from each other, this makes them easier to understand, to re-use in other programs, and to debug.

Most aspect oriented software use objects as a way to make their aspects work, but this isn't required. You can use the tools at your disposal to do the same thing. The main tool is your brain.

Some tips:

- Don't use global variables without good reason
- Give preference to SUBs and FUNCTIONs over GOSUB/RETURN
- Name things well so it's easy to answer the question "Does that belong in this area of my program?"

Finally, don't get hung up on the word 'aspect'. It's a useful word for thinking about software design, but it's just one word. ;-)

1 comment:

Rogue said...

i was looking around and realized that alot of languages can be used with such techniques. much like martial arts, yes you have the basic core fundementals of a style or in the case language. Then suppliment your skills with techniques like OOP, AOP, and command line. btw, here is a link for the deffinition of AOP (aspect-oriented programming)
http://en.wikipedia.org/wiki/Aspect_oriented_programming