The ‘Important First’ naming rule for software things

NOTE-HXA7241-20100420T2046Z

Harrison Ainsworth

A small but valuable rule for naming things, that seems less appreciated than perhaps it ought to be.

The software world includes two simple, general, reliable facts:

  • Collections of lots of things get shown in lists.
  • Lists get shown in alphabetical order.

A naming principle follows from these:

Put the important concept/feature of a name first.

This mainly applies to types, classes, modules – larger, more global items. For example:

YES:

  • Vector3float
  • Vector3int

NO:

  • Float3vector
  • Int3vector

When you follow this principle, things are easier to find because you can guess where to look, and easier to understand because all the related items are visible in a group. If you don't follow it, then everything goes all over the place in lists.

Maybe names following this seem ‘unnatural’. But this is not english, this is programming: it is about communicating information and using it practically.