clean code reading notes

chapter 1, the code clean

什么是整洁代码?
  • Only one thing to do
  • Provide a clear definition and clear, as little as possible of the API
  • There is no duplication of code
  • Contains as few entities (classes, methods, functions, ...)
  • If the object is too many features, the best segmentation of objects under
  • If too many features methods, reconstruction methods should be used to extract (extract method) next, can give a clearer explanation of the function itself, and a method how to achieve further illustrate several of these functions.
  • If you played the "Editor Playback", you will find most of the time is spent reading old code when writing new code, even more than the ratio of 10: 1
  • Army regulations Boy Scouts of America: Let campsite cleaner than when you come
  • In this book, you will find references to different design principles, including: single-mandate principle (Single Responsibility Principle, SRP), open closed principle (Open Closed Principle, OCP), Dependency Inversion Principle (Dependency Inversion Principle, DIP) Wait
  • Code sense ~ ~ ~

chapter 2, meaningful name

Published 32 original articles · won praise 0 · Views 648

Guess you like

Origin blog.csdn.net/nku_ztq/article/details/104370760