I get better at writing relevance over time

This should be the case for most things, but you tend to get better at it over time.

That is definitely the case for me when it comes to old relevance I had written long ago. Since then I have figured out better ways to write it to be both simpler and more future proof. It definitely makes me want to go back and update all of my old relevance that I am now embarrassed by, but I don’t tend to do that unless there is a need.

Here is a particular example:

From 2011: https://bigfix.me/fixlet/details/717?force=true

Updated version, from 2015: https://bigfix.me/fixlet/details/6170

You should take note that the Windows relevance is more dynamic. Also, the other relevance is written to be plural. This simplifies the need for error checking.

The following statement replaced 2 relevance statements in the original task/fixlet:

exists string values whose(it as lowercase contains "dell") of selects "Manufacturer from Win32_ComputerSystem" of wmis

Also, the following statement:

exists (string value of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmi) AND ("" != (string value of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmi)) AND (7 = length of (string value of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmi))

Was simplified to just this:

exists string values whose(7 = length of it) of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmis

( Dell Serial Numbers are 7 characters long typically )


The last 2 relevance statements of the newer fixlet/task could actually be combined like this:

(it is not contained by computer name) of (string values whose(7 = length of it) of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmis)

I’m not sure that this combination is actually an improvement for readability and understanding, so in this specific case, I don’t know that I would recommend it. Sometimes 2 relevance statements are better than 1.

2 Likes

Since then I have figured out better ways to write
it to be both simpler and more future proof. It definitely makes me
want to go back and update all of my old relevance that I am now
embarrassed by, but I don’t tend to do that unless there is a need.

All the nested IF statements make me cringe after I learned how to use “|” - will be in the office fixing a lot of that this upcoming week.

2 Likes

I try to err on the side of readability, because the next time I look at this I probably won’t be as clever as I’m feeling in the moment when I discover something super-nifty. Plus, my counterparts or successors may be too tempted to find something clever, think it inscrutable, and decide to chuck the whole thing. :wink:

I well remember watching an office wizard bang out a disposable line of highly-compact perl regex (or somesuch), helpfully taking me through each character and what it did as it cast forward and backward, all the while wondering to myself “oh gawd I’m so lost.”

2 Likes