I've experienced this time after time again, many developers don't proofread their work. I don't know why some developers have this urgency to submit their code for review right after they get it working without doing the important step of editing and proofreading.
Do you remember in school when you finished that essay or research paper, you edited and proofread it before submitting right? I believe this should apply to our source code too. In a way, source code is a developer's form of written communication.
After you finished completing a portion of work that is ready for submission or code review, consider doing the following.
- Does your code integrate properly into the overall system. As an analogy, writing the next chapter in the book or the next paragraph in the essay.
- Using the right data structures for impact and efficiency.
- Are you expressing what you are doing clearly and to the point.
- Are you being overly verbose or too compact with your code.
- Have you communicated your intentions clearly that would be understood to another developer and not just the computer.
- Have you checked for spelling, grammar, and typing mistakes. Linting helps but you'll be surprised how often people ignore lint warnings.
- Are you conforming to the style of the existing code and being careful of things that a linting tool might not catch.
- Did you go through a checklist of common runtime errors.
I've heard reasons for not doing this, most of the time it comes down to "I want to submit my code as soon as possible. I don't want to be waiting around and have my code get out of date with the rest of the codebase." Our source code is not only how we make the computer work but also a form of communication between developers. I encourage all developers, especially newer developers, to foster the same habit you have with other written communications. Edit and proofread your work before submitting.