Aspect Oriented Programming (AOP) is very powerful approach to avoid boilerplate code and archive better modularity. The main idea is to add behavior (advice) to the existing code without making any changes in the code itself. AOP provides a way of weaving an aspect into the code. An aspect is supposed to be generic so it can be applied to any object and object should not have to know anything about advice. AOP allows to separate cross-cutting concerns and makes easier to follow Single Responsibility Principle (one of the SOLID principles). Logging, security, transactions and exceptions handling are the most common examples of using AOP. If you are not familiar with this programming technic you can read this or this. It could be very useful because this article mostly about how to use AOP in C# rather than what AOP is. Don’t be scared if you still do not understand what is all about. After looking at several examples, it becomes much easier to understand.
TechNo hay comentarios