Feelings of JAVA code refactoring (continuously supplemented and updated)

I only write code in my spare time, and only write bugs when I work and work overtime.

       Recently, I have read three books, "Design Patterns", "Refactoring", and "Refactoring and Design Patterns". Based on the principle of thinking more than moves, in order to reach the highest level in martial arts as soon as possible. Find the time to work overtime on Saturday to record the mood at this time:

Purpose: There is no silver bullet in java programming, please embrace changes, keep thinking and refactoring, and you can have a better code design!

1) When dealing with complex business logic, try to put the logic involved in the method in one method and present it according to the business process.

2) A method can only do one thing, if a method will have more impact than expected, please redefine what this method is to handle.

3) Minimize the input parameters of the method.

4) When the performance of the method is not clearly reflected, do not optimize prematurely.

5) The code is for people to read, and the method names should be reasonable. (I personally think it is the hardest)

6) Design patterns are treasures left by predecessors

7) Refactoring is an ongoing process, don't expect to write perfect code once

8) Code that is easy to read, understand, and modify is good code

Can't remember, to be continued. . .

The above is my own experience, if there is anything wrong or lacking, please leave a message to correct me. . . . . . . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325902540&siteId=291194637