1

I'm working on a project with a senior developer and he doesn't really abide by the naming conventions of the language that we're using. The project is in Go and he uses underscores for everything. For instance, in Go public fields on structs should be named something like TeamID, but in his code it's Team_id. There is already a lot of code written that follows this naming convention.

So basically my questions is, should I ensure that my code follows the naming conventions of the language or should I focus on keeping things consistent and use the naming conventions set forth by the original developer.

I spoke a little about it to him, but he doesn't really care about stuff like that and thinks it's unimportant.

closed as primarily opinion-based by gnat, GlenH7, durron597, Dan Pichelman, user40980 Mar 26 '15 at 16:39

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    one may argue that conceptually, this has been addressed in How would you know if you've written readable and easily maintainable code? If your peers keep complaining about your way of doing things, be it one way or another, you better change to make them feel better – gnat Mar 25 '15 at 15:09
  • 1
    @gnat: Is your comment trying to be sarcastic? – Robert Harvey Mar 25 '15 at 15:21
  • I'm in agreement with you that having to type all those finger-bending underscores is bad, but I agree with your senior developer that this is ultimately pretty unimportant. Language specifications define what a valid identifier is, and if the people who made the language didn't want underscores in your identifiers, then they should not have allowed this. Rules that must be followed but aren't enforced by development tools just make programmers' lives difficult. – user1172763 Mar 25 '15 at 15:38
  • @RobertHarvey did you check accepted answer here? "If most people don't mind along with the senior developer then... I would recommend just keep going with the original convention set forth by the original developer... f other people are not okay with that as well then you can... present that to the management..." – gnat Mar 25 '15 at 17:58
  • @user1172763 It's not unimportant. If your language has a naming convention (chances are it has), then chances are its standard library will be written using it - so straight away your code is going to be inconsistently styled because your code will use one style and code calling 1st/3rd party libs will use another. – GoatInTheMachine Aug 20 '18 at 10:03
8

If most people don't mind along with the senior developer then you will have very difficult time persuading them all. In this case I would recommend just keep going with the original convention set forth by the original developer and at least keep things consistent.

If other people are not okay with that as well then you can focus on the ROI of converting already existing project naming convention to language naming convention and present that to the management along with the senior developer. This will most certainly cause some friction.

In conclusion, I would say that language naming conventions are very important because new people coming into your project are more comfortable with the codebase requiring less explanation and causing less friction.

The reason being that language naming conventions are global and project naming conventions are local so people would need more time getting used to it.

As new developers are getting used to the project naming conventions they are bound to mix it up with language naming conventions if that's what they were used to. Code reviews could solve this issue but it is an unpleasant element of going with the project naming conventions nevertheless.

Hence, from that perspective language naming conventions are more important than project naming conventions.

2

It doesn't matter what convention you use, as long as you are consistent in your convention.

But when you deviate from the default naming convention of the programming language, you are making it impossible to stay consistent, because any interactions with the standard library will use a different naming convention than interactions with your own code.

For that reason it is generally a good idea to adopt the naming conventions used by the standard library.

0

Consistency within the project is the most important thing. I hate underscores and Hungarian notation, but if you are working on a project full of them then its best to keep doing it the same way. Changing to different standards makes everything a mess in the project and you end up with no real standards, unless you took the time to go through and change everything which is essentially a rewrite.

  • 2
    I would make an exception for hungarian notation ... – Sebastian Redl Mar 25 '15 at 15:55

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