Standards for Java Writing (1)

Insert image description here

Why write this article?

First of all, in my daily development, I always feel that I am using an object-oriented language and then process-oriented programming. The code is very irregular, although I am aware of this problem. But if you want to solve it, you still need to spend a lot of ideas to conceive of how to write an elegant program code like an elegant essay. It's really not a simple matter.

According to Alibaba's Java code specifications, the number of lines in a method body is generally 30-50 lines, with a maximum of 80 lines. A class generally does not exceed 800 lines. Of course, the above is also a summary based on my own coding career. Regarding the conclusion of this number of lines, I also thought of or saw a statement. The code logic distinguishes red flowers from green leaves. commonality and individual lines. Greenleaf logic is separated into additional methods to make the main code clearer; common logic is extracted into common methods to facilitate reuse and maintenance.

To be continued. . .

Guess you like

Origin blog.csdn.net/weixin_50503886/article/details/132550596