Coding Convention – a collection of rules, formatting suggestions or methods for various aspects for a programming language.
Benefits of a team adhering to a coding convention include similar coding styles in the project, faster and easier understanding of others code, and less room for error when combining code. When working alone though, it is still beneficial to stick to a convention. You want all parts of your code to work well together, and if they are all following the rules of a convention, they should be able to communicate without any problems. Coding conventions do of course have their less admirable features though. If you are an experienced programmer, and have your own effective style of coding, it can be annoying to have to switch up your style and slow down the process to achieve the exact same end goal. One could also be worrying about sticking to the rules of the coding convention, and thereby get more confused and create more errors for themselves. Upon familiarizing myself with the Google Java Style Guide, I was surprised to see that there was a rule on where an empty block was allowed to go, and for what reason. I think that an empty block is pretty self explanatory, whether or not it is part of a multi-block statement. Seeing as there are many many things in the Google Java Style Guide that I did not understand, I am sure that there are many things that I will naturally choose to do differently when I come to need those aspects of code. But as of now, I can tell that the placement of my curly braces is not the approach the style guide wants. If I was forced to use this style now, I would find it quite tedious and time consuming. Having to look through the entire guide over and over again to pick apart each section of my code would be annoying to me, but I understand why people do it.
Leave a Reply