Naming Things

Naming things is hard

Much of my career has been spent with me as the most senior developer on my team.  It has its pros and cons, I have learned how to figure stuff out on my own, but I have had to re-make many mistakes that I could have avoided.

Naming Things

However, one of the most memorable pieces of wisdom I gained from one of my bosses, was a little gem about how to name variables and properties of things.  The rule says, you should always name from the most specific concept to the least.

Examples would be:

OrderQuantity ShippedQuantity ReceivedDate InvoiceDate MaxAge

There is not any reason why ShippedQuantity is any better QuantityShipped, it is the consistency of the naming that is more important.  I have found this simple rule has made naming stuff a little bit easier.  Hopefully others will too.

Related Blog