Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
scroll top