[thelist] Coning conventions, pet peeves

erik mattheis gozz at gozz.com
Thu Apr 28 13:23:53 CDT 2016

Over the last several years, I've been more frequently seeing code where
the boolean value comes first in a comparison - if (true === pizzaStatus()).

Who would write it like that? Do these people want me to recognize just how
thoroughly they understand that if A equals B, B equals A?

This infuriates me as it seems to be a perfect example of willfully
ignoring conventions that make code easier to read.

When writing code that will be read by another programmer, you want to
allow the programmer to spend all their effort into understanding what the
code DOES. This means it's equally important for the reader to spend no
effort understanding what the code SAYS.

True is pizza status.

In English, the subject comes before the object when making a statement -
"Pizza status is true!" not "True is pizza status". The meaning of the
second formulation is clear but it takes half a second to understand it.
Working with code requiring you to think for half a second about what it
SAYS every few lines is much more exhausting than working with code that
reads effortlessly.

So, today, I saw someone say (false === strpos( $content, $chr)) and I had
a conniption. I scanned the page to find the name of the author I was
furious with to find it was an Arab name.

Arabic reads right to left. Oh. Hebrew too. Chinese too, I think. Other
languages. Hmm.

Most of the time I see the "backwards" order it's on StackOverflow or some
such thing - not in a book or article that has passed through an editorial
review or maybe even been proofread by the author.

When one is writing for an English reading audience, one should still use
accepted conventions but I hope it will irritate me less when I see this
transgression knowing that in many cases it arises out of the writer's
trouble writing in an unfamiliar language rather than trying to be cute.

Erik Mattheis

More information about the thelist mailing list