mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
add notes on comments in code samples
This commit is contained in:
parent
3ca0dade5b
commit
78278f2b3f
1 changed files with 11 additions and 0 deletions
|
@ -73,6 +73,17 @@ It should therefore aim to be correct, consistent, complete, and easy to navigat
|
||||||
|
|
||||||
Non-trivial examples may need additional explanation, especially if they use concepts from outside the given context.
|
Non-trivial examples may need additional explanation, especially if they use concepts from outside the given context.
|
||||||
|
|
||||||
|
- Always explain code examples in the text.
|
||||||
|
|
||||||
|
Use comments in code samples very sparingly, for instance to highlight a particular aspect.
|
||||||
|
Readers tend to glance over large amounts of code when scanning for information.
|
||||||
|
|
||||||
|
Especially beginners will likely find reading more complex-looking code strenuous and may therefore avoid it altogether.
|
||||||
|
|
||||||
|
If a code sample appears to require a lot of inline explanation, consider replacing it with a simpler one.
|
||||||
|
If that's not possible, break the example down into multiple parts, explain them separately, and then show the combined result at the end.
|
||||||
|
This should be a last resort, as that would amount to writing a [tutorial](https://diataxis.fr/tutorials/) on the given subject.
|
||||||
|
|
||||||
- Use British English.
|
- Use British English.
|
||||||
|
|
||||||
This is a somewhat arbitrary choice to force consistency, and accounts for the fact that a majority of Nix users and developers are from Europe.
|
This is a somewhat arbitrary choice to force consistency, and accounts for the fact that a majority of Nix users and developers are from Europe.
|
||||||
|
|
Loading…
Reference in a new issue