I was reading some BigFix code today, like “type of it of it whose it as string of whose of…” and I thought, "Man… I feel like Max Headroom’s therapist!
A colleague said it felt like Dr Seuss was involved with the creation of the relevance language. So we came up with…
“I would not take action in a box, I will not take action with a fox!”
“Would you like it cast as string? would you like it whose it is integer?”
“Not with an integer, not with a string… Leave me alone, I HATE THIS THING”
For me, it helps to think of it not as a script, but as a SQL query where the tables just happen to be “anything on the computer”.
When you get into deep enough SQL statements with CAST and VARCHAR() and left/inner/outer joins…it’s not exactly the same, but I think in the same family.
I certainly have my own perspective on relevance (I’m a big fan!), but one thing I found helpful early on is the following that describes the 4 major forms of relevance:
<property> of <object>
Q: size of file "foo"
Basic form of relevance
if (condition) then (something) else (something else)
Q: if (exists file "foo") then (size of file "foo") else (0)
Good for analysis or retrieved properties
<property> whose (condition of it) of <object>
Q: size whose (it > 1000) of file "foo"
whose allows filtering
(it) of <property> of <object>
Q: (it) of size of file "foo"
Allows for singular treatment of items in a list, or to put it another way, a method to iterate over a list
Here’s an old slide in case it comes in handy for anyone:
Tracing all these pronouns (it) is probably the biggest slog of the whole thing.
Hard to believe that after 23 years (including a decade with IBM) the closest to an IDE that we have is highlighting. Not even collapsible nested statements. And the debugger is separate from where you write the code.
Really hoping HCL can move this tech past 2010 standards.
In the fixlet debugger there are other tabs that can expand out the expressions so you can see exactly where they fail for example. This is a tree view of the relevance expression that you entered. It has limitations but can be helpful to figure out where there is a problem in a relevance expression.
I too find it helpful to write in SQL-ish structures. If nothing else, the grammar structure helps my brain.
Relevance can require a certain kind of brain inversion that reminds me of AppleScript, and not in a flattering way. (When I heard Lee Wei mention that the relevance language had been partially inspired by AppleScript, I nearly fell off my chair.)
I had never heard this bit of trivia on relevance. Thanks for sharing it.
There is another technique that I use, especially for large session relevance. The Single Clause View in relevance debugger allows you to multi-line and indent your relevance.
You can also use /* in-line comments*/ in your relevance to help future comprehension.
So is THAT what “single clause” does! Hadn’t had time to figure out what it did that was so special. Nice!!
As far as being “like SQL,” that’s… I dunno, I’ve met some SysAdmins who are DBAs, but they’re far from the majority… and the number of DBAs who are SysAdmins or coders I can count on one hand with room to spare. (Hell, only 1 could find their DB server’s IP address.)
So yeah, no wonder it’s confusing: It comes from a completely different paradigm. SQL and BF both read like someone wanted to make a language that is as “natural” as possible, but capability took over as a goal after the language syntax crystallized so now they’re a strange creole of human and machine tongue.