Coding Magic Values

It’s 2023. I would hope all software developers would learn that hard coding specific values in your system is more likely to cause issues than not. Across the years, we’ve learned not everything is installed on the c: drive, or that not everyone wants to put all data in a Documents folder (or in OneDrive). We’ve learned that any sort of magic number is poor practice, and we ought to know that hard-coded names are problematic as well.

Yet, we still see it happening.

This week I was reading about an admin issue in the Microsoft TechCommunity. This is related to Azure Managed Instance, but it’s really an In-Memory OLTP issue. That was introduced in SQL Server 2014, so I know the code for this was likely written in the 2011-2013 timeframe, but how can this type of issue get through code review and be released?

In this case, the name of a filegroup is set specifically to XTP. It’s a logical name, and I’m sure that some developer thought that things might be faster with a known location. That doesn’t make sense, and while this might not be an issue for most customers, I’m sure there have been some databases built with a filegroup called XTP. After all, there are companies named XTP. What about if this feature evolves to allow a second filegroup, maybe because of some distributed architecture need in the future? Are there then code paths looking for XTP or XTP2?

As much as possible, avoid coding values in your code that a user might enter as data. Names, paths, etc. Just don’t do it. Use variables, which are in every language, and let those values be read from the environment. This ensures that you don’t end up with weird support requests from customers because they chose the same value you did.

Steve Jones

Posted in Editorial | Tagged , | Comments Off on Coding Magic Values

The Senior Advantage

The senior advantage means more to me all the time, though often I feel there are more disadvantages to being around longer than advantages. Getting older is hard, especially physically, and I struggle with that. Having more wisdom, more tolerance, and more patience, are good things, but I’m not sure I would consciously make that trade.

In a business, senior often equates to more experience and time working on systems. Sometimes it means more skill as well, but usually, the internal knowledge of how our systems work inside of our environment is more valuable, even though it can be hard to get management to realize that fact.

The last two years have had many technology workers at home, doing the same work they did in an office. Over the last year, there has been contention between some managers that want people to return to the office and many workers that want to remain remote. While lots of people don’t have a choice, there are some who do, and they are often the senior, skilled people. Lots of them quit, which creates a challenge for managers to fill their slots.

One would think that management would work to retain and keep more employees, but in some cases, the response is to find ways to make it easier to hire new people. One positive thing that happened is the relaxation of the rule for tech workers to have a college degree. That’s good for many people that are talented and don’t want to spend tens (or hundreds) of thousands of dollars on a degree. A little disheartening to me and others who think that this further devalues the experience of current employees.

There are some great employers out there, as well as some great managers that care about their staff. My company is one of them, and I appreciate how we run the business effectively while treating employees fairly. However, there is no shortage of poor employers who do not care much about their people, their training (or re-skilling), or whether staff leaves. They will continue to lean on whoever is still employed while replacing staff with cheaper, and less knowledgeable, new hires.

In thirty years, the one thing I’ve learned is that I need to be responsible for my own career. That means learning often, working on my tech skills, polishing soft skills, and burning no bridges. I need to be prepared and ensure I have opportunities and choices in the future.

That’s my senior advantage.

Steve Jones

Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

Posted in Editorial | Tagged | 2 Comments

Tesla Charging Experiences

Recently we had the need to charge the car away from home, with some interesting experiences. I also had a question from my Mom on the Tesla.

This is part of a series that covers my experience with a Tesla Model Y.

A Long Day

We had a ski weekend planned in the mountains recently. I went up early one Saturday with one kid, who drove his fun WRX. His first time heading into the mountains, and I think the first time he’s driven us to ski in his car.

My wife had a horse class that day, so she drove the Model Y up north, going about 60 miles each way. I’d set the car to charge to 95% the night before, but her round trip ate up some battery, and as a result, she stopped partway on the journey to charge. She added 18kWh.

She and my oldest grabbed some food, walked dogs, and didn’t find it a problem to charge, spending about 13 minutes connected.

Winter Struggles

The next day, she ran some errands in the mountain town and noticed the car was down to about 30%. She stopped at the Supercharger in Silverthorne, finding only one stall open. When she plugged in the car, it recognized the charger, but didn’t charge.

She tried a few things, but gave up. She was slightly annoyed, and didn’t want to wait to try another charger when someone left.

Between her driving and the cold, we lost about 8% of charge in subzero temps. Some of this was thermal protection, and some was likely additional inefficiency of the battery in very cold weather.

Getting Home

The next morning, we woke up with 17% on the battery. I started the heaters to warm the car as we packed, as well as get the battery ready. We drove over to charge, stopping for coffee.

In 32minutes we added 42kW to the battery, which was more than we needed to get home, but it was what the planner recommended. Since we were chatting, handling some email, and drinking coffee, we weren’t that hurried. I might have stopped around 60% charge, but we let his get up to 72%.

The drive home was easy, and I had plenty of charge to run to the gym and a few errands later.

Charging Time

I chatted with my Mom about this a bit, as she’s curious. She has no interest in trading her Lexus for a Tesla, but she asks about how it works and how we deal with it. She hears a lot of FUD in the news about electric cars.

Here are our charging stats for 16 months.

2023-02-01 17_04_40-Charging Stats - Grafana — Mozilla Firefox

My life supports charging at home, and the driving profile for me is that we almost never need 300 miles of range. Even a ski trip is about 220miles for me, so the car has plenty of range. I don’t tend to worry about it, and even on the ski trips, I don’t know if I can go up and back on a cold day with a full charge. I rarely charge about 95% and on ski days, I stop for 15 minutes to use the restroom, get coffee, and let the car charge.

In general, I just don’t think about charging the car. I have on trips, but I’ve also had to think about fuel on trips. We drive through Wyoming and Montana at times, and we usually fill petrol cars up when they’re 1/2 empty. We do this because the fuel is not as reliable in remote places.

The mountains of Colorado aren’t remote, but long trips require a little planning, and I don’t find that onerous.

I also just don’t think about range because I have a (mostly) full tank every day. With my gas/diesel cars, there are plenty of times we’ve run down the tank and have to plan a gas stop that day. I almost never do that with the Model Y.

I probably wouldn’t have written this post if not for the conversation with my Mom. While the charger not working was mildly a hassle, it was a 3 minute conversation with my wife, not something that was concerning.

For most people, electric works find. However, it is a different paradigm, and you should think about your lifestyle and driving profile. It’s not for everyone, but it is for me, and I really enjoy the car.

Posted in Blog | Tagged , | Comments Off on Tesla Charging Experiences

Daily Coping 3 Feb 2023

Today’s coping tip is to ask other people about things they’ve enjoyed recently

I asked the question on Twitter and on Facebook, looking for interesting responses from friends. The more fun ones:

  • Got a dog (love this!)
  • tabletop gaming
  • cooking a meal with a kid (love the kids around the kitchen)
  • woodworking
  • bought running shoes (I can relate)

For me, I think a couple quiet dinners out with my wife were very enjoyable. I cook a lot at home, and we often have our kids with us. Date nights have been rare lately, so these were nice.

I started to add a daily coping tip to the SQL Server Central newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

Posted in Blog | Tagged , , | Comments Off on Daily Coping 3 Feb 2023