programming.protips.wiki
A collection of programming protips
How to use this website
This website aims to save code reviewers from typing out the same explanations for common issues/patterns.
Instead, you may provide a link to a protip, which contains a "bad" example, a "good" example, and an explanation why the pattern is encouraged/discouraged.
Contributing
If you'd like to add or edit protips, please visit our GitHub repo: magicmark/programming-protips-wiki
Protips
- assert-type-conditions Use assertions for possibly null values
- avoid-network-in-unit-tests Avoid making network requests in unit tests
- chain-errors Chain custom errors to preserve stack traces
- custom-errors Use custom errors for error handling and control flow
- dont-outsmart-linter Don't try and outsmart the linter
- dont-outsmart-typechecker Don't try and outsmart the typechecker
- dont-pass-huge-objects Don't pass huge monolithic objects to helper functions
- file-reading-race-condition Don't check if a file exists before reading it
- give-reason-for-suppression Give a reason when using suppression statements
- limit-logic-in-try-block Limit the amount of logic in a try/catch block
- limit-what-you-catch Limit what errors you catch in a try/catch block
- provide-typechecker-errors Copy and paste error messages from the typechecker when using suppression statements
- put-units-in-names Put units in names
- return-early Return early from a function when checking initial conditions
- use-permalinks Link to code and docs with permalinks where possible