Is AOP important?

zhaozj2021-02-16  52

AOP (Aspect-Oriented Programming) This area is also very new, but I am optimally expected to adopt a AOP method in many major projects in the future. In my opinion, AOP is a very important direction, which may be "next big guy" on the development of software development methods. Of course, AOP is not a kind of replacement technology, just like now there is no replacement of the radio, the computer has not replaced TV. However, after the AOP method, many modes are now no longer needed (of course a new model will have a new model), and the software development process will also be changed.

In my opinion, software development is largely mapped by demand to implement. Users who don't care about this system, and he will only care about whether the system can meet his needs. However, the knowledge structure of the system builders is based on various technologies. Some people are good at information security technology. Some people have deep knowledge about load balancing and fault tolerance technology, and some people are database experts. How to effectively map demand to the core topic of various software development methods. AOP's Mitsphi Metaphor shows how the AOP plays in this map, and I am not specifically said here.

The separation of concerns (Concern) allows different people to focus on different things (and what he / she is good at). Security experts have a good ASPECT with his team to prepare a systematic security. The system integration experts can be responsible for the integration of the heritage system, and business experts can focus on Business Domain. So what about the architecture? He (she) can be responsible for overall architectures, coordinating how to bring these independent Aspects woven (weave) into an easy application. (Can be woven in the source layer or weaving in the BYTE Code layer.)

I like AOP philosophy, but any technology can only stay in the concept, and its early implementation is very important, and even related to technology survival. There are a lot of good technologies because there is no good implementation at the beginning, I have to embed the waste paper. Not only IT technology, the natural science theory is also the same, and excellent theory often requires experimental scientists to verify. (For example, the two famous Chinese Nobel Prize winners are standing behind a good Chinese experimental scientist, which is a well-known common talk.) At present, the most famous Xerox Parc in AOP language. Developed aspectj (now handed over Eclipse). I feel that AspectJ and Java have some relationships similar to C. Classes (later developed into C ) and C; the current AspectJ can also be classified than the CFront of the year. Of course, I said that it is just a feeling :)

Some people have compared the AOP and Interception class. Perhaps use the interception mode to simulate AOP, but this cannot indicate "there is no need to make a new paradigm". Excuse me, can c ? Can I simulate CLASS with STRUCT and function? I guess that many masters can do it. So why do I have C and OOP?

The Power of the weaving rules of AOP is not interception can be easily implemented. The language used to specify the woven rules and the language of the aspect can be completely different, but the generally taken the scheme is to extend the latter written by the Aspect as a Weaver Rule Specification Language. Aspectj is doing this. There are also aspectc, aspectc now. This approach reminds me of OOP IMPLEMENTATION in C . C extends to the C language, adds Class, Private, Public, Friend, Virtual these new content to describe the rules for the establishment of classes and inter-related relationships, if there is no new keywords, this rule is not so good . The original part of the C language has not been discarded. You see, if you don't define new local classes in the member function, isn't it the same as the C language to write each member function? The same is true for Aspectj. You use Java to write Aspects, use the extended Java language (or see it as a new language) Write Weaving Rules. This is in line with the principle of making the most suitable thing in the most suitable language. Back to the comparison of AOP and Interception. The implementation of Interception is often dynamic. If the granularity of the rules is relatively thick, the specified interception is relatively fine (for example, a knife is cut to the entrance and export Intercept of all functions, then the efficiency loss cannot be ignored. I will give a simplified example, and the first line of each function and the last line are added "to determine if an intercept function pointer is null, if not null calls it" code, then how many times have to be judged, where is it? Is it reactive? AOP WEAVER can static woven code (source code or byte code), do not need to pay this additional price, and the size of IntercePt can be more refined.

In addition, I feel that INTERCEPTION mode is used, and the focus is not very good. Unlike AOP, you can use different people to do two languages ​​in both languages, and pay attention to the point of interest.

In addition, about AOP and design patterns, I have some ideas: from different programming languages, different code modes can be extracted (idioms, and translated as a customary method), but the code mode is related to a particular language, there may be some modes General, but some modes are no longer needed in other languages. For example, the Reference Counting mode is no longer necessary in supporting the GC language. This is not said that the code mode is not good, not to say, GC will no longer be necessary, but it is a matter of it. It is not necessary to think that new technologies is not necessary because of familiar models and use. The code mode is like this, then the design mode is not, some mode is more common, but there are also some design patterns related to the model, which is related to OO, without an ultra-off frame. (Do not believe? You use C language or other non-oo language to implement 23 modes in GOF, see if it is difficult, is it natural? Posa V1, V2 mode can be supplemented.) If you switch to AOP, then Many modes can naturally die, such as the Interception mode should be.

The above is just casually saying some of the personal immature views of the AOP, and the brick is pushed. Welcome everyone to discuss.

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

New Post(0)