2 ms·
- Add the occasional expositive comment to help clarify intent (in places where it might be ambiguous). - If writing in a language with weak ability to do this
by grandalf 10y ago
- Add the occasional expositive comment to help clarify intent (in places where it might be ambiguous).
- If writing in a language with weak ability to do this through its syntax, establish critical runtime invariants. This can also make intentions and system constraints obvious to the reader. I recommend invariant.js for javascript.
- Write your tests so they can all run by themselves, and do not depend on state created by other tests.
- If something is hard to name this usually means the design needs work.
- If you realize something was incorrectly named, take the time to fix it and refactor, rather than imposing the burden of working with an incorrectly named thing on other readers of the code.