★★★★✰

The profile

Emphasize the importance of writing clean code.

The importance of detail

The smallest part of a grand building — a door that doesn’t close properly, a slightly unpaved floor, even a messy table top — ruins the charm of the whole.

Some of the mot

God is in the details

A stitch in time saves nine

Never put off till tomorrow what can be done today

A tree grows from its seed

Better to prevent disease than cure it

An apple a day keeps the doctor away

To quote the Danish proverb: Small honesty is no small thing, reminding us that we need to be honest with ourselves and asking ourselves if we did our best to “make the campsite cleaner than when we came.”

What kind of person is suitable to read this book

  1. You’re a programmer

  2. You want to be a better programmer

  3. The book is divided into three parts:

    1. Principles, patterns, practices for writing clean code
    2. case
    3. The enlightenment and inspiration obtained in the above case

    If you skip the case study section and just read Parts 1 and 3, you’ve just read a “feel good” book about writing good software.

Some ideas for clean code

  1. The only valid measure of code quality: WTF/min

  2. Knowing and doing: You know everything about a bicycle, but you still fall on your first ride.

  3. Does the code disappear? Machines can’t completely replace humans. Code is forever.

  4. Bad code can destroy a company. Why bad code, in a hurry? Clean it up later? Lebron’s Law: Later equals never!

  5. Should we blame the problem on products, users, operations, etc., we should have a professional attitude. For example, if a patient teaches a doctor how to do something, the doctor should absolutely refuse and should make his own professional judgment.

  6. Just because you can tell clean code doesn’t mean you can write clean code, there are a lot of tips to follow. Writing clean code is like an artist who can turn a whiteboard into a system of elegant code with a series of transformations.

  7. There are as many definitions of clean code as there are programmers.

The big boys’ standards for clean code

Inventor of C++ – Bjarne Stroustrup

1. Pleasing grace and refinement in appearance or bearing; Delightfully refined and simple.

efficient

Clean code does only one thing

Grady Booch, author of Object-oriented Analysis and Design

Simple and direct

Clean abstractions and straightforward control statements that do not hide designer intentions

Beautiful prose

The godfather of Eclipse Strategy – Dave Thomas

Can be read and supplemented by developers other than the author

Meaningful naming

Provide a way to do one thing without relying on it

The Art of Fixing Code by Michael Feathers

There is little room for modification, and attempts to improve it always come back to square one

Extreme Programming implementation – Ron Jeffries

Don’t repeat code, just do one thing

Inventor of Wiki – Ward Cunningham

To my liking, languages are rigid, and programmers make them easy

By Uncle Bob

Code read to write ratio: 10:1

conclusion

“Leave the camp cleaner than it came.”

“Art books do not guarantee that you will become an artist after reading them.”

“You gotta practice, kid, you gotta practice!”


This article is based on Code Cleanliness by Robert C. Martin, translated by Han Lei.


Zhejiang Dahua Technology Co., Ltd.- Soft research – Smart City Product R&D Department Recruiting senior front end, welcome to contact, interested can send resume to [email protected], long-term effective

Previous post: Introduction to Clean Code

Next: “Two, meaningful naming”