• (cs) in reply to someone
    Anonymous:
    Anonymous:
    first


    Dumb

    This guys ip should be banned

    Is this a first form or the daly wtf form?

    I agree that "first" posters should be banned, preferably for life.

    However, I also think that people who don't get punctuation, or are not able to spell "forum" or "daily", should also be banned. If I want to read crap like that, I can go to Myspace.
  • (cs) in reply to hobbes_dmS

    LAST!!!!

  • RichNFamous (unregistered) in reply to Justin

    Damn that Schrodinger guy - and his cat too!

  • anon (unregistered) in reply to MikeMontana
    MikeMontana:
    Without bashing the developer, I would really want to know why the developer really felt it was important to go this route. Absolutely, this is "wtf-code", but, someone actually sat down to think this out - I would have to ask myself "why didnt they see the circular logic in using a Bool, casting to a String, and checking the string result in a boolean fashion?"

    When I return a value of some type I don't pay much attention to, being a very careful programmer that doesn't want to be lazy with someone's outsurced code, I validate the result even if it might be unnecessary.
    Converting the result to a string and comparing it with the known possible values is an easy and universal way to validate data; the precise exception handling completes the validation.

    Of course this is wasted effort and it might have internationalization bugs, but all it takes to take this route is failure to recognize the easy case.
    It is merely a scaled up version of

    boolean b;
    ...
    if(b==true){...}


  • Guran (unregistered) in reply to hobbes_dmS

    Just thought I'd offer a somewhat plausible theory as to how this code came to be.

    When are you most tempted to use cheap outsourcing?
    For a time consuming, but well defined project, of course.

    One typical example of this would be to port an existing application to a new environment (i.e .NET)

    Perhaps this c# property is copied from some language which does not have proper booleans?
    Perhaps the original implementation used literal "true" and "false" for boolean values?

    In that case the original code surely must have checked for other values for the "boolean" values.

    Translate this to c# by copy-pasteing and make a semi-automatic translation and you might end up with this code.

    Then imagine that you are paid to write working code, not optimized code. Perhaps you won't even check the source code of your getter and setter. Just do some automated test:

    Getting and setting true and false booleans? Works!
    Setting a non-boolean value? Generates exception.

    OK, whats next?

  • (cs) in reply to WeatherGod
    WeatherGod:
    it would seem reasonable that since the .ToString() function is returning a value, then it has to exist in memory somewhere.  And since it exist in memory, it must have been created at some point, and I highly doubt C# would just keep static versions of the true/false strings just for the heck of it.

    So where do you think it's getting the value from, if not from a static version of the string?  Is it plucking it out of thin air, maybe?  Or perhaps the .NET runtime includes some cunning algorithm to generate the strings "True" and "False"?

    They're fucking constants.  That means they're stored statically in the runtime somewhere.  And they're immutable strings.  That means there's no reason to make a physical copy of them each time you assign them to a new variable.  Ergo, Boolean.ToString() has no reason whatsoever ever to create a new object, QED.
  • (cs) in reply to Iago
    Iago:
    WeatherGod:
    it would seem reasonable that since the .ToString() function is returning a value, then it has to exist in memory somewhere.  And since it exist in memory, it must have been created at some point, and I highly doubt C# would just keep static versions of the true/false strings just for the heck of it.

    So where do you think it's getting the value from, if not from a static version of the string?  Is it plucking it out of thin air, maybe?  Or perhaps the .NET runtime includes some cunning algorithm to generate the strings "True" and "False"?

    They're fucking constants.  That means they're stored statically in the runtime somewhere.  And they're immutable strings.  That means there's no reason to make a physical copy of them each time you assign them to a new variable.  Ergo, Boolean.ToString() has no reason whatsoever ever to create a new object, QED.


    The .net runtime sourcecode is meant to be protected by a NDA, but it's time to expose a little secret...
    public string ToString() {
      /* make sure our friends at Intel can sell lots of new CPUs */
      if (b) return "T".ToLower()+"R".ToLower()+"U".ToLower()+"E".ToLower();
      else return "F"+ToLower()+"A".ToLower()+"L".ToLower()+"S".ToLower()+"E".ToLower();
    }
  • huckfinn (unregistered)

    are you sure you didn't made this up?
    just to start a discussion you know
    about the life universe etc.

  • (cs) in reply to someone
    Anonymous:

    ...
    Is this a first form or the daly wtf form?

    When John won the USPGA in 1991, that was indeed a WTF?!?!?

    (Terrible pun, and I haven't read all replies yet... Shame on me!)
  • Hendrik (unregistered) in reply to Terry
    Anonymous:

    God, this guys a genious!  I wanna be like him when I grow up!


    Hm, interesting new verb, what would it mean?
  • (cs) in reply to Hendrik

    So, if I understand everyone, to summarize: there is a new Boolean type: BooleanFloat, implemented as a float, as follows:

    Range of allowed values: 0.0 <= x <= 1.0

    Initial defined values:
       0.0 = false
       1.0 = true

    Expansion values:
       0.2 = probably not
       0.5 = maybe
       0.8 = most likely
       etc.

    Future Expansion:
       -1.0 = File Not Found
        1.2 = NaB ([N]ot [A] [B]oolean)

    And for WTF coders:

       0.001 = "False"
       0.002 = "FALSE";
       0.999 = "True"
       0.998 = "TRUE";

    Leading to such code as (using "~=" to mean approximately equals):
       if (newAndImprovedFloatBoolean ~= 1.0) {
          // true 
       } else if (newAndImprovedFloatBoolean ~= 0.0) {
          // false
       } else if (newAndImprovedFloatBoolean == BooleanFloat.NaB) {
          // it's not a boolean at all
       } else ...

  • (cs) in reply to codeman

    Damn emoticons ...

    Make that: [ N ]ot [ A ] [ B ]oolean

  • konijn_ (unregistered) in reply to Anon

    >The Daily WTF zings Slashdot; Slashdot takes a shot at Digg.  What's next? Digg attacks Fark?

    And the BileBlog refers to the dailyWTF, I guess Hani should start providing us with TomCat WTF's.

     

    T.

  • (cs)

    I think this is a pretty good WTF, notwithstanding all the other comments to the contrary.  Let's see just how many WTFs there actually are here, just for the practice:

    1. Member variable not contained within the class (is it actually global?  This may be a C# thing, but it looks odd to a C++ guy like me)
    2. Conversion of booleans to strings for comparison
    3. get method performs various sanity checks, but returns the underlying value in the end no matter what (i.e. sanity checks are totally redundant)
    4. set method fails to trust its strongly typed input
    5. get method fails to trust redundant safety check in corresponding set method
    6. Redundant variable creation and assignment in set method
    7. Gratuitous argument exception thrown for strongly typed method
    8. Multiple return paths (really only a style preference)
    9. Sanity checks ignore limited range of input data (this may not be accurate if C# allows "null" for a bool)
    OK, so with a little bit of imagination, there are approximately 9 WTFs in 15 lines of code.  This is getting pretty close to the magic 1:1 ratio!

  • Bob (unregistered)

    Great example for showing why we all need to move towards Test Driven Development. If they had used TDD, they would have had 1/10th the code and no WTF.

  • (cs) in reply to VGR
    VGR:
    OneFactor:
    My first reaction was to say the code was complete developer-is-an-idiot crap. My second thought was the developer was being paid by the KLOC. But the name of the property, ISO9001, has me wondering. Could some manager have forced the developer to do this in the name ISO9001 compliancy? Or could this be a developer trying to be recursively funny and putting all this redundancy stuff in there because the property is name ISO9001.

    With any other property name, I'd call out WTF or KLOC. But I too am wondering if this is CMM 5 humor. Heck, I'd be tempted to do something like this in an attempt to bring humor into my life if I was forced to be ISO9001 compliant with no good reason.


    What you're proposing is reasonable.  But it violates Hanlon's Razor:

    http://en.wikipedia.org/wiki/Hanlon%27s_razor

    Even so, I can follow your logic.  The code does look like a smart-ass way to "test for every possible condition," perhaps in response to some reviewer who was not convinced that true and false are all of the possible conditions for a boolean.

    But, in accordance with Hanlon's Razor, and maybe even Occam's Razor, stupidity seems to be a more plausible explanation.

    Perhaps at one time, the property was declared as a string, and whoever changed it, well, wanted to change as little as possible.  That is very plausible, as I've seen people declare boolean attributes as strings and also as integers in both Java and C#.

    Hanlon's razor does wisely advise us to assume stupidity before malice. But the ISO9001 name has me wondering if this monstrosity is due not to stupidity or malice, but due in some twisted way to something much worse... the delusion of using ISO9001 compliancy to make things better.

  • (cs) in reply to Chaos_Engineer
    Anonymous:
    This actually makes sense. Probably the value is coming from user input, and he doesn't trust the calling program to validate data before calling the routine.

    Like maybe it's a web application and it's using calls like
     setISO9001.asp?company=yoyodyne&certified=true

    A malicious user could run "calc" and compute 0/0, which returns NaN ("not a number"). Then they could cut-and-paste to replace "true" with "NaN" and corrupt the database. (This is a subtle exploit that a lot of programmers don't seem to know about. If you pass the literal string "NaN", then it evaluates to "true" because it's non-zero. But if you run "calc" and copy over the representation of 0/0, then you've got a value that's zero and non-zero simultaneously.)

     

     the really scary thing is that you  are seeming to make sense .My friend, you should work in marketing. [6]

     But in XP, note that 0/0 returns "the result of this function is undefined"    

      

  • someoneYouKnow (unregistered) in reply to Tony M

    Booleans are so hard that C doesn't even have them in most compilers.

  • weekly WTF (unregistered) in reply to Wayne
    Anonymous:

    Is an applicatino one of the fundamental particles of computing?

    Best physics-themed typo bash EVER!

  • Dude (unregistered)

    There is nothing wrong here.  The author is validating the contents of a /string/ not a boolean, it's just returning a boolean.  When the string is "", "0" or some other invalid value, this code will handle it... though I'm not sure why return m_ISO9001 is there vs throw new ArgumentException.

  • SP (unregistered) in reply to naterkane

    i think you meant to say  "if a boolean isn't true or isn't not false, then we haven't got some bigger issues to address, yes?"

  • It is I (unregistered)

    The getter is actually interesting when multithreading is involved ... :)

  • codist (unregistered) in reply to It is I

    A better name for a float-boolean would be foolean.

  • (cs) in reply to stevekj
    stevekj:
    I think this is a pretty good WTF, notwithstanding all the other comments to the contrary.  Let's see just how many WTFs there actually are here, just for the practice:
    1. Member variable not contained within the class (is it actually global?  This may be a C# thing, but it looks odd to a C++ guy like me)
    2. Conversion of booleans to strings for comparison
    3. get method performs various sanity checks, but returns the underlying value in the end no matter what (i.e. sanity checks are totally redundant)
    4. set method fails to trust its strongly typed input
    5. get method fails to trust redundant safety check in corresponding set method
    6. Redundant variable creation and assignment in set method
    7. Gratuitous argument exception thrown for strongly typed method
    8. Multiple return paths (really only a style preference)
    9. Sanity checks ignore limited range of input data (this may not be accurate if C# allows "null" for a bool)
    OK, so with a little bit of imagination, there are approximately 9 WTFs in 15 lines of code.  This is getting pretty close to the magic 1:1 ratio!



    I think we should create our own new notation for measuring the "WTF-ness" of code, kind of like "Big O" notation.  We will call our notation "WTF", of course.

    So, for example, based on your analysis, this code was written at approximately WTF(.5).   As you mentioned, WTF(n) where n is anything close to (or even above!) 1 is truly an impressive accomplishment.

  • (cs) in reply to Dude
    Anonymous:
    There is nothing wrong here.  The author is validating the contents of a /string/ not a boolean, it's just returning a boolean.  When the string is "", "0" or some other invalid value, this code will handle it... though I'm not sure why return m_ISO9001 is there vs throw new ArgumentException.


    Dude ... I think you don't get it.  Dude.
  • asdadwwa (unregistered) in reply to Dude
    Anonymous:
    There is nothing wrong here.  The author is validating the contents of a /string/ not a boolean, it's just returning a boolean.  When the string is "", "0" or some other invalid value, this code will handle it... though I'm not sure why return m_ISO9001 is there vs throw new ArgumentException.
    Oh man...  This is a bigger WTF than the original WTF.
  • Bot (unregistered) in reply to asdadwwa
    Anonymous:
    Anonymous:
    There is nothing wrong here.  The author is validating the contents of a /string/ not a boolean, it's just returning a boolean.  When the string is "", "0" or some other invalid value, this code will handle it... though I'm not sure why return m_ISO9001 is there vs throw new ArgumentException.
    Oh man...  This is a bigger WTF than the original WTF.

    Obviously a generated reply.
  • (cs) in reply to Chris
    Anonymous:
    3- Ironic that the purpose of this POS code is to return whether ISO9001 quality standards are in effect. I would say based on the code, the answer to the question is always no.


    Ironic, but unfortunately, not surprising.

    ISO "quality" standards have very little to do with quality. If you do the same crap every time, and its documented, you're ISO-approved. So you could put the crap around every boolean, have a 20 page document explaining it and you'd pass your ISO audit with flying colours.


    One example I read was that if you manufactured life preservers filled with cement and your procedures were documented, you could still get ISO 9??? approval.

    Sincerely,

    Gene Wirchenko

  • (cs) in reply to Jeff S
    Jeff S:
    stevekj:
    I think this is a pretty good WTF, notwithstanding all the other comments to the contrary.  Let's see just how many WTFs there actually are here, just for the practice:
    1. Member variable not contained within the class (is it actually global?  This may be a C# thing, but it looks odd to a C++ guy like me)
    2. Conversion of booleans to strings for comparison
    3. get method performs various sanity checks, but returns the underlying value in the end no matter what (i.e. sanity checks are totally redundant)
    4. set method fails to trust its strongly typed input
    5. get method fails to trust redundant safety check in corresponding set method
    6. Redundant variable creation and assignment in set method
    7. Gratuitous argument exception thrown for strongly typed method
    8. Multiple return paths (really only a style preference)
    9. Sanity checks ignore limited range of input data (this may not be accurate if C# allows "null" for a bool)

    OK, so with a little bit of imagination, there are approximately 9 WTFs in 15 lines of code.  This is getting pretty close to the magic 1:1 ratio!



    I think we should create our own new notation for measuring the "WTF-ness" of code, kind of like "Big O" notation.  We will call our notation "WTF", of course.

    So, for example, based on your analysis, this code was written at approximately WTF(.5).   As you mentioned, WTF(n) where n is anything close to (or even above!) 1 is truly an impressive accomplishment.

    That sounds like a wonderful idea.

    Let's take a vote.  Everyone in favor of this new system cast 0.1 vote, opposed cast 0.98 vote

  • (cs) in reply to Dude

    Anonymous:
    There is nothing wrong here.  The author is validating the contents of a /string/ not a boolean, it's just returning a boolean.  When the string is "", "0" or some other invalid value, this code will handle it... though I'm not sure why return m_ISO9001 is there vs throw new ArgumentException.

    Dude,  When you type  property as a boolean, the value of the "value" keyword inside the property is guaranteed by the compiler to be the same type as the property is typed.  SO, when the user in this case says
    public bool ISO9001
    {
      get ....
    <FONT color=#000000>This means that everywhere inside the</FONT><FONT color=#000000> pproperty, value must be a boolean. and cannot be a string. If a user tried to type
    </FONT><FONT face="Courier New" color=#ff0000>objectvariable.ISO9001 = "TRUE";</FONT>

    The compiler would squawk
    "<FONT color=#ff0000>That property is a boolean. You can't set it to a string!</FONT>"

    That's why the author of this WTF had to write, in the setter..
         bool v_ISO9001 = value;
        //can only be true or false
        if (v_ISO9001.ToString().ToUpper() == "TRUE" ||
            v_ISO9001.ToString().ToUpper() == "FALSE")

    he had to type  v_ISO9001 as boolean because value is a boolean.  And he had to use ToString() on that because to compare it with the string "TRUE" he had to change the boolean to a string first, The whole thing is mind-bogglingly obtuse. 

  • (cs)

    No way, these are FANTASTIC consultants!  I mean, you never know when Microsoft, in their infinite wisdom, will determine that toString() of a boolean should return "rich" and "poop" instead of "true" and "false", or "britney" and "kevin", or "day" and "night".  I mean, this is future-proofing to the EXTREME!

    I for one salute our new boolean overlords.

    Trying to be remotely serious for just a moment... I don't know much about C#, I didn't even know bool was an object type that you could call a method on, but OK, that seems cool.  Could a developer subclass bool?  If they could, then it kind of makes sense... what if the value passed in is a subclass of bool that doesn't return "true" or "false"?  Assuming you could do all that, and I don't know if you can or not, it seems like the person making the call should be slapped, not so much the consultant being so anal as to check for it (sometimes anal is good... this doesn't strike me as one of those places, but then again, if this were code for a Mars probe, I'd expect this wouldn't be considered even remotely anal, right?)

  • verisimilidude (unregistered) in reply to MikeMontana
    MikeMontana:
    Without bashing the developer, I would really want to know why the developer really felt it was important to go this route. Absolutely, this is "wtf-code", but, someone actually sat down to think this out - I would have to ask myself "why didnt they see the circular logic in using a Bool, casting to a String, and checking the string result in a boolean fashion?"


    The developer is probably some just-out-of school kid who has learned (primarily) to respect your superiors and not question what you are told.  He was told that every subroutine he coded had to check validity of parameters.  They didn't tell him how and he knew better than to ask (causes loss-of-face, possibly embarasses the big-boss who made up the silly rule).  So you sit down and code it following the rules.

    As this guy moves up the chain after being forced to write code like this we of the modern democracies can hope that he remembers that respect for 'betters' is a concept fraught with peril.  Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.
  • (cs) in reply to verisimilidude
    Anonymous:

    Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.

    Is that really true?

  • Ithryn (unregistered) in reply to ParkinT

    0.1

    Totally agree

  • (cs) in reply to codeman
    codeman:
    Anonymous:

    Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.

    Is that really true?



    3rd Cod War - UK vs Iceland 1975-6. According to http://www.britains-smallwars.com/RRGP/CodWar.htm, a few shots were fired, and there was some ramming.
  • (cs) in reply to fzammetti
    fzammetti:

    No way, these are FANTASTIC consultants!  I mean, you never know when Microsoft, in their infinite wisdom, will determine that toString() of a boolean should return "rich" and "poop" instead of "true" and "false", or "britney" and "kevin", or "day" and "night".  I mean, this is future-proofing to the EXTREME!

    I for one salute our new boolean overlords.

    Trying to be remotely serious for just a moment... I don't know much about C#, I didn't even know bool was an object type that you could call a method on, but OK, that seems cool.  Could a developer subclass bool?  If they could, then it kind of makes sense... what if the value passed in is a subclass of bool that doesn't return "true" or "false"?  Assuming you could do all that, and I don't know if you can or not, it seems like the person making the call should be slapped, not so much the consultant being so anal as to check for it (sometimes anal is good... this doesn't strike me as one of those places, but then again, if this were code for a Mars probe, I'd expect this wouldn't be considered even remotely anal, right?)


    To answer yr question about subclassing, - the answer is No,  Bool is a value type, and in .Net, value types are intrinsically sealed. (They cannot be used as a base Type)   

         This is because value types, (unlike reference types),  are stored on the stack, (in a method's stack frame), with only their internal state. They do not have an object header, like a reference type, on the heap, which is where a reference type stores the pointer to it's Type's data structure... 

  • (cs) in reply to Alistair Wall
    Alistair Wall:
    codeman:
    Anonymous:

    Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.

    Is that really true?



    3rd Cod War - UK vs Iceland 1975-6. According to http://www.britains-smallwars.com/RRGP/CodWar.htm, a few shots were fired, and there was some ramming.

    And is Argentina democratic?  If so, then the Falklands conflict counts too...
  • (cs) in reply to Bullet
    Bullet:
    Alistair Wall:
    codeman:
    Anonymous:

    Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.

    Is that really true?



    3rd Cod War - UK vs Iceland 1975-6. According to http://www.britains-smallwars.com/RRGP/CodWar.htm, a few shots were fired, and there was some ramming.

    And is Argentina democratic?  If so, then the Falklands conflict counts too...


    It is now, but it wasn't then.
  • Dustman (unregistered) in reply to verisimilidude
    Anonymous:
    Remember, in the last 200 years there has never been a war between two countries that both had the ability to vote the leaders out of office.


    Indeed. Democratically elected politicians usually know better than to lead their countries into war. They bring interventionist forces to bear on an international police action. Much better!

    Besides, I can't think of any countries where the public gets to decide when to throw a guy out of office. Occasionally, a time comes when we get to vote a guy in...
  • (cs) in reply to Dustman
    Anonymous:
    I can't think of any countries where the public gets to decide when to throw a guy out of office.


    There was a recall election in California not so very long ago.
  • John Hensley (unregistered) in reply to Bob
    Anonymous:
    Great example for showing why we all need to move towards Test Driven Development. If they had used TDD, they would have had 1/10th the code and no WTF.

    ...except for this post.

    TDD glorifies incompetence and should be destroyed wherever it is found.

  • Bill Gates (unregistered) in reply to krftsman

    I tried it in Mono and it works as expected, if you give an integer to this bool property, the compiler refuses to do its job, tha's why converting value to bool in the "set" is useless. The property is defined as giving back a bool (with "public bool ISO... {") but it also means that the value has to be a bool too.

  • (cs) in reply to John Hensley
    Anonymous:
    Anonymous:
    Great example for showing why we all need to move towards Test Driven Development. If they had used TDD, they would have had 1/10th the code and no WTF.
    TDD glorifies incompetence and should be destroyed wherever it is found.

    Could you please explain the logic -- if any -- behind this declaration?
  • (cs)

    I'm amazed at the depth and breadth of knowledge (displayed here in the many comments) on the immensely complicated topic of truth in programming.

    I doubt there is anything I could add that hasn't already been said.  But for the benefit of any *novice* programmers who might find this all a bit perplexing, let me take this opportunity to recommend the excellent book "TRUE In A Nutshell".  While the book has an obvious Unix focus, it addresses most of the issues pertinent to ANY application of TRUE.

    Note: In light of ISO9001, this book may be in need of a revision.  

     

  • John Hensley (unregistered) in reply to masklinn
    masklinn:
    Anonymous:
    Anonymous:
    Great example for showing why we all need to move towards Test Driven Development. If they had used TDD, they would have had 1/10th the code and no WTF.
    TDD glorifies incompetence and should be destroyed wherever it is found.

    Could you please explain the logic -- if any -- behind this declaration?

    Sure.
    1. "Program testing can be used to show the presence of bugs, but never to show their absence." -- Dijkstra. You cannot rely on tests to tell you when a program is complete.
    2. To see what can happen when a programmer hacks away at a program until it passes in-house tests, read this: http://courses.cs.vt.edu/~cs3604/lib/Therac_25/Therac_1.html (note that there are more pages)
    3. Authors are promoting TDD like it's revolutionary idea that hasn't been appreciated before. Actually, it's the technique that new programmers use when they don't have a clue, and in the 1960s and 70s Dijkstra, Gries, and Mills all "appreciated" it for what their experience showed it to be: a horribly unreliable way to write software. They developed better techniques that are well-documented and that programmers ought to be using.
    4. Despite this, writers on TDD like Robert Martin seek to brain-damage new programmers with the belief that the developments of the 60s and 70s are irrelevant and that TDD is the way to go, as in this exerpt from a student-"teacher" dialogue on Martin's web site.

    “The program works, so I’m writing the unit tests.” I replied.
    “Why do you need unit tests if the program already works?” he said?
    I hadn’t thought of it that way. I just knew that you were supposed to write unit tests. I ventured a
    guess: “So that other programmers can see that it works?”
    Jerry looked at me for about thirty seconds. Then he shook his head and said: “What are they teaching
    you guys in school nowadays?”

    Well Bob, they're teaching us to program, not to bang a rock on the keyboard until the tests work. That's what I mean by "glorifying incompetence."

  • (cs) in reply to John Hensley
    Anonymous:
    masklinn:
    Anonymous:
    Anonymous:
    Great example for showing why we all need to move towards Test Driven Development. If they had used TDD, they would have had 1/10th the code and no WTF.
    TDD glorifies incompetence and should be destroyed wherever it is found.

    Could you please explain the logic -- if any -- behind this declaration?

    Sure.
    1. "Program testing can be used to show the presence of bugs, but never to show their absence." -- Dijkstra. You cannot rely on tests to tell you when a program is complete.
    2. To see what can happen when a programmer hacks away at a program until it passes in-house tests, read this: http://courses.cs.vt.edu/~cs3604/lib/Therac_25/Therac_1.html (note that there are more pages)
    3. Authors are promoting TDD like it's revolutionary idea that hasn't been appreciated before. Actually, it's the technique that new programmers use when they don't have a clue, and in the 1960s and 70s Dijkstra, Gries, and Mills all "appreciated" it for what their experience showed it to be: a horribly unreliable way to write software. They developed better techniques that are well-documented and that programmers ought to be using.
    4. Despite this, writers on TDD like Robert Martin seek to brain-damage new programmers with the belief that the developments of the 60s and 70s are irrelevant and that TDD is the way to go, as in this exerpt from a student-"teacher" dialogue on Martin's web site.

    “The program works, so I’m writing the unit tests.” I replied.
    “Why do you need unit tests if the program already works?” he said?
    I hadn’t thought of it that way. I just knew that you were supposed to write unit tests. I ventured a
    guess: “So that other programmers can see that it works?”
    Jerry looked at me for about thirty seconds. Then he shook his head and said: “What are they teaching
    you guys in school nowadays?”

    Well Bob, they're teaching us to program, not to bang a rock on the keyboard until the tests work. That's what I mean by "glorifying incompetence."



    Reading your post, it nearly looks like unit tests are evil. But this is not true and I think it is not what you meant. I aggree that the acceptance of a program should not rely solely on automatic tests, but they are a great tool to find bugs a human tester might overlook(*), and they are usefull to check if changes have undesired side effects.

    (*) A carefull tester with a very detailed testing script is not likely to overlook bugs, but the effort to write such a script is identical to writing the unit test, and the computer's work is cheaper than the tester's.
  • (cs) in reply to xcor057

    This must be quantum physics!

  • (cs) in reply to revlisoft
    revlisoft:
    This must be quantum physics!

    No, it isn't. The superposition in quantum physics delivers more predictable results.
  • John Hensley (unregistered) in reply to ammoQ
    ammoQ:

    Reading your post, it nearly looks like unit tests are evil. But this is not true and I think it is not what you meant.

    It's not what I meant. Unit tests are important to verify, after you have written code, that your reasoning and your typing are correct. But passing unit tests should never be the driving goal of development in a professional setting, as Martin would have it. The goal should be reliable solution. And the place to educate yourself to the point where you can program well enough to do that is the home or classroom, not the office.

  • LibertyToad (unregistered)

    Wow, and only 3 seperate exit points in the get property?  Talk about unstructured code, sheesh. I love seeing 1960's style code in an object oriented language....

Leave a comment on “Outsourced Property Value”

Log In or post as a guest

Replying to comment #:

« Return to Article