Putting counters in names6
September 13, 2022 by Kenneth Fisher
It’s not all that unusual, or unreasonable to put a counter in a name. For example let’s say you need multiple test instances for your Sales production instance. It’s not unreasonable to do something like this:
You do want to be somewhat careful though as it is possible you can get some very confusing names. For example let’s say that your production environment requires three different instances so you do something like this:
But you also have two nodes for a cluster for an availability group. Now you have:
Your test environment doesn’t have a cluster, but you do have 2 copies of each of the instances, and since this server was upgraded recently your server team decided to create the new server with a counter (the original was something like TestServer01 and the new server is TestServer02).
If you think that’s starting to look a bit confusing you’re absolutely right. Now add in a case where they need a third set of test instances but TestServer02 is getting a bit overwhelmed so now you have TestServer03 with yet more instances on it.
The same thing can happen with variables. I’ve seen @Counter1, @Counter2, @Counter3, etc. in the same piece of code before.
In the end, while I don’t think it’s a problem to use a counter in a name, multiple counters can get bit confusing. So to keep the number of counters down I try to avoid them whenever I can come up with something else to use. This would have been a bit easier to follow in my ever so humble opinion.
Do I like having the windows version name in the server name? Not overly but I think it’s better than just a counter. And how do I feel about having more specific instance names? This is a 💯 for me. There’s not only no need to put a counter there now but the instance names are far more specific. It’s actually easy to tell what exactly this is intended for. And last but not least we have an actual counter. First test environment, second test environment. Perfect place for a counter and I can’t think of anything you could put there instead that would work better.
Category: SQLServerPedia Syndication | Tags: naming
6 thoughts on “Putting counters in names”
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
There are only 2 hard problems in computing:
1. naming conventions
2. cache invalidation
3. off-by-one errors
Sometimes I dream of the good ol days when the quantity of servers was small due to capital expense and we named them something “cute” like: every server is named after a Disney character. So much easier to remember. This is why we give proper names to pets and children vs Child001.
I take it you’ve never met my kids Son01 and Daughter02?
Is listing three items after mentioning TWO hard problems a clever joke? 🙂
The joke is the third hard problem he mentioned 🙂
Oh … I had to stop and look. But it’s still before noon here.
Not a problem at all 🙂 You should see what I’m like before my first pot of coffee.