Defining Clean Code
2023-05-16
These are some of my key takeaways from the Clean Code videos.
What isn't Clean Code?
When defining what Clean Code is, it is easier to first define what Clean Code is not. Being able to identify the characteristics of unclean code and avoiding them will aid in producing Clean Code. Some key characteristics of unclean code are:
- Rigidity - the tendency to resist change
- Fragility - the unpredictability of a program when a simple change is made
- Inseparability - when modules in a system cannot be used independently elsewhere
- Opacity - the tendency of a system to be difficult to understand
What is Clean Code?
Clean code:
- Does 1 thing
- Reads like well-written prose
- Looks like it is written by someone who cares
- Is predictable