Several suggestions on code refactoring

Source: Internet
Author: User

The project is finished, and the skeleton is basically clear.CodeRebuild and optimization, sort out several points, and welcome to supplement and correct them. Thank you very much!

1. Try not to use public. For classes or methods that must be made public, make sure they are at least one of the following:
A. Data objects, including databases and script templates
B. unified access portal for public modules
C. Protocol definitions for broad scopes such as enumeration, exceptions, and interfaces

2. Code comments should be slightly higher than average within a specific logic implementation class
3. Use the Message Processing Mechanism with caution and rethink the logic coupling. When the message processing mechanism must be used, ensure that the registered processor is released at the appropriate time, unless you have enough reason to make it an object with a long life cycle
4. Finally, regardless of the size of the refactoring, if you already have a unit test case, please use the unit test to check your results after completing the case. It will tell you some potential risks.

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.