Friday, 7 September 2007

On coding practices

Coding rules are written for particular community of people who intend to review, maintain, or use the code. It is called coding standard. But there are 2 other important sources which influence the style. These are taste and simplicity. I disagree on that the coding standard, whatever it is, has to be followed blindly.

So 3 points influencing the style are:
1. Personal taste: You personal choice
2. Simplicity/clarity: Do not sacrifice clarity to your or other people's taste
3. Community: What most (other) people expect to see when looking at the code.

My personal preferences are:
1. Find which community is likely to work later with the code.
2. Follow coding rules if they do not disagree with your taste and code clarity.
3. If a rule is not good from your point of view, decide which one: your taste or community is more important in that context.
4. If a rule makes code less simple or clear, ignore the rule. [This is very subjective so be prepare to stand for your opinion]

19.04.2007