Jump to content

Aspect (computer programming)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Diego Moya (talk | contribs) at 09:18, 14 January 2011 (Readable description first ("cross-cuts" is not really very explanatory)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science, an aspect of a program is a feature linked to many other parts of the program, but which is not related to the program's primary function. An aspect cross-cuts the program's core concerns, therefore violating its separation of concerns. For example, logging code can cross-cut many modules, yet the aspect of logging should be separate from the functional concerns of the module it cross-cuts. Isolating such aspects as logging and persistence from business logic is the aim of aspect-oriented software development (AOSD), of which the aspect-oriented programming (AOP) paradigm is the most widely employed.[1]

Aspect-orientation is not limited to programming since it is useful to identify, analyse, trace and modularise concerns (e.g., PREview) through requirements elicitation, specification and design. Aspects can be multi-dimensional by allowing both functional and non-functional behaviour to cross cut any other concerns, instead of just mapping non-functional concerns to functional requirements[citation needed].

One view of aspect-oriented software development is that every major feature of the program, core concern (business logic), or cross-cutting concern (additional features), is an aspect, and by weaving them together (a process also called composition), you finally produce a whole out of the separate aspects. This approach is known as pure aspect programming, but hybrid approaches are more commonly used, perhaps since there is less of a paradigm shift between object- and aspect-oriented programming. There is a similar situation with early aspect software development (e.g., requirements), with traditional methods being enhanced for aspect-orientation and new models proposed. Non-functional concerns (e.g., security) can crosscut functional concerns (e.g., door must be present). It is possible for functional concerns to crosscut non-functional or functional concerns (e.g., need for more features harms mobility). A uniform approach to representation and composition, similar to the pure approach in AOP, is termed multidimensional representation.

The prism analogy describes aspects with terms from the domain of light. Like splitting light into its many aspects (different colours) with a prism, you split a problem into its separate aspects. With another prism you can put the different colours back into a white ray of light, and by the process of weaving aspects you can put your solutions for the different aspects of a problem back into a solution for the whole problem.

See also

AspectJ

References

  1. ^ Awais Rashid (2004). Aspect-Oriented Database Systems. Springer. ISBN 3540009485.