Also, this does not seem lazy to me at all: > A lazy programmer writes a lot of tests, so QA junks do not waste their time. > A lazy programmer documents their code, so thar [sic] coworkers do not waste their time.
Also, this does not seem lazy to me at all: > A lazy programmer writes a lot of tests, so QA junks do not waste their time. > A lazy programmer documents their code, so thar [sic] coworkers do not waste their time.
I have been compelled to write detailed documentation specifically because I was getting tired of being asked questions about it[1]. Though I would say the issue isn’t really laziness so much as general asociability and a need to focus...
[1] It does nothing to stop the flow of questions but it does mean I’m more likely to give an answer that’s actually correct :)
Serious question. I've spent a lot of effort writing internal and external documentation for various systems over the years, and I'm not sure anybody ever read any of it.
Also, if you write relatively small and short functions and you document the goal, the inputs and the result, then the code is quite self explanatory.
But there are many functions where it is reasonable to have even hundreds of words worth of comments:
- anything that heavily uses intrinsics and requires the programmer to have a detailed mental model of the CPU in order to analyze (e.g. making an ASCII table of the register state at each major step of the program). Likewise with assembly programming, though obviously that’s a special case.
- a particularly sophisticated graph-theoretic algorithm, for which the “comment” might be essentially a short CS paper explaining how the algorithm works, giving its time/space complexity, and proving correctness
- the “main function” for simulating a physical or financial system, which might required detailed descriptions of the equations, parameters, and various options
I am working on some compiler stuff and have taken to literate programming for basically everything that’s not a simple utility.
Would rather say:
A lazy programmer documents their code so they do not have to waste time explaining it in person.
A lazy programmer writes thorough automated tests so they do not have to waste time on repetitive manual testing.
I know that I am guilty of automating stuff for way too long :)
And also, as a programmer I enjoy the process of writing and debugging tests much more than manual testing, so even if it wasn't a time saver, it would still make my job more enjoyable.