What are the disadvantages of naming things alphabetically?

Posted by JoJo on Programmers See other posts from Programmers or by JoJo
Published on 2012-04-07T23:17:45Z Indexed on 2012/04/07 23:43 UTC
Read the original article Hit count: 238

Filed under:

Let me give you an example of how I name my classes alphabetically:

  • Car
  • CarHonda (subclass of Car)
  • CarHondaAccord (subclass of CarHonda)

There are two reasons why I put the type of the class earlier in its name:

  1. When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes.
  2. I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing.

My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example:

What are the disadvantages of my naming convention and the advantages of their convention?

© Programmers or respective owner

Related posts about naming