A summary of The Art of Readable Code by Dustin Boswell and Trevor Foucher
- Overall metric for readability: code should be written to minimise the time it would take someone else to fully understand it (able to modify the code and spot bugs) Ways to improve readability (ranked from easiest change to most time intensive)
- Naming of variables and functions:
- Use specific, descriptive, succinct names that say the entity's value or purpose
- Use concrete names instead of abstract names e.g. canListenOnPort > serverCanStart
- Add important attributes e.g. units or state e.g. unsafeUrl, safeUrl > url
- Can use shorter variable names for smaller scope