AOP C # in action

zhaozj2021-02-12  135

After reading a book, the topic is "Ascpectj in action", just in this hand, there is a little empty, so there is a little air level and decide to write something.

AOP is an abstract of Aspect-Oriented Programming. Once the Chinese translation of this aspect, there is a similar AOP, which is Attribute-Oriented Programming, so some people are translated aspects of programming, the latter is facing characteristic programming. Programming can be said to be in the past, always feel a bit blamed for programming translation, a Chinese understanding: What is the aspect? Or press Taiwan's habits "orientation"? Ha, I don't know what the cloud. A casual idea, aspect is made of form, this form is not the form of our usual ideology, that is the form of thought, invisible, this form refers to some form of the object (it's Behavior, characteristics, etc.). So, I personally think AOP translation is more appropriate to facilitate morphological programming.

The research of AOP has gradually become popular. There are also more detailed descriptions in the 9CBS article, and some pairs of controversies. "AspectJ in Action" Description I think the most classic is: the book is the ASPECTJ developer's hand, and aspectj is currently one of the most mature AOP tools.

Interception of method calls, some people use it as an explanation of AOP, like most people, I don't think so. The main role of AOP is to solve the horizontal relationship between the objects, a complex intricate relationship. Traditional OOP can't solve this problem very well or easy to solve this problem. This is one of the reasons why AOP has an opportunity to carry forward So how do AOP solve this problem? Weave, weave the relevant behaviors between the objects together in accordance with specific rules. The interception mentioned earlier is only means to complete the knitting. Interception is not the purpose, weaving is. Conversely, weaving is not just interception, but it includes a variety of knowledge and technologies. This knitting process can either still or dynamic, just like the precedent binding and later binding in OOP.

The title of this article refers to C # (Sorry, C # is one of my favorite languages), because AOP's research in C # is more than a few years behind the research in Java. It can achieve almost no application level (at least Java has an aspectj, the current version is 1.2). Perhaps it is my lonely, and the more well-known thing I can find on the Internet is only loom and aspect #, saying that they are also the result of the laboratory. So is it that AOP is difficult to achieve in C #? Answer: Yes, nor. The language characteristics of Java and C # are so similar (they have a common ancestor C ). There is no reason to say that Java can be realized, while C # can't. So where is the problem? This is the study of C # AOP. Most people insist on modifying existing C # language norms, only to expand the C # language. At the same time, assembly (assembly) must be able to be called and executed by CLR. Also consider the performance of the program. If the MS does not have a support for AOP in C # or even .NET (as currently the extension of the extension now), then the difficulty must exist.

转载请注明原文地址:https://www.9cbs.com/read-7544.html

New Post(0)