Document your work
Code comments explain the 'why.' Variables/function names explain the 'what.' Code flow explains the 'how.' Documenting public functions and properties (via jsdoc for example) can be extremely helpful. Sometimes you need to go beyond the code and explain overarching patterns and architectural structure and decisions. This is where decision documents and project-level documentation can come in handy. Keeping this documentation up-to-date over time is challenging, but important for projects which are intended for long-term maintenance and work from a team. Keep the documentation as close to the code as possible to make it easier.
Examples
- You implement a custom authentication flow and, in addition to code comments, you write a short document explaining why the unique constraints and requirements made you take this approach over more standard methods. The document is stored alongside the code in a docs folder, so new developers can reference it easily.
Share this principle