• (cs) in reply to dubwai
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.


    This is an example of an Accident Fallacy
    http://en.wikipedia.org/wiki/Accident_%28fallacy%29
  • (cs)

    OK, since nobody else seems to have done so, I'll make some sort of attempt at playing defend-the-WTF.

    This code is a joke.

    I first thought so when I saw the reference to Random(); I was further convinced when I saw the comment mentioning "bias". Values that are neither True nor False get randomly evaluated as one or the other, like Schroedinger's Boolean Variable (both true and false until you evaluate it).

    But I was absolutely certain this guy was joking around when I saw the comment at the end of IsTrue noting that one could tell if a value was false by use of the 'not' operator, and directing curious readers to the manual.

    This code is silly. This code is inefficient. Within my limited understanding of Object Pascal, this code even works correctly. The code is abnormally well-documented. And nobody who knows anything about the language should know NOT to use these functions. Face it, this code was intentionally written to make the reader laugh. The real WTF would be if someone actually used these functions in something important.

    Based on the limited description of Jed in the OP -- very brilliant, wrote a lot of wacky code, and had trouble staying focused on the topic at-hand -- my guess would be that Jed has ADD but is not being formally medicated; I know, because I myself have ADD and when I'm unmedicated, that's what I'm like. He probably needed to consume a lot of (soda|coffee|cigarettes) to manage to function at all.

    Two diverging theories come to me at this point:

    1. Also note the dates in the OP: August 29th (no year given) is the date of Jed's so-called 'de-hiring'. Amazingly enough, these three functions are dated August 26th, 2003. My guess is that the 'de-hiring' was three days later, on August 29th, 2003 (a Friday, which I believe is usually the most common day-of-the-week people are let go). If Jed was as bright as he seemed, he may have actually been aware of the impending event, and so wrote some extremely wacky code just for the hell of it -- if he was gone in 3 days, why should he care?

    2. If my ADD theory is correct, then based on personal experience, Jed probably had a serious problem with thinking things through before actually doing them. In this scenario, he may or may not have known about any impending termination; it probably would have occured to him 'wouldn't it be funny if there were some more useless functions** in this language?'** He never would have stopped to think 'maybe this should not be placed into production code.'

    ** From memories that are now many many years old, I can recall the following built-in functions in Pascal. Determine their worth for yourself.

    Odd(x : integer) - True if x is an odd number; False if it is even. Succ(x) - Returns x + 1 Pred(x) - Returns x - 1 And don't forget these gems, leftover from a 16-bit world: Swap(x) - Returns x with the two low-order bytes swapped (e.g. Swap($1234) returns $3412) Hi(x) - Returns the second-to-low-order byte value of x (e.g. Hi($1234) returns $12) Lo(x) - Returns the low-order byte value of x (e.g. Lo($1234) returns $34)

    --

    As broken as the Preview function was, at least it gave me a reasonable chance at proofreading my posts. Oh well, here goes...

  • desi programmer (unregistered) in reply to Jake Heidt

    nope. He exceeds 'Indian programming' standards.  Over qualified.

  • (cs) in reply to Gene Wirchenko

    You know, I'm curious. Why isn't isTrue ALWAYS recursive? When Result is assigned, does it automatically return?

  • (cs) in reply to Mike K.
    Anonymous:
    "bContinue"? And you're from the philadelphia area? Please, PLEASE give me this person's initials! I worked with a bunch of incompetent morons about 5 years ago whose code was riddled with "bContinue".


    Mike:

    There were two of them.  ZM is the C++ one and JP was the VB one.  Both guys were following the same kind of pattern to do a single exit point functions (and return a meaningless result, with errors being redirected to the database to be logged).
  • (cs) in reply to dubwai
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.

    I certainly hope you are joking. Your not another follower of the single exit point religion are you? Thought they all got the torch years ago.

  • tim (unregistered) in reply to dubwai

    I assume you're being silly, but just in case you aren't... virtually any conditional-execution language construct will have to use the concept of a "goto". Try telling a processor to do something useful without using j* instructions (i.e., some mnemonic from the jmp family).

    "if(a) {b}" means "test a; jz past_b; b; past_b: ...", for example.

    Throwing exceptions are "goto"s, too, if you use that style of thinking. However, I agree with avoiding mid-function returns where possible.

    Now that I've taken the bait and written this post, I'm certain it was in reply to sarcasm.

  • Brace Parenstar (unregistered) in reply to Oliver Klozoff

    This code is silly. This code is inefficient.


    Yeah, and not only that, he uses extra Begin-End blocks in every routine. Everyone knows that just slows down the compiler and leads to bloating of the exe. What a tool-loser!


  • David Wolever (unregistered)

  • (cs) in reply to Gene Wirchenko

    Even that's not good enough.  True and false = false. 

    You'd need to switch it up. 

    Equal treatment for True or False!  Equal treatment for False and True!

  • (cs) in reply to Zorlen

    Zorlen:
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.
    I certainly hope you are joking. Your not another follower of the single exit point religion are you? Thought they all got the torch years ago.

    Let me pull out the scripture:

    [blockquote]And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    Let he that cause offense to the lord be punished with bludgeoning and shown to the world that he is an non-believer.  Let the faithless not shake your adherence to his word.  Do not be tempted by the devil of gotos to add an exit in the middle of a method, no matter how much more sensible it be, for the path to unstructured programming is paved with good intentions.[/blockquote]

    Like I said: QED.

     

  • (cs) in reply to Maurits

    Maurits:
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.


    This is an example of an Accident Fallacy
    http://en.wikipedia.org/wiki/Accident_%28fallacy%29

    Really?  You give it that much credit?

  • (cs) in reply to dubwai
    dubwai:

    Zorlen:
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.
    I certainly hope you are joking. Your not another follower of the single exit point religion are you? Thought they all got the torch years ago.

    Let me pull out the scripture:

    [blockquote]And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    Let he that cause offense to the lord be punished with bludgeoning and shown to the world that he is an non-believer.  Let the faithless not shake your adherence to his word.  Do not be tempted by the devil of gotos to add an exit in the middle of a method, no matter how much more sensible it be, for the path to unstructured programming is paved with good intentions.[/blockquote]

    Like I said: QED.
     


    Isn't the next verse...

    And the path to structured programming is paved with maintainable, understandable and extensible code.

    Amen!

  • (cs) in reply to dubwai
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.

  • (cs) in reply to zephc

    zephc:
    I tihnk this guy is most closely the Alex Chiu (http://alexchiu.com/) of programming

    <FONT face="Courier New" size=2>"Well, do we always have to be within the scope? Another word, must we always do ... what has already been done? Can't we be pioneers? Can't we be a little more creative? We are living in the 90's. Everyone should carry an open mind. I mean, what is a six years college education for? For money? So that you can have a good life? I think its more than that. Can we not invent a new technology to explore the universe? Teleportation not only can solve problems for the growing human population, it also is the only liberator of mankind. Imagine unlimited natural resources and living space! Without it, humans will fight until the end for limited properties and resources and end up destroying this planet. Do you like blood shed...from your own children, or from your family? Do you feel safe to walk on the streets.... knowing that one day you will be innocently shot be terrorists?" - alex chiu</FONT>

  • (cs) in reply to ammoQ
    ammoQ:
    dubwai:

    What do you mean?  How else are you going to ensure your 500 line method has a single exit point?



    Use a *heavenbeware* GOTO? Throw the same exception at the end of every possible execution path? BTW: What's the reason for trying to have a single exit point?  It kind of forces you to write smaller methods, which is mostly a good thing; but if you keep your large methods and fill them with lots of nested ifs, magic bContinues or similar your code will hardly be more readable.


    Did you just notice something going "wooosh"? I think it was irony flying right over your head.
  • (cs) in reply to Zorlen
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.



    I don't think they're dubwai's followers, but Dijkstra's.  I'm sure you've read Go to statement considered harmful, but if not here's the link.

    http://www.acm.org/classics/oct95/

    Beleive it or don't, as for me an my house we will follow Dijkstra.
  • (cs) in reply to Zorlen
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.

    Oh my followers are still great in number.  Soon we will all go up heaven's chimney to visit our great-grandfather in the sky.  We will drink from the razzleberry waterfall while you and your unbelievers will be suffering in the torrment of unprovable code!!!

  • Striker (unregistered) in reply to Oliver Klozoff

    >OK, since nobody else seems to have done so, I'll make some sort of attempt at playing defend-the-WTF.
    >This code is a joke.
    *snip*

    Hear, hear!  If everyone would just turn their senses of humour up a notch and their "let's be as anal as we can and point out all the ways we're better than everyone else" egos down a notch the world would be a better place. 

    Had I come across this code on a particularly boring Wednesday morning in January it would have brought a smile to my face.  Cheers Jed.

  • (cs) in reply to Oliver Klozoff
    Oliver Klozoff:
    OK, since nobody else seems to have done so, I'll make some sort of attempt at playing defend-the-WTF. This code is a joke. I first thought so when I saw the reference to Random(); I was further convinced when I saw the comment mentioning "bias".


    I agree. It's not uncommon for people who don't really understand boolean expressions to write stuff like

    if(expression == true) {
        return true;
    } else {
        return false;
    }

    But this code goes so ridiculously far beyond that that it can't be anything but a joke.

  • (cs) in reply to bugsRus
    bugsRus:
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.



    I don't think they're dubwai's followers, but Dijkstra's.  I'm sure you've read Go to statement considered harmful, but if not here's the link.

    http://www.acm.org/classics/oct95/

    Beleive it or don't, as for me an my house we will follow Dijkstra.

    Yeah, and Aristotle too.  "The earth revolves around the Sun": what fool is buying into that one?  I mean, once you've got one idea about something, there's no need to think about it again.

  • (cs) in reply to christoofar

    christoofar:
    Anonymous:
    "bContinue"? And you're from the philadelphia area? Please, PLEASE give me this person's initials! I worked with a bunch of incompetent morons about 5 years ago whose code was riddled with "bContinue".


    Mike:

    There were two of them.  ZM is the C++ one and JP was the VB one.  Both guys were following the same kind of pattern to do a single exit point functions (and return a meaningless result, with errors being redirected to the database to be logged).

    Hi christoofar,

    Pleased to meet you.  Glad to hear my code is in such good hands.  Oliver Klozoff and I used to go back and forth on this issue all the time (you do know both you guys work for the same company, right?).  I'm comfortable defending my design decisions; there were reasons.  This was one of the few areas where "Oliver" and I disagreed -- normally, I bowed to his superiority, and I mean that sincerely.

    Maybe my approach on this has become "old school" and there are better ways of handling returns, but if you know the whole history of the system you're now supporting, you know that there were some very serious memory leaks that needed to be tracked down, some of them due to procedures that would instantiate objects and then return on errors (or for arbitrary reasons) without cleaning up.  I eliminated many of these by explicitly enforcing a single cleanup-and-exit point per procedure.  I'd be happy to debate whether or not that's ultimately a good idea, but again, I'm comfortable with the decisions I made and the results I got.

    Your "strongly encouraged" to leave comment, though, and your implication that ZM was terminated for cause, are off-base.  Unless you mean I was strongly encouraged to leave by the fact that the place had become a managerial cesspool.  And ZM was "terminated" along with 32 other employees (out of 45, not including me) on the same day.  I'd never seen a company get so f'ed over by incompetent management before.  I'm still pretty tight with TW, though.  Perhaps you could ask him to explain things.  Hopefully things are improving there.  Heck, I still own stock.

    -- JP

     

  • (cs) in reply to Zorlen

    Zorlen:
    dubwai:
    Gotos are bad.  Returning from the middle of a method is a goto.  QED.
    I certainly hope you are joking. Your not another follower of the single exit point religion are you? Thought they all got the torch years ago.

    <FONT face="Courier New" size=2>if you think back to the mentalities of the past, i'm sure the single exit point philosophy stemmed out of the common practice of having 1000-2000+ line "routines" that would do several dozen things at the same time.  you run your debugger, you look at the stack, and see that some of the values aren't right.  so just before that single exit point, you can apply some transformations, integrity checks, etc. to the data before sending it off.  if you have multiple exit points, you'd have to duplicate that work, or make multiple calls to functions.  so, a single exit point was considered good style.</FONT>

    <FONT face="Courier New" size=2>remember that during this time, neck beards, aviator glasses, pompadours, and disco were in style.  additionally, if a youth on a skateboard was clotheslined by a chain, you could directly apply two fingers to the jugular and not worry about AIDS.  they also made that really weird bond movie with the voodoo.</FONT>

  • (cs) in reply to emptyset
    emptyset:

    <FONT face="Courier New" size=2>remember that during this time, neck beards, aviator glasses, pompadours, and disco were in style.  additionally, if a youth on a skateboard was clotheslined by a chain, you could directly apply two fingers to the jugular and not worry about AIDS.  they also made that really weird bond movie with the voodoo.</FONT>

    Is it possible that neck-beards are going to come back into style?  I don't have much facial hair but my neck is like a forest.

  • (cs) in reply to dubwai
    dubwai:
    bugsRus:
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.



    I don't think they're dubwai's followers, but Dijkstra's.  I'm sure you've read Go to statement considered harmful, but if not here's the link.

    http://www.acm.org/classics/oct95/

    Beleive it or don't, as for me an my house we will follow Dijkstra.

    Yeah, and Aristotle too.  "The earth revolves around the Sun": what fool is buying into that one?  I mean, once you've got one idea about something, there's no need to think about it again.



     Hey!  I'm on your side!  And where did you get the idea that this hasn't been thought about again?  All the arguments have been argumentum ex silentio.  Debate and thought are always good, however, something needs to be debated, not just "Still amazes me..." without substance.  So, zorlen, what amazes you about people still believing this?  Gotos, except in assembly, ARE a bad thing.
  • David Knaack (unregistered) in reply to Brace Parenstar
    Anonymous:
    > This code is silly. This code is inefficient.
    Yeah, and not only that, he uses extra Begin-End blocks in every routine. Everyone knows that just slows down the compiler and leads to bloating of the exe. What a tool-loser!


    He uses that begin-end block technique very often, along with nested routines (sometimes three deep, nested routines with nested routines with nested routines), probably with the intention of readability.  Without getting into a discussion of elegant ways to format pascal code, I disapprove.  As the above notes, the compiler doesn't care either way.

    Oliver Klozoff:
    OK, since nobody else seems to have done so, I'll make some sort of attempt at playing defend-the-WTF. This code is a joke. I first thought so when I saw the reference to Random();


    I'd have thought that your first hint would be my comment in the submission: 'this masterpiece of programming humor'.

    Oliver Klozoff:
    The code is abnormally well-documented.

    It's actually significantly less commented than the code I write, but my comments explain what I intended the code to do and why.

    Are you suggesting that the fact that a peice of code is well-documented indicates that it might be a joke?  WTF?

    Oliver Klozoff:
    Based on the limited description of Jed in the OP -- very brilliant, wrote a lot of wacky code, and had trouble staying focused on the topic at-hand -- my guess would be that Jed has ADD but is not being formally medicated; I know, because I myself have ADD and when I'm unmedicated, that's what I'm like.


    Hm, I know some ADD people and I'm not sure he fits the bill.  It's possible, but I think its more likely that he's just one of those quirky, interoverted types with weird sense of humor and not enough ability to focus on distasteful tasks.

    Oliver Klozoff:
    Two diverging theories come to me at this point: 1. Also note the dates in the OP: August 29th (no year given) is the date of Jed's so-called 'de-hiring'. Amazingly enough, these three functions are dated August 26th, 2003. My guess is that the 'de-hiring' was three days later, on August 29th, 2003 (a Friday, which I believe is usually the most common day-of-the-week people are let go).

    Correct.  I checked the CVS repository to verify that the dates in the procedure headers are realistic.  The code was submitted on the 29th.

    Oliver Klozoff:
    If Jed was as bright as he seemed, he may have actually been *aware* of the impending event, and so wrote some extremely wacky code just for the hell of it -- if he was gone in 3 days, why should he care?

    Guarenteed he had no idea that he would be leaving the company in short order.

    Anyway, I hope I've not given the idea that I disliked 'Jed'.  From my work with him I think that he has a lot of potential to become a really top-notch programmer if he can develop some good coding techniques.  His sense of humor is a bit Kaufman-esque, but ya just have to know how to appreciate it.  If the original author does happen to run across this submission I hope he can take it as appreciation of the joke and as strong incentive to reconsider his coding technique.
  • (cs) in reply to Rudy Velthuis
    Anonymous:
    > I hope it wasn't this JED http://www.jed-software.com/
    >
    > He contributes a lot to the Delphi community.

    Very unlikely. Jeremy North is in Australia.

    Sooner or later, Jed will have to escape to Australia or risk being tarred-and-feathered by less-forgiving coworkers.

  • (cs) in reply to bugsRus
    bugsRus:
    dubwai:

    Yeah, and Aristotle too.  "The earth revolves around the Sun": what fool is buying into that one?  I mean, once you've got one idea about something, there's no need to think about it again.



     Hey!  I'm on your side!  And where did you get the idea that this hasn't been thought about again?  All the arguments have been argumentum ex silentio.  Debate and thought are always good, however, something needs to be debated, not just "Still amazes me..." without substance.  So, zorlen, what amazes you about people still believing this?  Gotos, except in assembly, ARE a bad thing.

    Man, how do I say this...  I was being satirical.  I don't believe in the single exit point philosophy.  Sorry.

    Maybe later I can give you an explanation of where I stand. Just to let you know, it's from maintaining single-exit code and that a outward brancing tree structure is less complex than one that turns back in on itself i.e. single exit point code often destroys information like what parts of the code the execution reached.  The other things are that programing languages have changed since this idea was popularized.

    A lot of smart people have made good arguments against the single-exit dogma but I fear they have been ignored.

  • Student (unregistered)

    TrueCount:=(1-1); // get 'real zero'

    Ingenious! This sure is the easiest way to assign the zero value to a variable!

  • Anonymous (unregistered) in reply to Gene Wirchenko
    Gene Wirchenko:
    Mung Kee:
    Anonymous:
    Ohh my f***ing god !

    I just love this part:!
    // need to set the result if it hasn't been set yet, we'll randomly decide true or false
    // because there should be no bias.

    Yeah, you don't want your code to be politically incorrect.  The ACLU may come down on you.

    "Equal treatment for true AND false!  Equal treatment for true AND false!"


    "Equal treatment for true AND false!  Equal treatment for false AND true!"

    Sincerely,

    Gene Wirchenko

     

    Don't you mean equal treatment for NOT (TRUE AND FALSE) OR NOT (TRUE OR FALSE)

  • David Knaack (unregistered)

    Some people asked for some other examples of code from the original author.  This probably doesn't qualify as a WTF, so I'll just throw it in here in the comments (hey, I'm new here, feel free to call me on it if I'm breaking any rules).

    This is an example of the kind of utility functions I find in this application.  There are many, all written from scratch, most not particularly resuable, and all exibiting a lack of knowledge of the existence of standard libraries.

    Note the use of amusing(?), but totally useless comments.  Comments of this nature pervade the application.  The 'regular expressions' comment is mine.  We don't have the time to refactor this stuff, but its hard to resist making observations in the comments when I run across particularly amusing mistakes.

    Ya'll oughta see his dynamic SQL construction routines.  Boy howdy, those are hard to maintain!

    type
       TContainsSearchMode = ( smBeginsWith, smContains, smEndsWith );
       TContainsSearchOptionItem = ( soCaseSensitive, soInclusiveWordSearch, soCountOccurrences );
       TContainsSearchOption = set of TContainsSearchOptionItem;
       TContainsResultRec = record
          Result: Boolean;
          Occurrences: Integer;
       end;

    (---------------------------------------------------------------------------
      Procedure:   Contains
      Author:      'jed'
      Date:        07-Jul-2003
      Description: none (i.e. not any)

                   Somebody really needs to learn about regular expressions.
      ---------------------------------------------------------------------------
    )
    function Contains( Text, SearchText: string; SearchMode: TContainsSearchMode; SearchOptions: TContainsSearchOption ): TContainsResultRec;

       function ExclusiveSearch( AText, ASearchText: string; ASearchMode: TContainsSearchMode; ASearchOptions: TContainsSearchOption ): TContainsResultRec;
       var
          SearchIndex: Integer;
       begin
        // initialize result var
          begin
             Result.Result := False;
             if ( soCountOccurrences in ASearchOptions ) then Result.Occurrences := 0
             else Result.Occurrences := -1;
          end;

        // start looking
          case ASearchMode of
             smBeginsWith:
                Result.Result := Pos( ASearchText, AText ) = 1;
             smContains:
                if ( soCountOccurrences in ASearchOptions ) then begin
                   SearchIndex := 0;

                   repeat
                      SearchIndex := PosEx( ASearchText, AText, SearchIndex + 1 );
                      Inc( Result.Occurrences );
                   until ( SearchIndex = 0 );
                   Dec( Result.Occurrences );

                   Result.Result := ( Result.Occurrences > 0 );
                end
                else
                   Result.Result := Pos( ASearchText, AText ) > 0;
             smEndsWith:
                Result.Result := PosEx( ASearchText, AText, Length( AText ) - Length( ASearchText ) + 1 ) <> 0;
          end;

          if Result.Result and ( Result.Occurrences = 0 ) then Result.Occurrences := 1;
       end;

       function InclusiveSearch( AText, ASearchText: string; ASearchMode: TContainsSearchMode; ASearchOptions: TContainsSearchOption ): TContainsResultRec;
       var
          WordList: TStringList;
          LoopVar: Integer;
          SearchResult: TContainsResultRec;
       begin
        // initialize result var
          Result.Result := False;

        // start looking
          WordList := TStringList.Create;
          try
             WordList.CommaText := ASearchText;

             for LoopVar := 0 to WordList.Count - 1 do begin
                SearchResult := ExclusiveSearch( AText, WordList[ LoopVar ], ASearchMode, ASearchOptions );
                if SearchResult.Result then begin
                   Result.Result := True;
                   Inc( Result.Occurrences, SearchResult.Occurrences );

                   if not ( soCountOccurrences in ASearchOptions ) then Break;
                end;
             end;
          finally
             WordList.Free;
          end;
       end;

    begin
      // determine caseity
       if not ( soCaseSensitive in SearchOptions ) then begin
          SearchText := Uppercase( SearchText );
          Text := Uppercase( Text );
       end;

      // fire rockets 3, 4, and 8
       if ( soInclusiveWordSearch in SearchOptions ) then Result := InclusiveSearch( Text, SearchText, SearchMode, SearchOptions )
       else Result := ExclusiveSearch( Text, SearchText, SearchMode, SearchOptions );
    end;

  • (cs) in reply to dubwai
    dubwai:
    bugsRus:
    dubwai:

    Yeah, and Aristotle too.  "The earth revolves around the Sun": what fool is buying into that one?  I mean, once you've got one idea about something, there's no need to think about it again.



     Hey!  I'm on your side!  And where did you get the idea that this hasn't been thought about again?  All the arguments have been argumentum ex silentio.  Debate and thought are always good, however, something needs to be debated, not just "Still amazes me..." without substance.  So, zorlen, what amazes you about people still believing this?  Gotos, except in assembly, ARE a bad thing.


    Man, how do I say this...  I was being satirical.  I don't believe in the single exit point philosophy.  Sorry.


    NOOOOOOOOOO!  Say it isn't so.  My sarcasm meter is on and functioning.


    Maybe later I can give you an explanation of where I stand. Just to let you know, it's from maintaining single-exit code and that a outward brancing tree structure is less complex than one that turns back in on itself i.e. single exit point code often destroys information like what parts of the code the execution reached.  The other things are that programing languages have changed since this idea was popularized.

    A lot of smart people have made good arguments against the single-exit dogma but I fear they have been ignored.


    Agreed, I was playing devils advocate and trolling for a response.  I'm so ashamed!  Not really, it's Friday and I'm bored.
  • (cs) in reply to David Knaack
    Anonymous:

    Note the use of amusing(?), but totally useless comments.  Comments of this nature pervade the application.  The 'regular expressions' comment is mine.  We don't have the time to refactor this stuff, but its hard to resist making observations in the comments when I run across particularly amusing mistakes.


    Someone should attach the rockets to JED.


    Ya'll oughta see his dynamic SQL construction routines.  Boy howdy, those are hard to maintain!


    You win the understatement of the day award!


  • (cs) in reply to Ronald Frown

    I personally like the bit about the not operator - he advises reading the online help. Maybe he should take hiss own advice.

    I'm the first to admit I'm, not the best programmer in the world but I always check if the wheel has already been invented, and if it's round.

  • (cs) in reply to dubwai
    dubwai:

    Man, how do I say this...  I was being satirical.  I don't believe in the single exit point philosophy.  Sorry.

    Maybe later I can give you an explanation of where I stand. Just to let you know, it's from maintaining single-exit code and that a outward brancing tree structure is less complex than one that turns back in on itself i.e. single exit point code often destroys information like what parts of the code the execution reached.  The other things are that programing languages have changed since this idea was popularized.

    A lot of smart people have made good arguments against the single-exit dogma but I fear they have been ignored.

    You got me. You had me completely believing it. Nice work!

  • The Dude (unregistered) in reply to David Knaack

    Oliver Klozoff:
    Based on the limited description of Jed in the OP -- very brilliant, wrote a lot of wacky code, and had trouble staying focused on the topic at-hand -- my guess would be that Jed has ADD but is not being formally medicated; I know, because I myself have ADD and when I'm unmedicated, that's what I'm like.

    I'd guess mild Asperger's Syndrome.  Was he particularly interested in trains or cars?

  • Carl (unregistered)

    I've been reading the stuff posted on this site for a few months now and I've seen some really mind boggling stuff. This, however, is in a whole different league. This isn't AAA WTF-ery, this is Major League WTF-ery. This is the starting pitcher for the #1 team in the league. It's in the running for MVWTF. How can any self-respecting developer justify this crap. Jed should've just kicked the keyboard around for 5 minutes and clicked the compile button. At least then he'd have a good excuse for this waste of time. My favorite part of this whole thing is the recursive call to IsTrue. WTF.

  • Carl (unregistered) in reply to Gene Wirchenko

    I've been reading the stuff posted on this site for a few months now and I've seen some really mind boggling stuff. This, however, is in a whole different league. This isn't AAA WTF-ery, this is Major League WTF-ery. This is the starting pitcher for the #1 team in the league. It's in the running for MVWTF. How can any self-respecting developer justify this crap. Jed should've just kicked the keyboard around for 5 minutes and click the compile button. At least then he'd have a good excuse for this waste. My favorite part of this whole thing is the recursive call to IsTrue. WTF.

  • Carl (unregistered)

    DAMN THE SECOND PAGE!!!

  • (cs) in reply to The Dude
    Anonymous:

    I'd guess mild Asperger's Syndrome.  Was he particularly interested in trains or cars?



    I've (allegedly) got that, and have no particular interest in trains or cars. They're not a prerequisite, which is just as well for De Vinci. An odd speech pattern would be a better indicator.
  • (cs) in reply to brazzy
    brazzy:
    Oliver Klozoff:
    OK, since nobody else seems to have done so, I'll make some sort of attempt at playing defend-the-WTF. This code is a joke. I first thought so when I saw the reference to Random(); I was further convinced when I saw the comment mentioning "bias".


    I agree. It's not uncommon for people who don't really understand boolean expressions to write stuff like

    if(expression == true) {
        return true;
    } else {
        return false;
    }

    But this code goes so ridiculously far beyond that that it can't be anything but a joke.



    Production code is a bad place for jokes of that kind.
  • (cs) in reply to The Dude
    Anonymous:
    I'd guess mild Asperger's Syndrome.

    I thought so too...
  • Gary Wheeler (unregistered) in reply to Zorlen
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    [/blockquote]

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.

    If you worked for me, I'd fire you. Immediately. That kind of cavalier attitude toward proven, sound programming principles has no place in a commercial development environment.

  • (cs) in reply to Student
    Anonymous:
    TrueCount:=(1-1); // get 'real zero'

    Ingenious! This sure is the easiest way to assign the zero value to a variable!

    In x86 assembler MOV AX, 0 used one more byte than XOR AX, AX. Therefore any coder worth his salt would always use XOR AX, AX to put the zero into the AX register. I remember wondering every time I saw that - do savings of one byte justify the loss of about half-second needed to understand what it's doing?

  • Anonymous (unregistered) in reply to Gary Wheeler

    Yes, returning from a function early is like a goto. break and continue are also like gotos. An if() is like a forward goto that is conditional on the expression being false. A while() is like a backward goto that is conditional on the expression being true. A switch() is like a computed goto.

    In a properly structured program, none of these should be used.

  • low_freak (unregistered)

    I've been visiting this site since a quite long time without posting.. but I can't let this go away :P

    fuck... was this "Jed" stoned when he wrote that code?

    goyos make me barf.. really, I can't belive someone wrote this

  • (cs) in reply to Anonymous

    So you advise to write programs without loops or conditional structures ? How ? (more exactly: what's the program doing besides saying Hello World then ?)

  • (cs) in reply to Gary Wheeler
    Anonymous:
    Zorlen:
    dubwai:

    And lo, the lord said unto the flock, "let thy code have one exit point and only one exit point only.  Any exit point beyond the one true exit point shall be called 'goto'"

    Like I said: QED.

    Still amazes me when people buy into this.  Hopefully your followers are dwindling.

    If you worked for me, I'd fire you. Immediately. That kind of cavalier attitude toward proven, sound programming principles has no place in a commercial development environment.



    Fortunately, I do not work for you.  My attitude is far from cavalier.
  • (cs) in reply to WIldpeaks
    WIldpeaks:

    So you advise to write programs without loops or conditional structures ? How ? (more exactly: what's the program doing besides saying Hello World then ?)



    You can replace loops with recursion. Some languages offer no loops, only recursion.
  • Jerkwood (unregistered) in reply to Syarzhuk

    At first - to be frank - I don't know if jed's kidding or not. Reading the stuff I'd say: "Of course." Recalling my own experiences with jed-typed programmers I cannot do so - such code is too familiar with some kind of master pieces I saw of my own. Perhaps he's "bent the edges" a little bit in the first sample but reading the second (more complex) one I am not so sure if his code would be so different if he was not kidding 'round.

    Anyway, I had a nice WTF (sorry pals, no snippet found yet) myself, from a programmer  in my group in PL/SQL. Straight forward stuff such as find "folder" in "/find/the/last/folder". We had coding conventions like "A NUMBER variable always starts with 'N_', a VARCHAR with 'V_' and so forth" and he wrote a monster of some 45 lines which didn't work proper what was teh reason that I looked into it.
    Well, guess what? You already know it: His variables were named: N_IDX, N_IDX2, V_CHAR, V_CHAR2 ... . After half an hour debugging I wrote a method of my own. Two lines.

    So you see, nothing thats human is really strange to me :-)

     TrueCount:=(1-1); // get 'real zero'


    That _might_ have been a joke. But only if he knew that Borland-Compilers are world-masters in optimizing...

    >> In x86 assembler MOV AX, 0 used one more byte than XOR AX, AX.
    >> Therefore any coder worth his salt would always use XOR AX, AX
    >> to put the zero into the AX register.

    Hmmm, is this so? "I dont think so, Tim" - The second one (xor)
    does some more (if I recall correctly), it resets a flag-bit, too. So I personally try to be very careful when programmers do things that are not obvious in first sight.

    Just my 0,02 cent, jerkWood

Leave a comment on “Happy (Belated) Jed Day!”

Log In or post as a guest

Replying to comment #:

« Return to Article