Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend Summary


This little look at coding styles produces five rules that you should keep in mind when you define your conventions:

  • Always know why you are adding a rule.
  • Aim to reduce the amount of code someone needs to read understand the flow in a method or function.
  • Follow natural language rules where available.
  • Think about the tools your developers will be using.
  • Aim to make the code as self-documenting as possible.
  • Typos should produce code that does the right thing anyway or which doesn't compile.

Above all, be consistent. The more self-consistent a set of style guidelines is, the more likely you are to get people to follow it.

The first of these rules is a meta-rule. The others define objectives, more than strategies. When you create a rule in your style guidelines, you should be able to explain exactly why it helps obtain one of the objectives. If you can't, then you are guilty of cargo cultism, a very common affliction when defining coding rules, where people force everyone to use the same bad ideas that they have been using, just because they are familiar.

  • + Share This
  • 🔖 Save To Your Account