A few words from Agical

Bring me clarity - Not No No Notification Adjustment

Are you bent out of shape by obscure emails?

Do text walls on the intranet rub you the wrong way?

Are you looking for the exit when the CFO pulls slide after slide with nothing but misplaced participles and spelling errors.

I’m sorry if I got you revved up. Relax, take a deep breath and read on.

Get a load of this: hasNoNoNotAdjs(...)

If you think the above is from the popular 90-ies song “No Limit” you’re barking up the wrong tree.

Unfortunately the text snippet is from my day to day work. And to make things worse, I’m probably the culprit.

It’s unreadable and it requires a lot of effort to deconstruct. Hell, it’s close to unpronounceable.

When I stumbled across the code the other day I came to the conclusion: It stops here. I must end this madness. So I decided I’d do something about the mess I created.

Before I did anything to the code though, I needed to understand what it actually did.

I started to analyze the word salad and the body of the method. It did multiple things, which was reflected in the method name.

Here’s a replay of my bumpy road to clarity.

I started here:

hasNoNoNotAdjs(...)

No no … no no no no … there’s no limit …

My fingers itched. I needed clarity.

I started to remove abbreviations, remove negations and bring clarity through some renaming.

"hasNo" became "doesNotContain"

I lengthened “No” to “Norwegian”, and removed some ambiguity.

I was still confused.

“Not”

Aha. More ambiguity. "Not" became "Notification"

“Adjs”

WTF! Come on. Save 7 characters? It’s "Adjustments", right.

Now it was a lot longer, but I could read and pronounce it:

doesNotContainNorwegianNotificationAdjustments

There was more though. A negated statement. I studied the code, and understood more. The code was trying to determine whether it was Swedish adjustments, or something else.

Aha!

Well, then the method name needs to tell us that.

I was now looking at: containsOnlySwedishNotificationAdjustments

I stopped there. Pleased with the outcome.

Be nice to yourself. Be nice to others. Stop the word twisting.

Say what you mean, and say it loud and clear!