Intruducing Aspect Oriented Programming

Aspect Oriented Programing(AOP) is a way of thinking about the program structure. AOP complements the Object oriented programming but instead of classes in object oriented programming you deal with aspects in AOP. So what's an aspect? There is a great example here on defining the aspect. Imagine that we have a base class named Dog and we inherit another class named Poodledog from this base class. Poodle is a kind of dog and that's why we can create an object for it. A dog is anyhow Poodle or not but what do you think about Obedientdog? Obedient is a feature or an aspect that not every dog has it, right? So we can look to obedient as an aspect. It is behavior that should have structure, but there is no any way to express this structure in code with traditional object-oriented.

AOP has been for a long time but recently it gets more attention. AOP is all about encapsulating the crosscutting concerns, So what's the  crosscutting concerns? you can imagine a cross cutting concerns something like amount or metric. because it doesn't represent a specific thing, and it doesn't have a business rule. AOP is just a programming paradigm for increasing the modularity. So what's the Modularity? Modularity is class in OOP and aspect in AOP. It provides to abstract the cross-cutting code into a separate aspects and support the modularization of concerns. AOP can be used with object-oriented programming and it complements object-oriented programming.

 


Tags: AOP


comments powered by Disqus