Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

This question already has an answer here:

I have a good colleague at work that I work often and he is pretty smart. He is not a .NET programmer but now is coding for a long time too, mainly C++, Python, etc. I see that he is using Python like guidelines in naming, etc, and in shared code, it looks non-uniform to have things like:

getEffectById, etc and many other Python names, etc.

How do you guys think I should tell this to him so he isn't offended or think I am looking down on his code or skills, because I don't.

share|improve this question

migrated from Jan 24 '11 at 20:29

This question came from our site for professional and enthusiast programmers.

marked as duplicate by gnat, durron597, Snowman, MichaelT, BЈовић Aug 26 at 16:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I don't think that's anything he could be offended of... if he already uses consistently the Python coding guidelines in Python code, I think he'll understand that in C# code too it's better to have uniform naming. By the way, I think that this should go on – Matteo Italia Jan 24 '11 at 20:28
This comes up all the time - but what you have to do first is have standards. Then, follow them. Finally, enforce them. – KevinDTimm Jan 24 '11 at 20:28
FWIW: In the one big, widely-used Python naming convention (PEP 8), lower_with_underscores is used for variables, methods, etc. and camelCase is banned. – delnan Jan 24 '11 at 20:28
For those of us that aren't .NET programmers, can you show an example of what its supposed to be? – TheLQ Jan 25 '11 at 7:25
That above example for instance should be GetEffectById, simple change :O – Joan Venge Sep 30 '11 at 21:50

11 Answers 11

up vote 5 down vote accepted

Why would he be offended? He's there to do a job and that job is coding in C# within a team of C# programmers and common sense dictates that he should work with the team and not against them, surely he would understand that?

P.s. I think buying him tools he may not wish to use will just p*ss him off. I know a C++ Dev who absolutely hated Resharper "f*cking with his code".

share|improve this answer

Introduce him to Resharper, and it's hints will hopefully get him to change.

share|improve this answer
Or he'll just change the ReSharper settings to enforce his style. – Jay Jan 24 '11 at 20:32
@Jay - That's a possibility, but programmers are usually lazy (one of the defining characteristics of programmers, don't do more work than you have to) and it's easier to adapt than to change all the settings.. – Erik Funkenbusch Jan 24 '11 at 20:35
There is also StyleCop (haven't used it much). Is there a reason why you and others don't suggest it? best regards – Lasse Espeholt Jan 24 '11 at 22:06
@lasseespeholt - Resharper is easier, and provides more benefits to a developer, so he's more likely to use it. – Erik Funkenbusch Jan 24 '11 at 22:08
While I'm a fan of Resharper, I strongly disapprove of this route unless you also explicitly tell him that he should be following its conventions. Otherwise, this is just a passive-aggressive way to try and force him to change. – Bobson Jun 24 '13 at 18:33

Personally what i would do in this situation is a peer code review - sit with the developer after they have finished some work and go through it with them and suggest areas where it could change, offer to do the same for them on your code so they done feel its a 1 way street

a good peer review can mean you will both learn something

share|improve this answer

Perhaps you could propose that you both author separate style guides to adhere to depending on the language of the project. He'll feel good about sharing his Python-fu with you and your team, and he won't feel "dumb" about learning C# conventions from your document.

share|improve this answer

There is not an absolute fixed guideline as to what constitutes good naming standards in a given language, except that within an organization and a code base, consistency is king.

There are published guidelines that many have adopted, but these are by no means fast-and-hard. My organization uses C# exclusively, and we_use_underscores to great effect. Style is arbitrary; as long as we are consistent our code is not a mess. (It should also be noted, in light of the ReSharper recommendations in other answers, that we are avid ReSharper users, and this in no way forces us to use pascal case or any fixed style -- it is fully configurable.)

Clearly, your organization lacks a style guide. You don't need to single your colleague out, but you can collectively, with a group of colleagues, broach the subject of naming conventions by pointing out the inconsistencies in your code base. You can collectively debate the alternatives and come up with a style guide for your code. From that point, everyone is bound by that guide, and there can be no offense taken if someone is asked to clean up their code according to the guidelines.

share|improve this answer
Absolutely - the right approach is to agree (or impose, depending on where you sit - but agree is better) a set of standards and follow them. – Murph Jan 25 '11 at 9:54

Just that you have these coding guidelines while programming in C# because that's the standard way to do things.

If a programmer takes offense at that, you might want to ask yourself why you hired him, because he's going to be hard to work with.

share|improve this answer

Three good reference books:

Those can be used as a reference. To ensure code quality I recommend a CI build server with code analysis tools like FxCop.

Resharper & StyleCop-plugin are also nice to have.

share|improve this answer

Get your company to buy a copy of Resharper for him. The addon enforces good coding standards and naming convensions.

That or get FXCop and set it up the way you like it and give him a copy too. You can tell him that everyone will use it to standardize the how you do your naming. That way he shouldn't feel singled out.

share|improve this answer
ReSharper enforces the naming and style conventions that you configure. There is no reason to expect anyone to stick with the defaults any more than you expect them to adhere to your organizational standards. – Jay Jan 24 '11 at 20:34
Or set up the build server to fail the build if any code doesn't satisfy the FXCop rules of your choosing :) Bit heavy handed maybe but he'll get the message! – MattDavey Feb 15 '12 at 11:16

"Hey I think it would be better if we all followed a single standard. Do you think we should all code in C# standard?"

share|improve this answer

Tell him straight out what you think in a respectful way. If you need to go further to convince him, that will depend on his response.

Thinking of a smart way to tell him is an example of premature optimization. Why do you think he'll respond poorly.

On the other hand those camel-cased names look okay for C#, though they do have that awful thing that method names begin with caps.

share|improve this answer

Actually, C++ codes has better skills than c# coders (sorry..) It took me a while to get used to the new c# conventions... you can still find in my code nParameter for an int one ect...

I don't think it's a problem - as long as everybody uses the same conventions - so don't tell him that his conventions are wrong. decide which one you're using and everyone should go along with that.

share|improve this answer
-1 for advocating hungarian notation. – MattDavey Feb 15 '12 at 11:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.