On Tue, Mar 20, 2018 at 5:59 PM, Dan <dan27649@xxxxxxxxx> wrote:
I actually found this line of code a few minutes ago.
I'm going to ask if we can install a punching bag somewhere in the building.
I am not defending whoever wrote that code, and I would never write
that myself, but I would like to believe that it was a misguided
attempt to "fix" a badly named (or badly populated) field.
For example, maybe there is a flag which is called OPTED_OUT, and
because of poor file design or poor programming by Bob, this field
contains 'N' whenever the account *is* opted out. And Charlie comes
along and thinks "well, it's too late for me to fix the file, and
whatever other programs might use that field, but for right now, right
here, I can make it so that *my* code looks like this:
if opted_out = YES;
do_the_right_thing();
and that's pretty readable, right?"
Two wrongs absolutely do not make a right. But it's possible Charlie
was at least *trying* to do something good.
And, I cannot stress enough that these shenanigans are NOT a good
idea, but if Charlie were really insistent on making his code read
well via creative naming, he should have at least gone the route of
renaming OPTED_OUT to OPTED_IN in the program (I'm thinking via I
specs?) so that 'N' could be used as-is or given a sane name like NO.
Incidentally, this is why I am extremely reluctant to ever use a name
which is itself a negative. My permissions are always of the form
ALLOW_something.
John Y.
As an Amazon Associate we earn from qualifying purchases.