Below, you will find a handful of my thoughts with regard to setting coding standards.
My approach to them is the following: as far as they are, their content is of minor importance to me, however it is more comfortable to use standards that apply in a given environment. In example, in C#, brackets usually appear in the new line, contrary to JS/Java.
In my opinion, stylistic conventions should be practical, which means that they should be supported by tools that we use, such as VS, R#, StyleCop, jsHint etc. It is important not to stand up against the default IDE formatting, but in contrary, use it so that the automatic document formatting is compatible with the conventions.
Stylistic conventions don’t have to be in a form of a document as it is rather boring lecture. They may be simply the setting files for analysis tools.
A good test of the conventions is the code review, during which stylistic errors SHOULD NOT occur – people should concentrate on more interesting / challenging aspects of the code.
…i.e. using libraries, creating methods, functions, classes, a scheme of solution and projects etc. In this case, I think that at the beginning you have to use the existing things mostly. There is a great number of ready-made design guidelines for various languages in the Internet. Browse, choose what you like and use it.
It is important for me that they are in a nice form, well-formatted, with examples etc. What is more, it is necessary they are comprehensive, i.e. include at least those things I mentioned above.
Retro-review-refactoring of conventions
Conventions, as every element of the development process, should live and develop together with the team. Therefore, if we have some standards, we can get on with reading the following books:
- „Clean Code” – Robert C. Martin
- „Code Complete” – Steve McConnell
- „The art of readable code” – Dustin Boswell, Trevor Foucher
- „The power of Ten” – Gerard J. Holzmann
After this dose of inspiration, I’m sure we’ll want to make some changes to our conventions 🙂