What do you when you're working with someone who tends to write stylistically bad code? The code I'm talking about is usually technically correct, reasonably structured, and may even be algorithmically elegant, but it just looks ugly. We've got:
- Mixture of different naming conventions and titles (
underscore_style
andcamelCase
andUpperCamel
andCAPS
all applied more or less at random to different variables in the same function) - Bizarre and inconsistent spacing, e.g.
Functioncall (arg1 ,arg2,arg3 );
- Lots of misspelled words in comments and variable names
We have a good code review system where I work, so we do get to look over and fix the worst stuff. However, it feels really petty to send a code review that consists of 50 lines of "Add a space here. Spell 'itarator' correctly. Change this capitalization. etc."
How would you encourage this person to be more careful and consistent with these kinds of details?
Best Answer
Agree on a coding convention
Even if this is a one pager. I suggest that the whole team sit down and all agree on basic working coding convention that the whole team can use.