PostSharp. Overview.

Before turning directly to the theme of the story, it is necessary to say a few words about the system things.

Aspect-Oriented Programming

Aspect-oriented programming (AOP) - programming paradigm, based on the idea of separation of functionality to improve the partitioning the program into modules.

There are many classes of problems whose solution is impossible in the context of the OOP, or lead to a large rubbish code and connectivity modules that bad. For example, logging. In order to keep a log of the program, it is necessary in each service method of placing multiple lines of service call logging, as it may have to pass through the input parameters of methods. All this code would not apply to the implementation of real-world task entrusted to the method, but only an eyesore. Besides, how many extra lines of code have to write by hand!

Another example is the authentication and verification of access rights. In good, before the execution of important methods, one must each time test whether the current user rights to run the specified method. Here, too, can be a lot of hassle and code

In general, any cross-cutting code drops out of the opportunities the PLO. AOP programming, by contrast, provides all the tools to highlight “through the code in separate entities, which significantly simplifies the code for testing and for use.

Continue reading