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