2 ms·
I have personally found that sometimes writing out comments that explain how a confusing function is going to work will help me to understand the ins and outs a
by sdegutis 7y ago
I have personally found that sometimes writing out comments that explain how a confusing function is going to work will help me to understand the ins and outs and flow of the function before writing it, which will in turn help me to actually write the function, especially with algorithmic functions. Those comments might as well be written as long-standing documentation that doesn't change as long as the implementation/algorithm doesn't change. I know "comments lie" but if it's a long-lived implementation, it's more beneficial than not.
- jniedrauer 7y agoWriting a function docstring is just muscle memory for me. It's part of my process. Explain the objective, then implement it. Docstrings are usually the first or second thing I write after the function signature. I would also have serious reservations about taking a job where documentation is considered a negative during a coding interview.