Aspect Driven Development (is also known as Aspect Orientated Development) is a programming paradigm in which secondary or supporting functions are isolated from the main program’s business logic; this provides the following gains: –
- Increase modularity (allowing the separation of cross-cutting concerns that are defined as cohesive areas of functionality that cut across multiple abstractions in a program; thus separating away from the business logic.)
- Cleaner code
- Increase efficiency
- Easier Maintenance.
The above is achieved by encapsulating each concern into one place; therefore reducing duplication, increasing efficiency and easing maintenance.
What makes an aspect different from an attribute?
An aspect is a composition of an advice and pointcut. In Aspect Driven Development an advice is seen as the additional code that you want to apply to your model, and pointcut as the point of execution in the application where the cross-cutting concern needs to be applied. In C# .NET 3.5, the pointcut is an attribute and are placed before methods that require this functionality; however an attribute is not an aspect! Aspects are custom attributes that are decorated with handlers (advices) such as OnEntry, and OnExit. Aspect Driven Development functionality can be provided from PostSharp.Laos.
Where is Aspect Driven Development most useful?
Aspect Driven Development is often implemented for the following: –
- Tracing
- Exception Handling
- Data Binding
- Threading
- Transaction Management