Practice 9. Coding Standards and GuidelinesMake sure your team talks about what good code is and what coding practices team members like and dislike. Put them down on paper or in a web page and get everyone on the team to agree to them. Don't get hung up on silly formatting issues like whether curly braces should appear on the same line or next, just get everyone to agree that when they modify a file, they should follow the same formatting conventions. Having consistent coding conventions simply makes code easier to read. Plus, there is a huge benefit to having the team discuss good code and bad code; they can learn from each other and understand each other's viewpoints.
Tip: Tune Coding Guidelines to the Team One of the teams I worked in had one coding guideline: Use whatever coding conventions you're comfortable with, but if you're modifying someone else's code, you have to follow his or her conventions. This rule worked for that particular team because we all had many years of experience, and we each had our own coding conventions (and we were opinionated about them). We trusted each other to write good code and to be adaptable. Our goal was simply to avoid problems like files being reformatted (to suite someone's taste who uses different conventions), variables being renamed (because of different naming conventions), and multiple conventions being used in the same file. We didn't want to waste time discussing or debating our coding conventions or making changes that had no functional purpose. |