• (cs)

    FIRST!

  • (cs) in reply to ferrengi
    ferrengi:
    FIRST!


    It's funny, these normally get spam filtered, yet people still do it.

    Anyways, about the wtf, maybe the guy was a philosophy major?
  • Just another WTF (unregistered) in reply to ferrengi

    ferrengi:
    FIRST!

    Wow... is that the first first that is actually first?

  • (cs)
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks. One day, while debugging some of his colleague's code, Miguel noticed that most of the conditional expressions were inelegantly formed with redundant Booleans, abuse of operators, and so on.

    <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);

    Naturally, he decided to talk to the new guy about it, explaining that the above code could be simplified with an OR, an AND, and no confusing $canProcess variable. His workmate shook his head, replying with "Yes, that may be so, but you don't want to build your logic based on the way PHP implements those."

    Miguel is not so easily discouraged. "It's not just PHP. It's for everything," he pressed on despite receiving a blank stare, "Boolean logic? You know, the way to find truth."

    He gave up when Rene Descartes Jr. replied, "Truth is how you define it."



    If "Truth is how you define it", how can the programmer rely on setting $canProcess to true or false? Maybe the definition will change and what was once true will not be true in the future and this code will be broken!
  • imbusy (unregistered)

    Boolean logic might adopt something new one day, like "FileNotFound". You don't want to base it on todays logic, do you? Make way for the new technologies!

  • (cs)
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.
  • (cs)

    There's definitely room for improvement here. However, with respect to another post on this site regarding good commenting, sometimes code which isn't technically straightforward still makes sense if it directly reflects business logic.
    It might just be that with the presented code, even a business analyst could do a code review and find an error. With the entire boolean logic compressed as far as possible, the business analyst might fail to understand the code.
    As computer gets better and better, I tend to write more and more code which isn't most compact technology-wise, but which very much reflects a work flow or decision tree. This makes it much more readable and only little slower.

    Rene Descartes Jr on the other hand might need to work a bit on his understanding of truth.


  • (cs)
    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.

  • (cs) in reply to RevMike

    I would hope that any university graduate would understand that AND and/or OR are logical things and that they are implemented the same, or at least functionly the same, on Windows and Unix or Linux.

    And that AND and OR are concepts older than the interweb and computers or even IBM.

     

     

     

  • Disgruntled DBA (unregistered)

    Does this mean we have to start programming things for every user's individual definitions of "true", "false", and "fileNotFound"?

  • boohiss (unregistered) in reply to RevMike
    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    Come again? You are saying there is zero correlation? So a group of 50 year old truck drivers is just as likely to program as effectively as a group of 25 year old CS majors?

  • (cs) in reply to ferrengi
    ferrengi:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks. One day, while debugging some of his colleague's code, Miguel noticed that most of the conditional expressions were inelegantly formed with redundant Booleans, abuse of operators, and so on.

    <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);

    Naturally, he decided to talk to the new guy about it, explaining that the above code could be simplified with an OR, an AND, and no confusing $canProcess variable. His workmate shook his head, replying with "Yes, that may be so, but you don't want to build your logic based on the way PHP implements those."

    Miguel is not so easily discouraged. "It's not just PHP. It's for everything," he pressed on despite receiving a blank stare, "Boolean logic? You know, the way to find truth."

    He gave up when Rene Descartes Jr. replied, "Truth is how you define it."



    If "Truth is how you define it", how can the programmer rely on setting $canProcess to true or false? Maybe the definition will change and what was once true will not be true in the future and this code will be broken!


    Clearly, the programmer does not depend on setting $canProcess to true or false... it is uninitialized!
    I suppose the programmer's code may be 'inelegant', but saying that $canProcess is confusing?  What else could it possibly mean?

    New addition to Rogthefrog's database of typical responses,

    INSERT TypicalResponses VALUES("All hail the ternary operator, which would make that code easier to read!");
    INSERT TypicalResponses VALUES("The Ternary operator, contrary to it's intent, actually makes the code more difficult to read!");



  • (cs)

    He gave up when Rene Descartes Jr. replied, "Truth is how you define it."

    Man, that is just way too deep for a Monday.

    Now I need some pi.

    [pi]

  • (cs) in reply to limelight
    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.
  • (cs)
    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?
  • l (unregistered)

    Well, PHP has it's way of DWIM-ing whatever you do into the Wrong Thing, so I can half understand the guy.

  • (cs)
    Alex Papadimoulis:

    Naturally, he decided to talk to the new guy about it, explaining that the above code could be simplified with an OR, an AND, and no confusing $canProcess variable. His workmate shook his head, replying with "Yes, that may be so, but you don't want to build your logic based on the way PHP implements those."



    Maybe he was a VB programmer, and didn't know that pretty much every other language out there short-circuits their boolean operators??  ..maybe??
  • (cs) 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.

    1) Definitely amusing

    2) Scary

  • (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?


    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]
  • ZeoS (unregistered) 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 should've used the thernary operator :D
    <font size="1">(($ticketAmount < 1000  &&  $availableCredit >= $ticketAmount)  ||  $hasOverride)?</font><font size="1">ProcessTransaction($ticketId):</font><font size="1">RejectTransaction($ticketId);



    BTW: he has forgotten to check if
    </font><font size="1">ticketAmount is null. </font><font size="1"></font><font size="1"></font>
  • mjan (unregistered) in reply to boohiss
    Anonymous:
    Come again? You are saying there is zero correlation? So a group of 50 year old truck drivers is just as likely to program as effectively as a group of 25 year old CS majors?


    Well, given that a group of 50 year old truck drivers will probably not be convinced that they know everything right off the bat like your average CS grad, yes.

  • (cs) 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.


    My theory is that he needed to check this condition and set $canProcess = false in the else portion. At that point he felt that he had to put something in the if portion of the statement so he chose to set $canProcess = true again.
    Of course he could've just done
    if ($availableCredit < $ticketAmount)
        $canProcess = false;

    But since he is quite confused as it is and really not comfortable with these boolean operators, he either did not know how to do this or was worried that the truth might change on him.

    - Dan
  • (cs) in reply to boohiss
    Anonymous:
    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    Come again? You are saying there is zero correlation? So a group of 50 year old truck drivers is just as likely to program as effectively as a group of 25 year old CS majors?



    I'm not saying that at all, and if you think so maybe you should read a little more carefully.  You imply that I said that a group of truck drivers would correlate just just as closely as CS graduate in the skill of programming effectively.  I said no such thing.

    I'll defend my statement by working backward form the result.  Think of the programmers you've worked with who you would judge effective.  How many have CS degrees?  How many have other related degrees such as IS, MIS, SE, etc?  How many have math, science, or engineering degrees not directly related to computing?  How many have Arts or Humanities degrees? (I've found lots of music degrees)  How many have vocational certificates?  How many managed to get their first job then make their way on experience?

    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?

    Programming is a skill that is more likely to be learned from self-directed education and experience than any other route.

  • (cs) in reply to boohiss
    Anonymous:
    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.
    Come again? You are saying there is zero correlation? So a group of 50 year old truck drivers is just as likely to program as effectively as a group of 25 year old CS majors?


    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!
  • (cs)

    This hurts my eyes.  2 minute rant and rave
    Ah - that felt good.

  • (cs) in reply to RevMike
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I thought that was the guys from Purdue are stupid flamewar.

  • (cs) in reply to christoofar

    christoofar:
    Anonymous:
    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.
    Come again? You are saying there is zero correlation? So a group of 50 year old truck drivers is just as likely to program as effectively as a group of 25 year old CS majors?


    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!

    Are you sure that her lapdancing skills didn't bias your evaluation of her Boolen logic skills?

  • (cs) in reply to christoofar
    christoofar:

    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!


    I would guess that talented bookkeeper or accountant  would have a decent chance at being able to program.  They already have some understanding about how to build a process that transforms information by some set of rules, aka an alogrithm.  So the key is to teach them our methods of expressing that process.

    I'm not saying it would be a trivial transition, but I'd bet it is very doable.
  • giannis (unregistered)

    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?

  • (cs) in reply to JohnO

    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 +. 

    All of us expert programmers here at TDWTF know, of course, that you use parens to explicitly indicate this whenever you combine AND and OR's in a boolean expression, and thus you never have an issue .... 

    ... so, maybe he was aware of the operator precedence issue, didn't know the spec for PHP, and he didn't know how to use parens to work around it?

    (grasping at straws as to what the heck he might have been thinking)

  • (cs) in reply to JohnO
    JohnO:

    Are you sure that her lapdancing skills didn't bias your evaluation of her Boolen logic skills?

    The boolean is randomly set to true or false, so there can be no bias.

     

  • (cs) in reply to RevMike
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I disagree.  If you had two people with 0 coding experience (aside from their degree-related work), one with a C.S. degree the other w/o, all other things being equal, I'll take the C.S. grad every time.

  • (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?


    No, because you reduce the lines of code,

    more lines means you make more money
  • (cs) in reply to christoofar

    christoofar:

    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!

    That could be a very handy mix of skills when it comes time for a tax audit, but I suspect that your refund would all be in singles.

    Seriously, however, this looks the work of a true beginner.  He has thought his way through the logic, and seems to have it all mapped out so it works.  He does not, however, seem to have a grasp on the finesse we have all developed over the years.  The only WTF I can see is why this is here?  Deriding an beginner's CORRECT, albeit in-efficent, logic is a little tacky to say the least.

    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.

  • (cs) in reply to kipthegreat

    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

  • (cs) in reply to A Wizard A True Star
    A Wizard A True Star:
    JohnO:

    Are you sure that her lapdancing skills didn't bias your evaluation of her Boolen logic skills?

    The boolean is randomly set to true or false, so there can be no bias.

    Either Christoofar is bisexual or I don't understand your reply.

  • giannis (unregistered) in reply to giannis
    Anonymous:
    I wonder if Miguel Arguelles had shown Rene Descartes Jr. the right implementation, which is:
    if ($ticketAmount < 1000 && 
    $availableCredit >= $ticketAmount &&
    $hasOverride)
    ProcessTransaction($ticketId);
    else
    RejectTransaction($ticketId);


    Then what would his answer be?



    Something's wrong with the design editor, it messed up my pre code, and where's the preview button? and why that captcha doesn't work right? wtf did the developers of this forum were smoking when they wrote it?

  • (cs) in reply to JohnO
    JohnO:
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I disagree.  If you had two people with 0 coding experience (aside from their degree-related work), one with a C.S. degree the other w/o, all other things being equal, I'll take the C.S. grad every time.



    On paper the CS grad will have, or at least should, a better understanding of what is required to make a program but give them two weeks time and it may not matter.
  • Swede (unregistered) in reply to giannis

    Following up on the CS flame war... Did you know that up here in Sweden anyone who majors in Usability automatically can title themselves Usability Experts? Oh, dear...

  • (cs) in reply to Xepol
    Xepol:

    christoofar:

    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!

    That could be a very handy mix of skills when it comes time for a tax audit, but I suspect that your refund would all be in singles.

    Seriously, however, this looks the work of a true beginner.  He has thought his way through the logic, and seems to have it all mapped out so it works.  He does not, however, seem to have a grasp on the finesse we have all developed over the years.  The only WTF I can see is why this is here?  Deriding an beginner's CORRECT, albeit in-efficent, logic is a little tacky to say the least.

    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.

     

    I agree that we've all probably written some crappy code not understanding the fundamentals at some point, but I think the WTF here is not necessarily the code (as it could be a JR dev) but that when approached the dev did not listen to a more senior dev's suggestion.  He should have been more interested in what the senior dev had to say, maybe go home and read up on it a bit more and thereby increase his understanding and efficiency as a dev.  Just firing back with a stupid retort is a sign that this dev will never become a good dev.

  • (cs) in reply to JohnO
    JohnO:
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I disagree.  If you had two people with 0 coding experience (aside from their degree-related work), one with a C.S. degree the other w/o, all other things being equal, I'll take the C.S. grad every time.



    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?
  • ZeoS (unregistered) 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



    I thought the same first, but what if 99% of the times hasOverride is false?
  • (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



    On the other hand, I'd assume that an override is a rare occurance.  Why evaluate it first in an OR expression when it will rarely be true.  Better to let it only be evaluated if the first part fails.
  • (cs) in reply to Xepol
    Xepol:

    christoofar:

    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!

    That could be a very handy mix of skills when it comes time for a tax audit, but I suspect that your refund would all be in singles.

    Seriously, however, this looks the work of a true beginner.  He has thought his way through the logic, and seems to have it all mapped out so it works.  He does not, however, seem to have a grasp on the finesse we have all developed over the years.  The only WTF I can see is why this is here?  Deriding an beginner's CORRECT, albeit in-efficent, logic is a little tacky to say the least.

    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.

    I would agree.  A classic "WTF" is something so convoluted, so crazy, so twisted that a sane person can barely comprehend it.  Oh, and often you do literally say to yourself "WTF" ...

    This might not be good code, but it's not a WTF.  I guess it's OK for a Monday.  There is a key difference between a "WTF!" and code that could simply be made shorter/optimized/tweaked.

  • (cs) in reply to Xepol
    Xepol:

    christoofar:

    I worked with an ex-stripper in Texas who could code very well, she only had a BBA and a lot of years as a bookkeeper.

    She knew Boolean logic [AND] lap dances!

    That could be a very handy mix of skills when it comes time for a tax audit, but I suspect that your refund would all be in singles.

    Seriously, however, this looks the work of a true beginner.  He has thought his way through the logic, and seems to have it all mapped out so it works.  He does not, however, seem to have a grasp on the finesse we have all developed over the years.  The only WTF I can see is why this is here?  Deriding an beginner's CORRECT, albeit in-efficent, logic is a little tacky to say the least.

    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.



    To me, the funniest thing is not the code but the conversation the Miguel had with the programmer after he debugged the code.
    The programmer's response shows a complete lack of understanding of what boolean operators are and how to use them. Even worse, he has not learned from his mistake and will probably write some code that does not work correctly before he figures this stuff out.
    A programmer's first few projects don't have to be elegant and my almost certainly were not. But you'd think that someone with a CS degree would have some understanding of boolean operators and how to use them. Either that or the programmer is outsmarting himself by not wanting to build his program "based on the way PHP implements those" [boolean operators].

    Either way, it is a pretty funny WTF.

    - Dan
  • (cs)

    Ow.  This approach is valid if you have some procedural foo in the middle that isn't amenable to being part of a compound if(), but that clearly isn't the case here.

    I'm amazed we haven't had any IsTrue() cracks yet.

  • ZeoS (unregistered) in reply to RevMike
    RevMike:
    JohnO:
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I disagree.  If you had two people with 0 coding experience (aside from their degree-related work), one with a C.S. degree the other w/o, all other things being equal, I'll take the C.S. grad every time.



    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?


    Just take a 30 minutes exam as a part of the interview!
  • BK (unregistered)

    Need to be fair.. in Smalltalk you can define true to equal "false" (0). Of course.. it is likely for the image to crater before you get too far.


  • Brent Seidel (unregistered)

    One thing that hasn't been mentioned yet (I think) is that $canProcess is uninitialised of $ticketAmount >= 1000.

    It could be true, false, or fileNotFound.

  • (cs) in reply to RevMike
    RevMike:
    JohnO:
    RevMike:
    Alex Papadimoulis:

    Miguel Arguelles' company recently hired a fresh graduate with a fairly good resume and high academic marks.



    Please tell us what his major was!  I'd really like to restart the "CS degree is (invaluable|worthless)" flamewar from the "guy who doesn't know hex" topic!

    Even if he wasn't a CS major, I'll start off the war anyway...

    There is no correlation, positive or negative, between having a CS degree and being able to program effectively.

    I disagree.  If you had two people with 0 coding experience (aside from their degree-related work), one with a C.S. degree the other w/o, all other things being equal, I'll take the C.S. grad every time.



    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 would pick the EE grad in that scenario but all that says is experience trumps education, especially when coupled with a rigorous degree such as EE.  Don't get me wrong, I have nothing against non-C.S. grads.  I started out as one.  But a good grad from a good C.S. program actually will have learned something valuable while they were there.

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

Log In or post as a guest

Replying to comment #:

« Return to Article