Main Page | See live article | Alphabetical index

Aspect-oriented programming

In computer science, aspect-oriented programming is a programming paradigm that centers around constructs called aspects, which describe concerns of a separate set of objects, classes or functions.

Aspect-oriented programming is not limited to object-oriented programming, though. An aspect describes points (join points) in a program, where the aspect will affect the program's semantics. A set of join points is called a (pointcut). Now methodss or functions may be called in the aspect (called advices then), that may implement behaviour that would normally crosscut behaviour of the core concern of the application. For example, in a credit card application billing would be a core concern, and logging and persistence of participating objects would be concerns, that most likely crosscut the whole object hierarchy. Separating these concerns from the core concerns is the main concept behind aspect-oriented progamming. It removes code not related to solving the domain problem from the business logic into its own aspect of the program. The code no longer contains calls to those concerns, they are maintained and isolated in aspects, easing and isolating changes that would otherwise spread throughout the whole application.

The steps to successful aspect-oriented programming are described below...

1. Define and separate the core concerns of the problem. 2. Build small, independent modules to solve them. 3. Combine the modules. (called weaving in AOP)

The result is a solution weaved from smaller solutions.

The most widely-known aspect language is AspectJ, which is based on Java, and was created at Xerox PARC.

Aspects emerged out of object-oriented programming and are similar in function to using meta-object protocol. Aspects are closely related to programming concepts like subjects, mixins, and delegation.

The term aspect-oriented programming was coined by Chris Maeda (of Xerox PARC), though the exact date when is not known. The term crosscutting was coined by Gregor Kiczales.

External links