📎 Webclip
How to Write a Good Piece of Code
The article says good code begins with deciding whether code should be written at all. It recommends validating assumptions, checking scope and impact, asking whether someone already wrote the code, and discussing choices with others before implementation.
Reading notes#
- Validate assumptions, scope, impact on existing code, and whether the code already exists before starting.
- Get input from others so choices can be challenged.
- Break work into the smallest possible pieces and think in terms of APIs, needs, and constraints before implementation.
- Write tests for each discrete unit before writing the code, following TDD.
- Keep naming, formatting, and logic consistent across the codebase.
- Review code before it goes into master, because another set of eyes can catch mistakes.
- Ship the work and communicate with the team about what was accomplished.
- Treat the rules as practical guidelines, not rigid commands, and avoid overengineering.
