Java Architecture decrypts--spring framework AOP

Source: Internet
Author: User

All along, we have applied a lot of AOP framework, but for the implementation of AOP is not too much in-depth, the proverb is "know it, do not know why", with the sudden rise of the academic discussion of AOP, I also opened up their horizons, in-depth understanding of the colorful world of AOP!


Let's take a look at the definition of Volkswagen:

Baidu Encyclopedia:

In the software industry, AOP is the abbreviation for Aspect oriented programming, which means: face-cutting programming, through the pre-compilation method and runtime dynamic agent to implement the unified maintenance of the program functions of a technology. AOP is a continuation of OOP, a hotspot in software development, an important content in the spring framework, and a derivative model of functional programming. AOP enables the isolation of parts of the business logic, which reduces the coupling between parts of the business logic, improves the reusability of the program, and improves the efficiency of development.


Wikipedia:

The aspect-oriented programming (Aspect-oriented PROGRAMMING,AOP, which is also translated into aspects of program design, view-oriented programming, and section-oriented programming) is a term in computer science that refers to a programming paradigm. The paradigm is based on a language construct called the side (aspect, and translated), and the side is a new modular mechanism for describing crosscutting concerns (crosscutting concern) scattered across objects, classes, or functions.

The concept of the side stems from the improvement of object-oriented program design, but it is not limited to this, it can also be used to improve the traditional functions. Side-related programming concepts also include meta-object protocols, topics (subject), mixed (mixin), and delegates.


Looking at these Fanfan definitions, I'm dizzy too, but we can go from the simplest of questions to the simple question of "Why do we program?" ”

My answer to this question is, in order not to program! We create functions, create classes, create frameworks, create software, and create Ides for what? is to eliminate the repetitive labor of human beings step-by-step! is to liberate people, let people play the greatest characteristics of people, is to think and summarize!

Along this line of thinking, let's restore the original look of AOP:

1, Discard copy!

In the initial program design, we need to add log, transaction control for each class we write! Our program Ape honestly wrote n many log processing and transaction processing! When one day, a program ape suddenly said, I am tired of such a heavy work, I must be the code of the duplicate part of the public class to deal with!



2, dependency reversal

After a period of time, an ape is not satisfied, because I still want to call the public class for each class, he turned to look at the design pattern, found that the agent is a good solution, if you use dynamic proxy, it is more interesting



Two kinds of dynamic agents



3,AOP

After a while, the programmer combined the dynamic Agent with the IOC and wrote a framework called the AOP Framework, which is provided free of charge to all who need the business, and Java has another concept, namely, AOP


Concept:



Summary:

At the beginning of computer, is to do some repetitive simple work for people, with the depth of computer technology, our original intention, has not changed, the greatest advantage of the computer is repetition, as a program designer, in all staff's work, we should consider, this work is necessary? Is this job a pure copy? Can this job be given to a computer? Is this job done by one person and can everyone use it? These jobs need not only the experience of the designer's mind, but also the abstraction of the business and the control of the overall architecture!

As a 21st century programmer, are you still getting employees to make unnecessary copy?


Java Architecture decrypts--spring framework AOP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.