Editorials

Names Do Matter

Aaron shares a pragmatic approach to naming. Based on his response it would appear there is still a great value in how we name our objects. Aaron writes:

I think the names we give to things that our applications are built around are really important because these things we created will/should be the language of our system and how we communicate with the stakeholders of the application. If I have a conversation with a report writer and I tell them something to the effect of “first we fetch a tblCustHdr and then it’s corresponding tblOrds records” I have to assume the person I’m speaking to knows what those names are referencing, they have to know and retain this translation in their head. This forces some mental mapping between the business domain and the application (in this case database objects). However, if I had the same conversation with them and I could say “first you’ll want to fetch a record from the Customers table and all their orders from the Orders table by the customer’s id value” then the conversation about the data flows very naturally and we could have the same conversation with an end user and they’d be able to understand.

There was a quote from Uncle Bob Martin I read some time ago that said something like “If you can’t say your object (variable) names without sounding like an idiot, you haven’t spent enough time thinking about the name you’re using”. It makes sense to me. In the above example if I were to read tblCustHdr, it would sound like “tee-b-el-cust-heed-rr”.

I am much of the same persuasion. Regardless of the audience, if your code requires a decoder ring in order to understand the meaning, then a little more work would provide great value.

As a consultant I really appreciate those systems where people have done that extra bit of work defining a reasonable standard, and going the extra mile to clearly name Objects, Variables, Tables, Columns etc. Lookup/Reference tables and enumerations are an additional bonus when they are well done.

Thanks for the response Aaron. You can share your thoughts in comments here or drop an Email to btaylor@sswug.org.

Cheers,

Ben