Introduction to aspective programming ---- Basic Concept (1)
The concepts commonly used in object-oriented program are: inheritance, packaging, polymorphism. The conceptually used in aspect is: Adfficients / Interceptors, Introductions, Metadata, And Pointcuts.
AOP aspect programming ---- Basic Concept (3)
Aspective programming ideas is simple. From the course-oriented process, the programming to the object-oriented programming to the interface-oriented programming to the component, the history of the module programming. We can know that the evolution of programming methodology is a step-by-step "boundary" that expands programmed. So far, our programming world is "class, interface, or components". In this boundary, we believe that a class implements an interface, which cannot dynamically implement another interface, existing behavior It is basically fixed before compilation or is the method of internal definitions, or it is either inheritance and implementation of the interface inherited. However, in actual programming, we met "cross border", need multiple classes, interfaces, and component cooperation, such as multi-threaded concurrent access, program flow centralized control, serialization, and program status, and There are multiple "classes, interfaces, and component boundaries" to participate in the work that can be completed. In order to better handle multiple borders to complete the work of the same aspect, the facing programming appears. Here, we can refer to the integration of collaborative work together to work together to complete the same task. You can think that it is actually a bigger class. This class is mainly composed of the classes and interfaces in our OOP. Of course, these classes and interfaces are in this intimate, so that they can convert each other. In fact, this is not big, the appearance of the interface is not the behavior of dynamic changing classes? Aspective programming is just an extended extension, and this change is raised to this level. Write here, I feel quiet, but the world is still not quiet, because the actual use of this idea programming, it takes a long time, and more tool developers support.
In my future articles, I want to make a look at the concept: 1. Inter-Type Declarations Border Internal Type Declaration: Inter-Type declaration has many forms in AspectJ, using him to describe the relationship between classes, class itself member and Structural information. 2, join point connection point: The connection point is a point defined in the program process. 4, Crosscutting Concerns: Consider the boundary cross 5, PointCuts connection point set: The set of multiple connection points in the program runs. 5, Advice Notification Point Behavior: The connection point set is like a "structure" that includes multiple "structures", which does not have behavior, and its behavior is implemented by notification point behavior. The above nouns are mainly used in the introduction of aspectj.
Adfficients / Interceptors (Message Transport / Message Interception)
A "conveyed message" is a logic (code) that is triggered by a particular event. This "conveyed message" can be inserted between a caller and the caller queue. It can be said that the conveyor message is a key component part of facing aspect.
Introductions (Members recommended)
Introductions is a way to increase methods and properties to existing classes. User members recommend that you can "introduce" to another new interface. Everyone knows that the appearance of the interface is to separate the definition and implementation. Now use aspect-oriented programming, it can be dynamically changed the interface, too incredible. Using "Members recommended" in Java programming You can make a Java class to achieve multiple inheritance. That is to say, using "Members recommended" You can dynamically change the interface interface when running, implement different behaviors. Just like Sun Wukong can constantly changing his behavior, this Sun Wukong must have three millimah (recommended by "members"). Look at the example below: Apple Apple = New Apple ();
Loggingapi logging = (loggingapi) apple;
Apple.setloggingLevel (Verbose);
Use "Member Recommended": Apple can dynamically have log's features.
Metadata (metadata)
Metadata is used to describe some of the additional information of the class itself and the description of these classes, which can be bundled together, and the description information of these classes can be obtained static or re-run. See another article (using reflex mechanism to realize dynamic factory mode). A large amount of metadata is used in EJB.
Pointcuts
If you say: Interceptors, Introductions, And Metadata is the characteristic of facing aspects, and Pointcuts Are is "glue" connecting them together. PointCuts is running in the AOP framework, such as: telling the framework how to confirm the message communication, how the metadata is defined in the class, those classes, interfaces are recommended by "members", etc.
Behind We said: AOP framework in JBoss 4.0.
http://www.onjava.com/pub/a/onjava/2003/05/28/AOP_JBOSS.HTML