Finding outdated docstrings with GitHub Copilot, ChatGPT, and OpenAI API
A frequent debate among software engineers is whether documentation should be written when writing the code or later, when the code has stabilized. One line of thinking is that the docstring (and test cases) should be written at the same time. The primary argument is that the intention of the code is clearest when the developer is working through its logic and understands its purpose. The problem is that, as code is routinely refactored, the docstring comments and test cases must be adapted, making the original versions obsolete. The other line of thinking is that the documentation can and should be written later, once the code settles, to minimize the repeated rewriting of the comments.
New GenAI technology makes the debate irrelevant since it offers two solutions. The first solution is simply to regenerate and update all the comments at the method or file level. The previous section described this strategy...