My Naming Conventions

Here are the naming conventions I currently use in my projects. I keep questioning myself about them from time to time. Usually I end up changing some point but I'm forcing myself not to do it anymore. Conventions should be a way of reducing developement cost. If you keep changing them you are actually turning them into a money pit. I learned that the most important thing with a naming convention is to stick with it, whatever its definition is.

C#
  • Microsoft guidelines for everything public.
  • Private variables: prefix them with my ie myVariableName. I use this style for both normal variables and winForms controls.

ActionScript

  • Packages, and class members are camelCase.
  • Class names are PascalCase.
  • Private variables: prefix them with _ ie _variableName but I plan to switch this to the same convention I use for C#. That's because prefixing vars with an underscore results in a too low-levelish code for my tastes, and because underscore-prefixed vars as Flex control ids look weird in mxml (I don't want to use different naming conventions for controls and variables).

I thought a little bit about using the underscore style in C#, mainly because you have private vars clearly distinguished from the rest of class members in Intellisense. But again, the resulting code looked too low level.

I also considered using a single letter as a prefix for private vars, ie mMyVariable, but i like using my instead because it often makes the whole variable name sound like a piece of a correct english sentence.

Comments

Popular posts from this blog

Parallel Gaussian Elimination Using MPI

Parallel Beam Tracing and Visualization of 200 Million Sonar Points

Flickering 2D transform elements in Chrome: a simple fix