Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you work with a programmer with a radically different coding style? [closed]

Tags:

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?

like image 384
Code Monkey Avatar asked Jan 27 '10 12:01

Code Monkey


People also ask

What are the principles guiding good programming style?

SOLID principle supports good object-oriented design and programming. Five of these principles are described as SOLID: Single responsibility, Open-closed, Liskov substitution, Interface segregation, and Dependency inversion.

How many coding styles are there?

The 7 Coding Styles That Are Dated.


3 Answers

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.

like image 170
Grundlefleck Avatar answered Jan 03 '23 06:01

Grundlefleck


We agree on a standard coding style and enforce it in the form of Visual Studio settings files.

like image 23
mmx Avatar answered Jan 03 '23 06:01

mmx


That's a human communication issue. Just talk to each other. Not through code, in person.

like image 25
ЯegDwight Avatar answered Jan 03 '23 06:01

ЯegDwight