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.