Why You have to use Coding Conventions
Tomorrow I’m going to
a client in order to help
in constructing a coding
conventions document for
their project. One question
that I sometimes hear is why
to use coding conventions in
projects? This post will try
to answer the question.
What are Coding Conventions?
Taken from Wikipedia –
“Coding conventions are
a set of guidelines for a
language that recommend
programming style, practices and methods for each aspect of a piece
program written in this language. These conventions usually cover
file organization, indentation, comments, declarations, statements,
white space, naming conventions, programming practices and etc.”
Why to use Coding Conventions?
The main reasons to use coding conventions:
- Comprehensible code – Coding conventions enforce coding
standards on the development teams and therefore makes
the code comprehensible to read and understand.
- Avoiding pitfalls – the coding conventions dictate
programming practices that can help to reduce pitfalls that
someone else fell into in the past.
- Help to spread knowledge easily – coding conventions help to
spread the ideas you write in your code more easily to other
developers in the team.
How to Enforce Coding Conventions?
- Code Review Process – during code review you can enforce
the conventions of your company on the developers.
- Code Conventions Tools – there are a lot of tools that can
help you to integrate the coding conventions into the
development process. For example, you can use Microsoft FxCop
to check conventions by creating rules for those conventions or
You can use Code Style Enforcer to checks the code against
a configurable code standard and best practices.
There are more tools out there that can help you to enforce
- Coding Conventions Documents – you should create your
company’s coding conventions document which every developer
should know. There is a great document that was written by
Juval Lowy that you can download from here which is very
recommend to use. That document can be your building block
for creating your own coding conventions in your company.
Lets sum up, I think that coding conventions are essential
tool for a quality and successful projects. In the post I wrote
about coding conventions and why you should use them.
I also wrote how you can enforce coding conventions.
What do you think about coding conventions? I’m very interested