Zhongcheng online-reconstruction-Excellent programmer cultivation (Note 1 Understanding Reconstruction)

Source: Internet
Author: User

If you want to talk about any of the following statements, study refactoring.

(1) refactoring binds my design!

(2) refactoring? I am not responsible for changing other people's code!

(3) rebuild... You have to retest it...

(4) refactoring? Isn't it my money?

 

1.1 When It Comes To refactoring, there will be an idea: What is the relationship between design and refactoring?

 

Reconstruction has a special mission: It complements design.

Without refactoring, you must ensure that the pre-made design is correct. This is too much pressure.

If you choose to refactor, the focus of the problem changes. You do not have to find the correct solution. At this moment, you only need to get a reasonable solution.

            ---- Refactoring-Martin P66

 

1.2 if you have not learned how to refactor a system, you may have the following two questions: how to change the code? Re-test?

 

Let's first learn about refactoring, because these are all worries about refactoring Ignorance (I will explain the 22 bad tastes of the code later, and use the auxiliary tools to discover and modify them, and the reconstruction process to be followed ),Therefore, you need to rebuild your learning experience first.

 

1.3 potential rules of the software industry

 

Demand is constantly changing

The design is constantly deteriorating.

 

1.4 Definition of refactoring

 

Restructuring: an adjustment to the internal structure of the software aims to improve comprehensibility and reduce the modification cost without changing the "software-aware behavior.

How about it? It also explains 1.2 from the definition. refactoring does not change the software's observed behavior, so it does not need to be tested again.

 

2. Those who do not understand the technology often have a head shot and come up with two additions:

 

Add person:

They have one person and Ten bricks in 10 days, so 10 people will be able to move out in one day, and 1 person will be launched. This requirement will be 10 days, so 10 people will be involved, this requirement can be fulfilled in one day.

So can a pregnant woman have a child in 10 months and 10 pregnant women have a child in 1 month?

 

Overtime:

In the same way, one person needs to work for 10 days. In this case, 8 more hours of work at night will not work for 5 days.

We are humans, not machines.

 

3. LeBron's Law

 

If this sounds like this in the team: Let's write it like this first and try again later !!! Please use this rule immediately

 

Later equals never)

 

4. Window breaking effect

 

Unrepaired broken windows, resulting in more windows being broken

 

5. Code Quality Evaluation Criteria

 

Values:

Cost (total) = Cost (develop) + cost (maintain)

Cost (maintain) = Cost (understand) + cost (Change) + cost (TEST) + cost (deplay)

So cost (maintain)> Cost (develop)

 

6. What is good code?

 

<Agile design principles-robect C Martin>

First responsibility: this is the reason for the existence of the module.

Second responsibility: to communicate with those who read the module, those who are not familiar with the module should be able to understand it easily.

Third responsibility: to cope with changes, developers should ensure that the software should be as simple as possible.

 

7. Several thought Transformations

 

The completion of the negative function is code complete.

Code complete is certainly easy to understand and can be maintained.

 

A good programmer is a good developer who is proficient in the design mode and algorithm.

We must pay attention to the source code, which is a good programmer.

 

8. Several principles

The principle of opening/closing.

Ii. 8 principles.

 

9. Bad taste of code

Function too long

The parameter is too long.

Null check

Over many if... else...

Switch... case

 

10. Others

How bad UML is.

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.