• (cs) in reply to RevMike
    RevMike:
    That is part of the problem - a CS grad with zero coding experience.  Back in the previous flamewar, someone mentioned working with a CS grad who couldn't program.  The non-coding CS grad explained that they did all their coding projects in teams, and he always elected to do the documentation.

    Seriously, though.  Say you had a CS grad and an EE grad both coming in just out of school.  The CS grad did well in school.  The EE grad did well in his course of study and brings in a small portfolio of programming projects which he did over several years in his spare time, all of which seem to be of good quality.  Who do you pick?


    I assume that the CS grad has nothing indicating programming experience.  (This is questionable given co-op programs.  Or, it could mean that he could not even get a co-op job.)

    The EE grad looks promising because of the experience, but he may only have worked on small one-man projects.  This might not be enough.  I would grill him gently to establish his limits.  If he answered sensibly, he would get serious consideration.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to ammoQ
    ammoQ:
    Jeff S:
    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 


    You scare me. In which language is OR evaluated before AND?


    APL has no operator precedence and is evaluated right-to-left.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to ammoQ
    ammoQ:
    Richard Nixon:

    The most important aspect of any programmer is the ability to code. That trumps everything. So saying, I want someone who can code over someone who can't code is just as true (and just as worthless a statement to make) as I want someone who can code and does not have a degree over someone who can't code and does have a degree.


    There are companies and other employers where HR managers have no clue what "ability to code" really means so they just look at the degree.


    How does that relate to what I posted and you quoted?

    Sincerely,

    Richard Nixon
  • (cs) in reply to Richard Nixon
    Richard Nixon:
    ammoQ:
    Richard Nixon:

    The most important aspect of any programmer is the ability to code. That trumps everything. So saying, I want someone who can code over someone who can't code is just as true (and just as worthless a statement to make) as I want someone who can code and does not have a degree over someone who can't code and does have a degree.


    There are companies and other employers where HR managers have no clue what "ability to code" really means so they just look at the degree.


    How does that relate to what I posted and you quoted?

    Sincerely,

    Richard Nixon


    For those organisations, the degree trumps everything and the ability to code is secondary. So, while probably all people here agree
    that the ability to code is the most important quality of a candidate, no one should expect that every employer thinks the same way.
  • (cs) in reply to Jeff S
    Jeff S:

    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 



    WTF? It's a rule that that AND is evaluated before OR. Always has been.

  • (cs) in reply to ammoQ
    ammoQ:
    Richard Nixon:
    ammoQ:
    Richard Nixon:

    The most important aspect of any programmer is the ability to code. That trumps everything. So saying, I want someone who can code over someone who can't code is just as true (and just as worthless a statement to make) as I want someone who can code and does not have a degree over someone who can't code and does have a degree.


    There are companies and other employers where HR managers have no clue what "ability to code" really means so they just look at the degree.


    How does that relate to what I posted and you quoted?

    Sincerely,

    Richard Nixon


    For those organisations, the degree trumps everything and the ability to code is secondary. So, while probably all people here agree
    that the ability to code is the most important quality of a candidate, no one should expect that every employer thinks the same way.


    But I never said that all employers have that line of thought, did I? I was stating my personal opinion. Why post your statement as if you're refuting something I said?

    Sincerely,

    Richard Nixon
  • (cs) in reply to Quinnum
    Quinnum:
    Jeff S:

    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 



    WTF? It's a rule that that AND is evaluated before OR. Always has been.



    Actually, there is no precedence--a statement that combines AND and OR without using parentheses is considered ambiguous and should be better defined.  That's why different languages can use different interpretations.  If your logic is ambiguous, that's not your biggest problem....
  • wang (unregistered) in reply to graywh

    On an almost similar topic, I just had to share this little beauty I found in a trigger.

      SELECT Count(*)
       FROM inserted
       WHERE NOT (Not [column] Is Null)

    What kind of warped mind writes shit like that?

     

     

  • (cs) in reply to graywh
    graywh:
    Quinnum:
    Jeff S:

    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 



    WTF? It's a rule that that AND is evaluated before OR. Always has been.



    Actually, there is no precedence--a statement that combines AND and OR without using parentheses is considered ambiguous and should be better defined.  That's why different languages can use different interpretations.  If your logic is ambiguous, that's not your biggest problem....


    For C-like languages, including PHP, AND evaluates before OR.

    http://www.php.net/manual/en/language.operators.php#language.operators.precedence
  • (cs) in reply to graywh
    graywh:
    Quinnum:
    Jeff S:

    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 



    WTF? It's a rule that that AND is evaluated before OR. Always has been.



    Actually, there is no precedence--a statement that combines AND and OR without using parentheses is considered ambiguous and should be better defined.  That's why different languages can use different interpretations.  If your logic is ambiguous, that's not your biggest problem....


    In math there is precedence.  Boolean algebra is a system where the numbers are {0,1},  and it is defined that 1 + 1 = 1.  Therefore and AND is a multiplication expression and OR is an addition expression, NOT is usually indicated by a tick after the symbo1, similar to an exponent.  So, unless parenthesis modify the precedence explicitly, NOT is evaluated first, then AND, then OR.

    Most, but not all, common programming language implement these same precedence rules.  However, it is NEVER a WTF to explicitly indicate evaluation order with parenthesis even if it is redundant.
  • (cs) in reply to ammoQ
    ammoQ:
    OneFactor:

    I still remember a bit of math. If you restrict the set of numbers to the set {0,1}, the multiplication operator becomes the same as the and operator. If you make 2=0 (yes, this is fairly typical mathematical procedure), then the addition operator becomes the exclusive-or which has very low precedence.



    Sorry, you are wrong. That analogy is only because you assign 0 to FALSE.

    Time for a little game:

    You find this artefact from an alien civilication. You know it's about logic but you don't know which symbol means TRUE and which symbol means FALSE; likewise you don't know which is AND and which is OR.

    But you have the following table:

    #|2 ß    %|2 ß    Z|
    -+---    -+---    -+-
    2|2 ß    2|2 2    2|ß
    ß|ß ß    ß|2 ß    ß|2
    

    Z means NOT, that's for sure. Now tell me with more than 50% confidence what 2, ß, # and % mean.

    Fine, prepend a "assuming 0 = false" to my post.

  • (cs) in reply to RevMike
    RevMike:
    graywh:
    Quinnum:
    Jeff S:

    Perhaps, he meant he didn't want to know the PHP spec on operator precedence -- you know, which is evaluated first, the AND or the OR.  Some languages do it different than others, I believe -- I don't know that there is  universal rule like * comes before +. 



    WTF? It's a rule that that AND is evaluated before OR. Always has been.



    Actually, there is no precedence--a statement that combines AND and OR without using parentheses is considered ambiguous and should be better defined.  That's why different languages can use different interpretations.  If your logic is ambiguous, that's not your biggest problem....


    In math there is precedence.  Boolean algebra is a system where the numbers are {0,1},  and it is defined that 1 + 1 = 1.  Therefore and AND is a multiplication expression and OR is an addition expression, NOT is usually indicated by a tick after the symbo1, similar to an exponent.  So, unless parenthesis modify the precedence explicitly, NOT is evaluated first, then AND, then OR.

    Most, but not all, common programming language implement these same precedence rules.  However, it is NEVER a WTF to explicitly indicate evaluation order with parenthesis even if it is redundant.


    I guess that's why I have a math degree.  In basic logic, it's ambiguous unless you use parentheses--I checked my textbooks.  In Boolean algebra, there are operator precedence rules.  And your quick definition of Boolean algebra is severely lacking.

    I always clarify code logic with parentheses.  It's just good style.
  • (cs) in reply to kipthegreat
    kipthegreat:
    Alex Papadimoulis:

    <font color="#000099">if</font> ($ticketAmount < 1000) $canProcess = <font color="#000099">true</font>;
    <font color="#000099">if</font> ($canProcess)
    {
    <font color="#000099">if</font> ($avaiableCredit >= $ticketAmount)
    $canProcess = <font color="#000099">true</font>;
    <font color="#000099">else</font> $canProcess = <font color="#000099">false</font>;
    }
    <font color="#000099">if</font> ($hasOverride) $canProcess = <font color="#000099">true</font>;

    <font color="#000099">if</font> ($canProcess) ProcessTransaction($ticketId)
    <font color="#000099">else</font> RejectTransaction($ticketId);




    <font size="1">if (($ticketAmount < 1000  &&  $availableCredit >= $ticketAmount)  ||  $hasOverride)
      ProcessTransaction($ticketId);
    else
      RejectTransaction($ticketId);</font>


    Now do I get the big bucks for tripling productivity?


    You misspelled "avaiableCredit".

  • (cs) in reply to ferrengi
    ferrengi:

    My theory is that he needed to check this condition and set $canProcess = false in the else portion.


    No, that's your hypothesis. I'm very sorry but ever since religious ignoramuses started to run around shouting "Evolution is only a theory!", I regard the misuse of this word as a serious offense.

  • (cs) in reply to Alexis de Torquemada

    Alexis de Torquemada:
    ferrengi:

    My theory is that he needed to check this condition and set $canProcess = false in the else portion.


    No, that's your hypothesis. I'm very sorry but ever since religious ignoramuses started to run around shouting "Evolution is only a theory!", I regard the misuse of this word as a serious offense.

    Off topic, but I agree.

    If “intelligent design” is accepted into biology, then we should just begin applying its logic to everything. Any math that is more complicated than simple addition, subtraction, multiplication and division should be declared false because “it’s too complex to be true”. Same goes for physics, engineering and every other discipline. Heck, I’ve even rejected the idea that light waves can be scanned to create electrical impulses, which are turned into radio waves, transmitted across long distances and then demodulated to produce a picture. I now believe that little people live inside my TV set.

  • (cs) in reply to Alexis de Torquemada
    Alexis de Torquemada:
    ferrengi:

    My theory is that he needed to check this condition and set $canProcess = false in the else portion.


    No, that's your hypothesis. I'm very sorry but ever since religious ignoramuses started to run around shouting "Evolution is only a theory!", I regard the misuse of this word as a serious offense.



    What is the physical punishment that you dole out for violations? Karate chop to the melon? Groin kick? Please, enthrall me with tales of your might. Also, do you have any type of superhero costume that you wear? Because if not, I'd be willing to shell out some money to get you one - custom, of course.

    Sincerely,

    Richard Nixon
  • (cs) in reply to limelight

    limelight:
    I now believe that little people live inside my TV set.

    <FONT face="Courier New" size=2>pay-per-view homonculi have the worst jobs.</FONT>

  • (cs) in reply to RevMike
    RevMike:

    You may be the exception, but I have found from my experience and talking to many peers that the CS people are actually in the minority and that maybe only 50% of the good people have any sort of computing degree.  If CS (and related computing) degrees were really an indicator of programmer skill, wouldn't that ratio be much higher?


    Fascinating - there doesn't even seem to be a name for this flaw in your logic. It's certainly an instance of failing to take the probability of a prerequisite into account, but it's not the prosecutor's fallacy. Maybe we should just christen it the CS degree fallacy?

    Seriously, given that much less than 50% of the population has a CS degree, 50% of all good programmers having a CS degree sounds like a damn good ratio to me.

  • (cs) in reply to DrJames
    DrJames:

    kipthegreat:


    <font size="1">if (($ticketAmount < 1000  &&  $availableCredit >= $ticketAmount)  ||  $hasOverride)
      ProcessTransaction($ticketId);
    else
      RejectTransaction($ticketId);</font>


    Now do I get the big bucks for tripling productivity?

    If by productivity you mean performance, I'd put the hasOverride check first as it most likely is a cached variable and would save you the ticks of calculating the validation checks



    The selectivity typically matters more than the clock cycles for the individual check. If overrides are rare, the selectivity of $hasOverride is very low. The selectivity of the and-expression should typically be much higher.

  • (cs) in reply to Richard Nixon
    Richard Nixon:
    What is the physical punishment that you dole out for violations? Karate chop to the melon? Groin kick? Please, enthrall me with tales of your might. Also, do you have any type of superhero costume that you wear? Because if not, I'd be willing to shell out some money to get you one - custom, of course.

    Sincerely,

    Richard Nixon


    Why don't you get a life and/or a penis enlargement and leave me alone? If you ever posted to Usenet, you won't have any troubles finding someone who can help you with that. (At least with the latter option, the first seems hopeless.)

  • (cs) in reply to Xepol
    Xepol:

    Everyone has to start somewhere, and let's face it.  The code works, it just doesn't work elegantly.  I doubt anyone here can claim that their last project had the polish of their current project, and I would lay serious money that everyone's first projects would be an embaressment to them now.

    Skills and polish develop over time from a solid foundation.  This guy obviously has a solid basis for his logic, so wtf are we trying to hold him up to ridicule?  Just because he hasn't developed polish yet?

    Sad.  Everyone go back and look at your first few projects and then rethink running down this code.



    The dude has a degree - assuming he took even one programming class, mathematics class, or philosophy class, he has no excuse.

    Even my very first projects (wherein I demonstrate the fact that I've learnt about lists but not dictionaries) indicate that I know how to use Boolean logic, and I have no degree, never finished high school.

  • (cs) in reply to Cyresse

    I'll just clarify that I'm quite jealous that people with degrees and no skill can get programming jobs whereas I, having some modicum of skill (and certainly more than this fella), cannot get a programming job, on account of no degree...

     

  • Dwayne (unregistered) in reply to limelight
    limelight:

    I love this part. We already know that $canProcess is true, but lets waste a clock cycle by setting it again.



    Ah, but is your method portable to systems with core memory?  I didn't think so!
  • Dwayne (unregistered) in reply to giannis
    Anonymous:
    I wonder if Miguel Arguelles had shown Rene Descartes Jr. the right implementation, which is:
    if ($ticketAmount < 1000 && 
    $avaiableCredit >= $ticketAmount &&
    $hasOverride)
    ProcessTransaction($ticketId);
    else
    RejectTransaction($ticketId);


    Then what would his answer be?



    "You should have used tabs instead of spaces."

  • Dwayne (unregistered) in reply to OneFactor
    OneFactor:

    Unix/Linux: Hash, vulnerable to dictionary attack, salted-hash



    I thought it was "salted-hash, vulnerable to dictionary attack, shadow password file".
  • Dwayne (unregistered) in reply to Demetrio
    Anonymous:

    And ... "The real WTF is PHP", someone? Please.


    It's implicit.

  • Dwayne (unregistered) in reply to RevMike
    RevMike:

    Anonymous:

    Some days you just really need a good mod system like slashdot...  -1 Flamebait


    C'mon, now.  I announced what I was doing.  If anyone got too riled up it is their own fault.  I'm just arguing for sport.



    Perhaps that's part of the joke?  Slashdot moderators are notorious for being dim-witted.
  • Lachlan (unregistered) in reply to RevMike
    RevMike:
    limelight:
    Alex Papadimoulis:

    <font color="#000099">if</font> ($canProcess)
    {
      <font color="#000099">if</font> ($avaiableCredit >= $ticketAmount)
        $canProcess = <font color="#000099">true</font>;
      <font color="#000099">else</font>
        ...
    }

    I love this part. We already know that $canProcess is true, but lets waste a clock cycle by setting it again.


    I actually have two amusing (to me) comments:

    1) Maybe he though that boolean values are like bits in a dram, they need to be rewritten ocassionally.

    2) Maybe he was concerned that another thread might alter $canProcess while he was in the middle of this call.

    #2 can't be it, after all, without locking that would make no difference.

  • cchen (unregistered) in reply to ammoQ
    ammoQ:



    But you have the following table:

    #|2 ß    %|2 ß    Z|
    -+--- -+--- -+-
    2|2 ß 2|2 2 2|ß
    ß|ß ß ß|2 ß ß|2

    Z means NOT, that's for sure. Now tell me with more than 50% confidence what 2, ß, # and % mean.



    I think
    2 = false
    ß  = true

    = AND

    % = OR

  • (cs) in reply to cchen
    Anonymous:
    ammoQ:



    But you have the following table:

    #|2 ß    %|2 ß    Z|
    -+--- -+--- -+-
    2|2 ß 2|2 2 2|ß
    ß|ß ß ß|2 ß ß|2

    Z means NOT, that's for sure. Now tell me with more than 50% confidence what 2, ß, # and % mean.



    I think
    2 = false
    ß  = true

    = AND

    % = OR



    You can't say, because 'and' and 'or' operations are completely complementary.  In other words f(a,b) = !f(!a,!b) where f() implements 'and', 'or'.

    This might catch a programmer off guard, simply because he may never have had reason to think about it.  Anyone who has designed discrete logic circuits, however, knows this pretty intimately.

  • (cs) in reply to cchen
    Anonymous:
    ammoQ:



    But you have the following table:

    #|2 ß    %|2 ß    Z|
    -+---    -+---    -+-
    2|2 ß    2|2 2    2|ß
    ß|ß ß    ß|2 ß    ß|2
    

    Z means NOT, that's for sure. Now tell me with more than 50% confidence what 2, ß, # and % mean.



    I think
    2 = false
    ß  = true

    = AND

    % = OR



    There are two possible solutions, but your answer is not a correct one. To get a correct answer, eighter replace FALSE and TRUE, or replace AND and OR.

  • John Doe (unregistered) in reply to Anonymoose
    Anonymoose:

    What are you talking about?  You have just caused the number of CPU instructions per line to go way up (and doing away with a few redundant operations, as well), meaning a decrease in the number of source lines processed per second!

    Sincerely,


    [image]


    Naah. I bet the "programmer" (use the term loosely) WAS a CS major. Probably studied Computer Architecture....

    Why would he insert redundant operations?  To increase the IPC number of executed (Instructions per cycle)... (Better utilization of processor's functional units)

    One misbelief is that programs with high IPC are necessarily better than those with low IPC....
  • Benjamin Smith (unregistered) in reply to Xepol

    Hear here!

    I see lots worse than this - at least it works. And, given that it's PHP, who cares about 1-2 clock cycles to set the redundant assignment?

    This does not qualify as WTF code, just immature.

  • Monte Gardner (unregistered)

    I gotta disagree with you on this one. The code, as written, is much more readable and self-documenting then a single line, complex boolean algebra statement. The Phrase: if ($ticketAmount < 1000) $canProcess = true;

    Tells you something about the business meaning of ticketAmount being less then 1000.

    The Phrase: if (ticketAmount < 10000 && $avaiableCredit >= $ticketAmount || $hasOvverride) Is much too terse and difficult to read at a glance.

Leave a comment on “Truth Is How You Define It”

Log In or post as a guest

Replying to comment #:

« Return to Article