SQLServerCentral Editorial

A rose by any other name would not be a rose

,

William Shakespeare once wrote in the play Romeo and Juliet: “What's in a name? That which we call a rose, by any other word would smell as sweet.” It is a beautiful sentiment in that context, and even still you might say that there is some truth to this saying in a lot of ways. 

But it is a terrible foundation for a naming convention.

The problem is: the word "rose" doesn't typically reference a single rose, but rather a class of plants. Hence when someone says "a bouquet of roses", and you are an English speaker, you likely know exactly what they are talking about without a second of thought. Now let's consider you rename the concept of a rose to a shoe. Now we have to be careful when ordering a pair of shoes that we don't get a thorn in our foot when putting them on.

Before this gets even more silly, the point here is that for a class of things in this world, we typically have a specific name, and in many cases, an agreed upon domain (or set of allowed values for that name) that allows us to speak to one another with only minimal ambiguity. Concepts change, are added, and even the domain for any concept can change over time; though typically quite slowly.

Which leads me to my very simple point for this editorial. Names matter. When you are writing code, designing a database, or any of a range of similar activities, naming objects and attributes is important. In fact, for most people (myself included), object names are very likely the only piece of documentation one is likely to read...Unfortunately, due to some folks not realizing that names matter, this practice of trusting them has gotten me into trouble more than once in my professional career.

In the years I have been working with relational databases, I have found that 99% of the time I can read a database structure like a book, just using the names of objects, foreign keys, datatypes, etc. to interpret the meaning the data architect had for the design. However (to tie this back to the title at least somewhat), there is absolutely nothing other than common sense that stops someone from saying "we have this column named 'rose', if we named it something else, would it still smell as sweet?"

Of course when this happens in reality, it is more likely that the question pertains to a column that has been abandoned and repurposed to some new functionality, but that really didn’t fit the storyline all that well. Now everyone else on the team, never having used the rose column themselves, just grunts "whatever" and there you have it. The woadget column now represents what the original rose column did and exactly one person in the universe understands it. The rest of us just wonder if woadget is spelled right for 10 seconds, then grunt and repeat "whatever."

It is always important to realize that names matter, and naming entire classes of things doubly so. The more you can make your code and designs read like a book the better.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating