One line explains it all...



  • #define EMPTY_VALUE "-"



    (Found in the horror that is our custom web configuration interface)



  •  And the wtf is where exactly? Would you be satisfied if the macro was called EMPTY_VALUE_OF_A_FIELD_DISPLAYED_TO_END_USER?



  •  EMPTY_VALUE_OF_A_FIELD_DISPLAYED_TO_END_USER_AS_SEEN_ON_THE_DAILY_WTF



  • @badfubglur said:

    And the wtf is where exactly? Would you be satisfied if the macro was called EMPTY_VALUE_OF_A_FIELD_DISPLAYED_TO_END_USER?

    Why would the user want to see a dash for an empty field instead of, uh, an empty field?



  • @badfubglur said:

    And the wtf is where exactly? Would you be satisfied if the macro was called EMPTY_VALUE_OF_A_FIELD_DISPLAYED_TO_END_USER?

    Duh. Clearly, it's the use of magic strings:

    
    #define MINUS_SIGN "-"
    #define EMPTY_VALUE MINUS_SIGN
    
    


  •  You don't know much about users, do you?

    A dash says: "Yes, I've seen that field, and I know there should be something here, but there is no value, so here's a dash"

    An empty field says: "There is nothing in here. So maybe there shouldn't be. Or some idiot forgot to fill it."

    This is a valid chain of thought for many people, so dash - while may not be perfect - is not a WTF. A minor weirdness, at most. Anyway, what's going to be on here next? Spelling errors?

     



  • @badfubglur said:

    A dash says: "Yes, I've seen that field, and I know there should be something here, but there is no value, so here's a dash"

    An empty field says: "There is nothing in here. So maybe there shouldn't be. Or some idiot forgot to fill it."

    Except the single line of code doesn't tell us what kind of "empty" this value represents. You're making assumptions. Even if I do agree with your assessment (which sounds reasonable), we don't know whether this dash is "display to the user only empty" or "this field hasn't been filled in year empty".

    ASS U & ME!!

    And don't worry, the pedantic dickweeds will take care of the spelling errors. And every other type of error. No matter how trivial.



  •  Still, that's a reason to yell at a co-worker, not cry in despair over your damned fate. And (not only) I can think of a dozen of ways to do it better, but nobody cares, so what the hell.



  • @blakeyrat said:

    @badfubglur said:
    And the wtf is where exactly? Would you be satisfied if the macro was called EMPTY_VALUE_OF_A_FIELD_DISPLAYED_TO_END_USER?

    Why would the user want to see a dash for an empty field instead of, uh, an empty field?

    Apparently, because (no, I'm not kidding) the half asses XML library that's used fucks up if a field is empty, or more like, the "virtual filesystem" structure which is used in the half assed xml library doesn't accept zero length entries. Also, the webforms that submit data replace an empty field with the EMPTY_FIELD define on submit, and this is handled with javascript. And nooooo, it won't confuse the user, and the user won't try to empty the field 20 times before it accepts the dash.



  • So basically it's the "null string vs. empty string" problem all over again...



  • @blakeyrat said:

    Why would the user want to see a dash for an empty field instead of, uh, an empty field?
    Why was I reminded of
    typeof(string).GetField("Empty").SetValue(null, "Empty");



  • Rummaging through the 'legacy' source I deal with on a day-to-day basis, I thought "how quaint" when I saw:

    public static final int NULL_VALUE = -1;
    Needless to say, about died of apoplexy when I later found, elsewhere in the same code base, the following gem:
    public static final int NULL_VALUE = -5;


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.