How to work with a programmer with a radically different coding style?

coding-style

Has anyone worked with a programmer with a radically different coding style? How do you jive together without wanting to delete and rewrite each others code?

Best Solution

Pick one and go with it.

If you are finding it hard to agree, take the time to list pros and cons including:

  • tool support for auto formatting (offhand I know Eclipse and Visual Studio can do this with a settings file)
  • conformance to general industry standard (Sun have published standard conventions for Java, perhaps there is an equivalent in your language?)
  • conformance to, or cost of modifying, pre-existing source (if you have a million lines in one style, how hard will it be to update that code to the new style?)
  • ... any other factor which either of you find is important (this can include the cost to become familiar with the new style)

If you find yourself working with someone too stubborn to change and adapt, well, you have a bigger problem than clashing code style, and dealing with that is out of scope for this question.

If you are the person to adapt your style, avoid the statement "Well if we had chose my way...". If you have agreed on a single style, fully commit to it.

Before getting to this point though, you should probably ask yourself: what are the benefits of having consistent code? You may find that the cost of consistent code (annoying the other developer) is not worth the benefit.

Related Question