Design APIs and modules so incorrect usage is harder than correct usage — types, newtypes, sum types, RAII / scope guards, typestates, builders, lints; the caller shouldn't have to remember anything. Load when designing a call site others (or future-you) will use, when a reviewer keeps writing "reme
Design APIs and modules so incorrect usage is harder than correct usage — types, newtypes, sum types, RAII / scope guards, typestates, builders, lints; the caller shouldn't have to remember anything. Load when designing a call site others (or future-you) will use, when a reviewer keeps writing "remember to call close()" or "don't forget to initialise first", when a bug came from passing the wrong