The graceful programming of such a processing system, you are "normal"

Source: Internet
Author: User

Have a nice smile

"A king wants to marry a princess, put an apple on the princess's head, and whoever shoots it will have a chance of marrying the princess."
The first man shot an apple and he said, "I'm Robin." ”
The second man also shot the Apple, he said, "I m Hou Yi." ”
The third man accidentally shot the princess to death, he said: "I ' m Sorry ..."

Ask questions

How to develop the system to make the code more tidy???

solve the problem

1) The structure and use of the system are separate; it seems that when building a building, the building of the crane, forklift and other things, when the building is put into use, there is no longer the same; the software system should say that the startup process and the run-time logic after the start-up process are separated, and that there will be mutual dependencies.

2) system construction and use of separate solutions:

    • Decomposition main: Move all the construction process in the system to main or main module: The main function creates the object, then passes the object to the application, and the application is used directly; (Java application must start from the main () method)

    • Factory: Allows the application to control entity creation time

    • Dependency Injection
      For example, in spring MVC:

      @Rest(DeView.class)public class ViewController {//这些service都是通过依赖注入的,我们并不会自己去new出来//而是把new对象任务交给spring去做,而spring是在启动程序的时候就//初始化这些service的,既达到构造与使用分开@Autowiredprivate IViewService viewService;@Autowiredprivate IResourceOperationService resourceOperationService;@Autowiredprivate IEditUnitService editUnitService;@Autowired

      }

3) Expansion: We can not start from the system to do the right to achieve good current customer needs, and then re-construction, expansion to achieve new customer needs. Software systems and physical systems can be analogous. Their architecture can grow incrementally as long as we continue to focus on proper segmentation.

4) AOP, aspect-oriented programming. Three aspects and similar mechanisms in Java: proxies, pure AOP framework, AspectJ

    • Java proxy: After the proxy.newinstance (proxied interface, Invocationhandler h) method executes, all methods of the proxy class are added to the handler processing logic, which is simple AOP, but too complex ; (This is the dynamic proxy provided by the JDK)

    • Pure AOP Framework: Spring AOP (Further information needed)

    • AspectJ language (self-knowledge)

Summary: Here are some of the points discussed here, we hope that in the software development process, remember these aspects of implementation, so that the development of code cleaner.

Reading Comprehension

Living out the meaning of life

    • All of a sudden, for the first time in my life, I learned of a truth that was praised by the poet and regarded by thinkers as a consummate wisdom. This is: Love is the highest goal of human lifelong pursuit. I understand the true meaning of the great secret conveyed by poetry, thought and faith: to save humanity through love and love. I know that there is nothing in the world as long as there is a moment to miss a lover, then he can understand the true meaning of happiness. In the desolate environment, people can not speak freely, the only right thing is to endure the pain, in a respectable way to endure, in this situation, people in such situations may also recall the image of a loved one to be satisfied. For the first time in my life, I understand this phrase, "angels exist in the eternal yearning of incomparable beauty."

    • If life is meaningful, then suffering also has meaning. Misery, Doom and death are parts of life that cannot be stripped away. Without suffering and death, man's life is incomplete.

    • A person's quest for meaning leads to inner tension rather than balance. However, this tension is precisely the necessary prerequisite for mental health. I dare say that there is nothing in the world that can be more effective in helping people live than knowing their own lives (even in the harshest of circumstances). Nietzsche's words are very intelligent: "Know why the living people can survive." ”

    • Must face all suffering, not weak, tears are useless, but also do not have to deny tears, because the tears witnessed the people suffering from the great courage.

    • We can discover the meaning of life in three different ways: (1) by creating a job or undertaking a career, (2) by experiencing something or facing someone, and (3) adopting an attitude in the face of unavoidable suffering. The first is achievement or success, the meaning of which is obvious. The second way to find the meaning of life is by experiencing something-like goodness-by experiencing nature and culture or by experiencing the uniqueness of another person-that is, to love someone.
    • In a sense, once the meaning is found (such as the meaning of sacrifice), pain is no longer painful. This is one of the essentials of meaning therapy: The main concern is not to gain pleasure or to avoid suffering, but to see the meaning of life. This is why people are even prepared to suffer, in this sense, his pain has a meaning.
other

If there is a little bit of happiness for you, let happiness continue to pass, welcome reprint, Praise, top, welcome to leave valuable comments, thank you for your support!

The graceful programming of such a processing system, you are "normal"

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.