Tuesday, April 7, 2009

Aspect-Oriented Programming (AOP)

Aspect-oriented programming (AOP) is one of the “advanced software engineering topics” which goes beyond object-oriented programming (OOP) by offering a powerful way to modularize cross-cutting concerns with regard to object hierarchies.

In object-oriented programming (OOP), one usually captures the main concerns of a problem (e.g. for a banking application, money withdrawal at an ATM, funds transfer,...) and then encapsulates them into classes. The problem is that some requirements/ concerns, non-business operations are needed (i.e. logging, authentication, caching, transactions...). These operations are shared by several classes of a system, and each of them has to code their firing.

The main idea behind AOP is to consider these operations as crosscutting concerns and to group them into separate modules, than fusing them throughout the entire system, which are automatically called by the system. This new approach helps building clean software architectures and are geared towards the higher modularity of the code as well as, completes the toolbox of software engineers, already containing design patterns, frameworks, refactoring, unit testing,... AOP is particularly well suited for implementing middleware frameworks which are typically responsible for these crosscutting concerns. Indeed, the additional functionalities can be transparently injected (or weaved) at compile, load or run time into the core business code which (at the source level) remains clean and unchanged.

This, relatively, new paradigm is useful for who are familiar with the design and implementation problems of classical OOP and want to learn how AOP can help them implement solutions. More specifically, AOP can be applied in many areas in the context of software engineering such security, measurement, testing, maintenance, and so forth.

Besides, they are some extension to the current programming languages which support the AOP concept such as AspectJ (extension to Java), AspectC ( extension to C) and some others. Among them AspectJ is most commonly used AO language in community, where it has got good support in terms of Eclipse IDE as well.

No comments:

Post a Comment