Introduction
Aspect-Oriented Programming (AOP) allows developers to achieve greater modularity in their applications by allowing the separation of cross-cutting concerns. In other words, with AOP it is easy to separate out the logic for those repetitive and messy tasks such as logging, security, and error handling that span the entire application. In this article, I will discuss basic AOP concepts and their implementation using Spring.Net, a popular open source application framework. I will also walk you through several examples of AOP with Spring.Net.
Aspect-Oriented Programming
Aspect-Oriented Programming (AOP) is defined as a programming paradigm that promotes application modularity through the separation of cross-cutting concerns. To understand what this means, you need to start with understanding the problem it solves.
Object-Oriented Programming (OOP) has been a great innovation in the world of software development. Built on the idea that an application is simply a collection of interacting entities, OOP allows for very modular and easily conceptualized applications. However, OOP is not perfect. Sometimes, there are secondary pieces of logic that do not fit into the actions of any specific entity within an application and instead affect many unrelated parts of the application. These pieces of logic that defy the application model are known as cross-cutting concerns.
Logging is a typical example of a cross-cutting concern. When you need to add or change the basic logging within an application, you generally need to change the logic for multiple entities. This can be messy because it often includes a lot of scattered, repetitive code that requires more effort to develop, test, and maintain. AOP attempts to alleviate this problem by separating out the cross-cutting logic into its own module or modules and applying that logic transparently across the various entities of an application without needing to change the logic for each entity directly.
Read the Rest of this Article at Developer.com