What do you do when you find a bug in the system you’re working on? I suggest that how you address the bug is a key measure of your professionalism as a developer.

Imagine you’re configuring a system that uses X509Certificates for authentication, and you discover that the reason it’s not working is that you’ve entered the certificate thumbprint in a different format to the one expected.

For example, perhaps you entered the thumbprint in lowercase in groups of two hex digits at a time:

d4 de 20 d0 5e 66 fc 53 fe 1a 50 88 2c 78 db 28 52 ca e4 74

But the system requires the thumbprint to be all uppercase with no spaces:

D4DE20D05E66FC53FE1A50882C78DB2852CAE474

What do you do?

Think about it.

The easiest, quickest, thing to do is to reformat your thumbprint into uppercase and move on.

It’s tempting to do this, after all … you have a job to do, and this system isn’t going to configure itself. You’ve got a deadline to meet and a list of urgent tasks as long as your arm …

But …

… you’re leaving the problem there for someone else to run across, wasting their time in the future. Very likely, the person experiencing the problem will be you.

A better approach is to modify the underlying code so that it handles multiple formats cleanly. Convert all letter characters to lowercase, strip out any whitespace characters (including any byte order markers), and make it easy for the next person to configure.

After all, a certificate thumbprint is not case sensitive; it is just a sequence of hex digits - so there is no difference between F & f, and whitespace just doesn’t matter.

What you’re doing is smoothing the path for the person who comes next; not only saving them the time of reformatting the certificate thumbprint but also all the time they might otherwise waste on testing and troubleshooting the configuration error.

There’s a general principle here that’s worth applying more widely.

Comments

blog comments powered by Disqus
Next Post
Convention testing for immutable types  30 Nov 2019
Prior Post
Modifying Words, Part the Second  16 Nov 2019
Related Posts
Browsers and WSL  31 Mar 2024
Factory methods and functions  05 Mar 2023
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
Archives
November 2019
2019