Aspect-oriented programming
In computing, aspect-oriented programming(AOP) is a programming paradigm that centers around constructs called aspects, which describe concerns of a separate set of objects, classes or functions. Although aspect-oriented programming is commonly associated with object-oriented programming, it is not limited as such.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 functionss 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...
- 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 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.