Notes From Clean Code
BetterProgramming, a site on Medium.com, posted “30 Coding Concepts I Learned After Reading “Clean Code””, referencing Robert Martin’s Clean Code: A Handbook of Agile Software Craftsmanship.
There’s a lot of good advice here. You should read the article, but here’s the TOC:
- The Clean Approach To Coding
- You Will Probably Be the Next Person To Read the Code You Are Writing — Do Your Future Self a Favor
- There Are More Parameters To Code Than “Works” vs. “Doesn’t Work”
- Better Clear Than Clever
- Anticipation and Trust Are Crucial
- Clean Code Does Not Happen at Once, by Itself
- Timeless principles
- Separate Concerns
- Code Is Like an Article
- The Boy Scout Rule
- Clean, Reusable, and Maintainable
- Never Duplicate
- Avoid Logical Dependency
- Naming
- Choose Descriptive and Unambiguous Names
- Make Meaningful Distinctions
- Use Searchable Names
- No Magic Values
- Do Not Disclose Implementation
- Beware of Naming Conventions
- Avoid Mental Mapping
- Functions
- Should Be Small
- Does One Thing
- Should Be Named Properly
- Should Minimize Arguments
- Do Not Create Side Effects
- The Clean Way To Write Functions
- Classes
- Should Be Small
- The Single Responsibility Principle
- Cohesion
- General Concepts For Clean Code
- The Best Comment Is the Comment You Didn’t Write
- Understand the Algorithm
- Beware of Abstraction Levels
- Final Word: Be Consistent