Some of the principles of design

Source: Internet
Author: User

1. If the class is immutable, it is set to final. The method entry reference is immutable and also set to final. Prevent subsequent code from being incorrectly changed.

2. Design, can be easily extended without repairing the core code.

For example, to design a remote call framework, you can extend the function through the interceptor chain.

There is a job timer business in the project, and the server is responsible for generating job timing tasks. The client will have the machine responsible for receiving execution. Servers and clients communicate over HTTP.

At this point in the design, there can be a unified interceptor entry, and then a call chain. The core function is the corresponding class to perform the job task request, and other functions such as parameter verification, security authentication, etc. can be implemented by adding an interceptor to the interceptor chain.

Some of the principles of design

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.