3 ms·
It seems to me that well-documented code should follow some sort of power law: Each line should be documented (best if self-documented). Each function (of aro
by js8 10y ago
It seems to me that well-documented code should follow some sort of power law:
Each line should be documented (best if self-documented).
Each function (of around 10 lines) should be documented.
Each group of functions (of around 100 lines total) - approximately a class - should be documented.
Each module (of around 1000 lines) should be documented.
.. etc. up to the final documentation about the whole program.
Each level of documentation should summarize the purpose, inputs, outputs, assumptions and architecture of the thing being described. So a higher level should be around 10x smaller part of the total documentation (of course, some other factor could be used).