Creating sample code
- correct
- concise
- quickly understand
- easy to reuse
- minimal side effect
1. Correct
Sample code should
- build without errors
- perform claimed task
- Production-ready [no security vulnerabilities]
- language-specific conventions
2. Explain how to run sample code
- install library
- adjust env. variable
3. Concise
- short and include only necessary components
4. understandable
- descriptive class and variable names
- avoid hard-to-decipher programming tricks
- avoid deeply nested code
- use bold or colored font for attention
5. Commented
- Short comments - but clarity over brevity
- no comments for obvious code
- explain why code is doing not what