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

Design pattern “Specification”

Disclaimer

This article is mostly for beginners at programming, who know only some programming patterns or don’t know them at all.

About design patterns

Let’s take definition of design pattern from Wikipedia.

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved.

For instance we can imagine that we are accomplishing a task “by analogy”. Or, for example, solving the same equation, but with another concrete numbers.

Pattern “Specification”- is a pattern of supplement’s conduct. The result of the implementation will be a Boolean variable; giving you the input of the operator of conditional transfer you control the behavior of the program.

With the help of the following techniques you can:

  • Make your code more readable and concise
  • Avoid duplications of code
  • Easier to make changes to the implementation

As always, the work of the complex mechanism better shows a concrete example. Let’s start with simple things, gradually moving to the complex. I will try to avoid situations in which revealed only a simple example, but as it is applied in real life – unclear.

Continue reading

Featured Common Controls

I would like to share my little library, which make my life easier when I create an user interface. At all, there are the same standard components, but with smart tags. They adapt on general and private fields. After starting installer and successful end of its work, you can find a new toolbar in the studio.

The library determines to GAC, creates a new toolbar in Visual Studio, and adds to a dialog box «Add reference…». You can read how to do it on your own in the one of my previous articles.

You can load the installer or a source code for these components and make a light setup for personally you or add your components. Don’t be shy to give suggestions which other elements of the UX can make better, what often uses and can be useful.

Source code and Installer

Next I will describe in short components which a library includes.

Continue reading