Everyone has their own coding standards. The most important thing is that you have standards – and if you are part of a team that you share and obey standards. Standards help developers on the team during development and during maintenance. Be consistent, and if you can – be smart about it.
The MSDN conventions are the source of my personal conventions. I thought I would share my preferences around case. This is how my developers standardize their code and a few of the rules we use. Just by looking I can come guess within 99% of exactly what objects are just by their case.
You might have your own preferences, but at least be consistent.
This just happens to be what I like and use:
Example | Standard | What is it? |
m_JerryNixon | m_ prefix, Pascal Case | Class member variable |
_JerryNixon | _ prefix, Pascal Case | Local variable |
JerryNixon | Simple Pascal case | Property |
OnJerryNixon | On prefix, Pascal Case | Event |
JerryNixons | Plural Pascal Case | Enumeration |
JerryNixon() | Simple Pascal case | Method |
jerryNixon | Simple Camel Case | Method parameter |
JERRYNIXON | Upper case | Constant |
Our overarching rule is – no abbreviating. And although there are a few more rules, I like to keep them slim. Developers like freedom.
0 comments:
Post a Comment