A code example earns its place by showing how something works, why an improvement matters, or why an optimization is necessary. Treat it as evidence, not decoration. section 5.4.6
Before publishing, run each example through this checklist:
- Share only code you have permission to publish, especially when the project is closed source. section 5.4.6
- Check production code carefully and ask another person to review it for mistakes. section 5.4.6
- Make invented code realistic, secure, syntactically correct, and compilable; link to a playground when useful. section 5.4.6
- Cut irrelevant details from non-runnable excerpts, using ellipses to mark omissions. section 5.4.6
- Add enough surrounding technical detail—exact technologies, steps, benchmarks, or repository links—for readers to test your claims. section 8.5.2
Contrast makes a rewrite concrete
A rewrite article can show an awkward Rust snippet beside its clearer Zig counterpart. The contrast lets readers judge readability directly, while practical migration details help them decide whether to attempt their own rewrite. section 9.3.1 section 9.4.2
For presentation slides, keep excerpts readable: split or redact nonessential code rather than shrinking the type until nobody can follow it. section 16.4.3
