Programming and Boy Scouts are not that different. The two share a fundamental principle of respect. "Leave the campground cleaner than you found it."
Picking up trash and squashing bugs is only half the battle. The idea is to take care of one another. We all make mistakes. Would you rather be ridiculed or work with someone who understands that you are only human?
Here are some field notes to keep developers happy campers.
When you are fixing a bug or just scrolling through files, be courteous. Perhaps you caught a glimpse of a typo, duplication, or an ugly regular expression.
Stop what you are doing and be glad that you discovered what you did, when you did. Make the quick fix. If you are busy, make note of your observation, and come back later. There is no reason to make a fuss.
Writing perfect code the first time is unlikely. Great code is refined over time. When code goes untouched, it is more difficult for future developers to maintain.
If a new feature shines a light on the problem, go ahead and include some enhancements with your commit. Make some minor adjustments, rename some variables, separate logic, use different data structures, or write another test case.
Writing code is easy, but reading it is difficult. Do not make excuses about the origin. Leave a little comment about something you learned. It will help the next programmer that visits.
For the complex chunks, revisit the documentation sooner than later to keep it up to date. Let your peers know about your discovery. New hires, the team, and future you will be forever grateful.
Those who made it this far are officially ready to enjoy the wilderness of programming. This simple and often overlooked concept pays huge dividends.
Share this with your team so they know a scout has their back.
Leave your wisdom below and I will add it to the article so it's easier to see.