Home > Programming Languages, Software > More on Naming Conventions: My Naming Heuristics

More on Naming Conventions: My Naming Heuristics

August 30th, 2008

Following a hard rule for naming conventions in software development is difficult; it’s always a compromise between how things were named in the past and where things are going in the future. Other dependencies like the size of the project, the number of developers, and the environment you’re developing in play important factors. In short, there’s never a great naming rule, but here’s my general (heuristic) approach to naming.

My heuristic approach to naming conventions:

New Development / Greenfield Work:

  • Follow the conventions of the language, or the standards used within the larger community, and pay attention to the API. For example: If you’re programming in .NET follow the naming conventions outlined in MSDN, in JavaScript look at the DOM API, in CSS look at the definitions.
  • If a formal naming convention exists for the organization and these conventions makes sense (they aren’t too far off the language APIs) then follow them. If it feels like the naming conventions were created in the dark ages by a very-very senior COBOL Developer then start asking questions.

Maintenance / Brownfield Work:

  • Follow the conventions of the existing code if you’re modifying an existing module.
  • If you’re creating new modules then consider following the conventions of the language and API.

This post was inspired by a podcast by Donald Belcham and Kyle Baley on Brownfield Applications.

Author: Adam Kahtava Categories: Programming Languages, Software Tags:
  1. Sheir
    August 31st, 2008 at 05:16 | #1

    Hola amigo,
    Greetings from Panama, Central America.

    I have some issues with the MSDN convention as they do not even follow it themselves (MS that is).
    Ever try to use FXCop??

    For example say we name a Search button as btnSearch (as per convention)
    and add the click event handler as
    btnSearch_Click(…)
    That will not pass FxCop standards. That bugs me and what we ended up doing was capalization of the button name.
    BtnSearch_Click

    Well I gotta go pack for my return flight to Canada.

    Chao
    sheir

  2. Adam Kahtava
    September 2nd, 2008 at 05:18 | #2

    Haha, doesn’t surprise me!

    I tend to use the MSDN conventions as a baseline. As you pointed out, following MSDN word-for-word is not recommended. :)

  1. No trackbacks yet.