This is the catalog of clean code blog posts written by me.
It contains learning from below sources but the examples are created based on real experience.
- Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)
- Refactoring techniques learned from colleagues and Martin Fowler.
Catalog
- Clean code the beginning
- Naming matters
- Naming modules or classes
- Naming functions or methods
- Naming boolean variables
- Naming query variables
- Don’t add unnecessary context
- Don’t be anti-negative
- Introduce explaining variable
- Fail as early as possible
- Return as early as possible
- Replace magic number with named constants
- Encapsulate conditionals
- Be declarative wherever possible
- Don’t repeat yourself
- Extract method
- Avoid abbreviations while naming variables
- Avoid complex conditionals using the ternary operator
- Provide methods in pairs with their opposites
- Avoid deeply nested ternary operator
- Naming symmetric operations
- Don’t be too clever and keep it simple and understandable