Home > Articles

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


As a maintenance programmer, you have conflicting desires when it comes to names. On the one hand, you'd like for all names to be fairly descriptive, and that means lengthy.

Sometimes, you're going to be forced to stick extra letters onto your names. This is especially true for C programmers. Java and C++ have various ways to limit the scope of names; packages and classes in Java, and namespaces in C++. C has neither, and the C++ namespace syntax is relatively new and often goes unused. So the Mozilla project in C++ tacks the letters ns onto all global identifiers, to keep them separated from any libraries that may be linked into the software.

I'm not a fan of naming conventions that require adding extra characters to the beginning of each name. The extra letters take extra horizontal space, which means that you can get less done on a single line of code. That makes the code longer, and you fit fewer statements on a single screen. The "screen" is actually an important unit of code: It's the most you can display on your monitor all at once. That means you don't have to tax your memory or flip back and forth between windows. Many programming style books suggest limiting functions and methods to a single page of code. That's often too restrictive, but it's a good guideline nonetheless.

  • + Share This
  • 🔖 Save To Your Account