Representative Line



  • While peer-reviewing a system of another team, I discovered a whole bunch of variable names consisting of a single letter followed by a single digit. While useless to the casual observer, it turns out that they are actually well known short hand names for a variety of things in this particular line of business. As such, the developers just used variables that match the nomenclature. No big deal.

    Then they went and did something like this (I used only 3 variables for brevity; there were 9):

      boolean i1 = <complex expression that always evaluates to true>;
    boolean l1 = <complex expression that always evaluates to false>;
    if (i1||!!!l1||!!i1) { /* stuff */ }

    The expression always evaluates to true, and is totally unnecessary.

    Why? Because they were feeling gamy during one late night debugging session, and then just decided to leave it that way because everyone knew what it meant.




  • Does that really mean not-not-not l1 and not-not i1?



  • @mott555 said:

    Does that really mean: not-not-not l1 OR not-not i1?

    sadly, yes



  •  At least they realize they're being weird, instead of thinking they're clever or truly ignorant of their wtf.



  •  You have to expect this sort of thing in an environment where

    function(argument)

    and

    function((argument))

    can give two completely different results.



  • @da Doctah said:

     You have to expect this sort of thing in an environment where

    function(argument)

    and

    function((argument))

    can give two completely different results.

     

    wha?

    What environment is this? How do you know it's snoofle's environment? Why do you mention this even though it's not related to the OP?

    SO MANY QUESTIONS.

     



  • @da Doctah said:

     You have to expect this sort of thing in an environment where

    function(argument)

    and

    function((argument))

    can give two completely different results.

    Not sure where you're going with this or what assumptions you're using; we have a Java environment, so f(a) and f((a)) are the same.

     



  • @dhromed said:

    What environment is this?

    VB6 (or VBS or VBA). If you put a parameter into individual parentheses, it gets passed by value (i. e. changing the parameter's value will not have side effects on the value of the caller's "argument" variable). You can also write stuff like argument+0 or argument&"", depending on the type of the variable, to achieve the same result.

    Or go the sane route and declare the parameter in the function declaration ByVal, or just do not change the value of parameters 🙂



  • @da Doctah said:

     You have to expect this sort of thing in an environment where

    function(argument)

    and

    function((argument))

    can give two completely different results.

     

    Are you a Perl programmer on parole or something?



  • @dhromed said:

    What environment is this?
    Maybe it's Pythong.



  • @Zecc said:

    @dhromed said:

    What environment is this?
    Maybe it's Pythong.

     

    Nope, in Python f(a) and f((a)) are the same thing... Altough f((a,)) is a different beast.

     



  • @Mcoder said:

    @Zecc said:

    @dhromed said:

    What environment is this?
    Maybe it's Pythong.

     

    Nope, in Python f(a) and f((a)) are the same thing... Altough f((a,)) is a different beast.

     

    Yes, but f(a, b) is different than f((a, b)). And both are valid Pythong syntax.



  • @Mcoder said:

    Nope, in Python f(a) and f((a)) are the same thing... Altough f((a,)) is a different beast.
    Yes, but I was talking about Pythong.

    And btw, in Lua f((expr)) is different from f(expr) if expr is a function call which returns multiple values. In the first case f is called with only the first value.



  • @snoofle said:

    While peer-reviewing a system of another team, I discovered a whole bunch of variable names consisting of a single letter followed by a single digit. While useless to the casual observer, it turns out that they are actually well known short hand names for a variety of things in this particular line of business. As such, the developers just used variables that match the nomenclature. No big deal.

    Finance Industry + variable names consisting of a single letter followed by a single digit = Excel?

     



  • @mihi said:

    @dhromed said:

    What environment is this?

    VB6 (or VBS or VBA). If you put a parameter into individual parentheses, it gets passed by value (i. e. changing the parameter's value will not have side effects on the value of the caller's "argument" variable). You can also write stuff like argument+0 or argument&"", depending on the type of the variable, to achieve the same result.

    Or go the sane route and declare the parameter in the function declaration ByVal, or just do not change the value of parameters 🙂

    Hey, if your shop is doing one thing in Java, another thing in VB, still another in Perl, and a bunch of legacy stuff in RPG for all I know, the relevant environment is "IT".


  •  as I recall, in lisp and other functional languages (f a) calls f with a as the parameter, and (f (a)) calls a and passes its result to f (though that's more akin to f(a) vs. f(a()) in more sane languages, or you could take the difference between (f a) and ((f a)) which is akin to f(a) vs. f(a)())



  • @Ben L. said:

    Yes, but f(a, b) is different than f((a, b)). And both are valid Pythong syntax.

    I don't know python, but that seams reasonable if

    (1, 2, ..., n)
    is the notation for a tuple (because that is kinda standard).

    With only so many special characters (which are sensible to use at least) you're bound to get these sorts of small syntax awkwardnesses sometimes.



  • @TGV said:

    Are you a Perl programmer on parole or something?
    They let them off early these days? For what? Surely not good behaviour? At least the Soviets got that one nailed: nobody would use Perl there, unless they wanted a state-sponsored move to Siberia.

     



  • @dtech said:

    tuple
     

    I've always wondered if it's pronounced topple or toople.



  • @dhromed said:

    @dtech said:
    tuple

    I've always wondered if it's pronounced topple or toople.

    I've always said it like "tuh-ple."


Log in to reply
 

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