• (cs)

    The Real WTF is that Jake has already told us the Real WTF so the commenters will have to give the No Dude Seriously Real WTF.

  • No Dude, Seriously (unregistered) in reply to NSCoder
    NSCoder:
    The Real WTF is that Jake has already told us the Real WTF so the commenters will have to give the No Dude Seriously Real WTF.

    I think you'll find that it's actually GetTheRealWTFCaseTheRealWTF.

  • tragomaskhalos (unregistered) in reply to NSCoder

    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun(). (Perhaps unsurprisingly, the project was doomed).

  • Vollhorst (unregistered)

    The first one looks like a lot of functions which just pass the function name to a sql-server and return the result. Kind of prepared statements. shudder

  • (cs) in reply to tragomaskhalos
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun(). (Perhaps unsurprisingly, the project was doomed).

    That's stupid. Everyone knows you name functions like that ADoRunRunRunADoRunRun()

  • Livid Gibbon (unregistered) in reply to tragomaskhalos
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun(). (Perhaps unsurprisingly, the project was doomed).
    Makes more sense if you sing it:

    http://en.wikipedia.org/wiki/Da_Doo_Ron_Ron

  • (cs) in reply to tragomaskhalos
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

  • (cs) in reply to Erick
    Erick:
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

    Someone told you it was written by a coder named 'Jill' The doRunRunRun(), the doRunRun()

  • (cs) in reply to Erick
    Erick:
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

    The shear stupidity astounds you still. The doRunRunRun(), the doRunRun(). ...

    Lets make a full song out of this. Perhaps I'll even write some music for it after.

  • (cs)

    The SQL may not be a total WTF. In my job, I have seen similar things where the RealRegionID might assign it to a geographical region and the RegionID might be used to assign it to a specific Regional Manager. I think these might be instances where a manager is moved from one region to an adjacent one and for whatever reason, they maintain responsibility for some of the sites in their previous region.

  • ChrisHowe (unregistered)

    GoKMartInCincinnatiKmartInCincinnatiGottaGoKMart()

  • (cs) in reply to galgorah
    galgorah:
    Erick:
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

    The shear stupidity astounds you still. The doRunRunRun(), the doRunRun().

    [Edit] ParkinT's addition which mine responds to but wasn't actually quoted in the post I replied to: Someone told you it was written by a coder named 'Jill' The doRunRunRun(), the doRunRun().

    [and now mine] You can't really blame her, she had a codebase to fill. The doRunRunRun(), the doRunRun().

  • WTFNameWTFNameWTFNameWTFNameWTFName (unregistered)

    Did you spot the two spelling mistakes? WFField and WFTracking Entry obviously should read WTFField and WTFTrackingEntry.

  • Matt (unregistered) in reply to galgorah
    galgorah:
    Erick:
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

    The shear stupidity astounds you still. The doRunRunRun(), the doRunRun(). ...

    Lets make a full song out of this. Perhaps I'll even write some music for it after.

    Yes my heart stood still Yes her name was Jill And when she redirected me to 127.0.0.1 The doRunRunRun(), the doRunRun().

  • Will (unregistered)

    Those aren't even methods; they're classes.

  • (cs)
    Song In Progress:
    ...

    And we computer nerds wonder why nobody understands our brand of humor. :D

  • Livid Gibbon (unregistered) in reply to NSCoder
    NSCoder:
    galgorah:
    Erick:
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun().

    You met it on a Monday and your heart stood still. The doRunRunRun(), the doRunRun().

    The shear stupidity astounds you still. The doRunRunRun(), the doRunRun().

    You can't really blame her, she had a codebase to fill. The doRunRunRun(), the doRunRun().
    Yeah she was paid by the line, Yeah so her approach was fine
  • kaya (unregistered) in reply to tragomaskhalos

    was the product called Gabriel?

  • (cs)

    YOU'RE WINNER

  • (cs)

    TheNewRealWTF is TheNewRealWTF2 is TheRevampedWTF is TheRevampedWTF2 is TheRealWTF3_0 is TheRealWTF3_0new is TheNewRealWTF3_0new is RunRunLolaRunLolaRun

  • Smash (unregistered)

    SendCommentToTDWTFSendToTDWTFCommentToTDWTF

  • Christopher (unregistered)

    Someone explain the "zero" wtf?

    Is it because they're using floating point math (therefore causing the result to not be exactly zero)?

  • Anonymous (unregistered) in reply to Christopher

    It is because the three lines could be perfectly abbreviated to

    car[0].act.speed = 0;

    ...would even be faster.

  • Even Faster Zero Speed (unregistered) in reply to Anonymous
    Anonymous:
    It is because the three lines could be perfectly abbreviated to
    car[0].act.speed = 0;
    ...would even be faster.
    But "even faster" and "speed is zero" don't quite mix. That must be why it took them three lines of code to set the speed to zero.
  • silent d (unregistered) in reply to tragomaskhalos
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun(). (Perhaps unsurprisingly, the project was doomed).

    if (day_of_week.equals("Monday")) { if (suitor_name.equals("Phil") { doDoRunRunRun() doDoRunRun() } }

  • Smash (unregistered) in reply to Christopher

    Other than creating a completely unnecessary variable, the guy called

    sp -= sp;
    which means
    sp = sp - sp;

    Of course, it always evaluates to 0. Why couldn't he just use car[0].act.speed = 0; is beyond me

  • MindChild (unregistered) in reply to Kiss me I'm Polish
    Kiss me I'm Polish:
    TheNewRealWTF is TheNewRealWTF2 is TheRevampedWTF is TheRevampedWTF2 is TheRealWTF3_0 is TheRealWTF3_0new is TheNewRealWTF3_0new is RunRunLolaRunLolaRun

    I get your joke, and why people are perplexed by the article... but this isn't a case of reimplementing the same function over and over. These do likely correlate with Stored Procedures or something akin to such, but this is just a bad case of not knowing how to use function overloading. I've done this very thing before (don't hate), but on the database side. The idea was depending on what information you had, you had a different stored procedure to get your result, because, well, your database server doesn't have stored procedure overloading...

    "GetCases" for instance is likely to return multitudes of records. But if you have a WorkflowID to filter some of it down, you would use "GetCasesWorkflow". Got a UserID too? "GetCasesWorkflowUser". Don't want to see any Cases older than 5 years old? "GetCasesWorkflowUserFilterBy"... etc etc etc

  • Just another bloke (unregistered) in reply to MindChild

    Yes, and since function overloading is not to be invented for the next fifty years....

    Oh, wait...

  • Anon Fred (unregistered)

    It wouldn't surprise me to learn that there is some floating point implementation in which x - x = 0 isn't a guarantee.

    I would bet against it being true, but I wouldn't be surprised to be wrong about it.

  • fred (unregistered) in reply to Anon Fred
    It wouldn't surprise me to learn that there is some floating point implementation in which x - x = 0 isn't a guarantee.

    I would bet against it being true, but I wouldn't be surprised to be wrong about it.

    So you will have lost you bet in all IEEE floating point implementations.

    If x is NaN, x-x is also NaN.

    Cheers

  • (cs) in reply to Will
    Will:
    Those aren't even methods; they're classes.

    I'm kinda surprised people seem to miss this post - more so because it's true (look at the icons).

  • Jack CMU (unregistered) in reply to Will
    Will:
    Those aren't even methods; they're classes.

    That's absolutely right. This is from .NET, where a method is represented by a little pink isometric cube.

    I'm doing research on API usability right now (this site is a gold mine!) and this looks very similar to common SOAP web service API patterns.

    To keep their web methods extensible many web service companies only send in one parameter with the method, and then that parameter is an class with "child" classes, which also have children, etc. Then you can add any new "parameters" without breaking old code, or overloading parameters in a weird chronological order that doesn't make sense. So to tell people how to assemble the data structure that the SOAP XML message sends in, web service API designers sometimes encode the assembly information into the name, like so:

    Customer cust = new Customer(); Customer.Selection = new CustomerSelection(); Customer.Selection.Name = new CustomerSelectionName(); Customer.Selection.Name.FirstName = "Bob";

    Then they ship out "cust" as a parameter. If you wanted to change the service to add functionality to support a SecondName or ThirdName, all old code would still work. Also, the autocomplete would fill with:

    Customer CustomerSelection CustomerSelectionName etc.

    So here TRWTF is either (1) this actually ISN'T a web service namespace and the resemblance is bizarre, or (2) current web service stub generators are so primitive the only way to get parameters assembled correctly is to hand developers these wacky lego-block naming schemes.

    Extra credit if you know what a "Whiz-Dull" is. :)

  • (cs) in reply to MindChild
    MindChild:
    "GetCases" for instance is likely to return multitudes of records. But if you have a WorkflowID to filter some of it down, you would use "GetCasesWorkflow". Got a UserID too? "GetCasesWorkflowUser". Don't want to see any Cases older than 5 years old? "GetCasesWorkflowUserFilterBy"... etc etc etc
    Or you could do the entire thing with one GetCases procedure.
    CREATE PROCEDURE dbo.GetCases
      @WorkflowID Int,
      @UserID Int,
      @BeginDate DateTime
    AS
    
    SELECT *
    FROM Cases
    WHERE (@WorkFlowID IS NULL OR WorkFlowID = @WorkFlowID)
    AND (@UserID IS NULL OR UserID = @UserID)
    AND (@BeginDate IS NULL OR CreationDate >= @BeginDate)

    Voila. And since most modern languages support nullable primitives, you only need one code-level method to support this. No overloading necessary.

    Overloading generally isn't the best solution to, well, anything. But as the saying goes, when all you have is a hammer...

  • Pete Repete (unregistered)

    As a person that suffers from multiple repeat syndrome (MRS) I find this article insensitive and offensive.

    As a person that suffers from multiple repeat syndrome (MRS) I find this article insensitive and offensive.

    Sincerely Pete Repete

    Sincerely Pete Repete

  • anonymous (unregistered) in reply to Pete Repete

    Do you know my friend "Pete Repeat"?

    He wrote just like you, except he had better spelling.

  • bubba (unregistered)

    "Wizz-dull" or WSDL would be Web Service Definition Language.

  • (cs) in reply to tragomaskhalos
    tragomaskhalos:
    I once worked on a codebase where a function run() called another function doRun() which called another function doDoRunRunRun(). (Perhaps unsurprisingly, the project was doomed).
    Obviously it was supposed to be a robotic running dodo. Too bad the AIBO came out first.
  • (cs) in reply to Smash
    Smash:
    Other than creating a completely unnecessary variable, the guy called
    sp -= sp;
    which means
    sp = sp - sp;
    Of course, it always evaluates to 0. Why couldn't he just use car[0].act.speed = 0; is beyond me
    In The Olden (Golden) Days, before all this OOP clap trap was pOOPed upon us from ivory towers, if sp was a float and sufficiently small or large, that operation would not return 0.0
  • (cs) in reply to MindChild
    MindChild:
    These do likely correlate with Stored Procedures or something akin to such [...] But if you have a WorkflowID to filter some of it down, you would use "GetCasesWorkflow". Got a UserID too? "GetCasesWorkflowUser". Don't want to see any Cases older than 5 years old? "GetCasesWorkflowUserFilterBy"... etc etc etc

    I use a similar naming method for stored procedures: ObjectVerbByQualifiers, or IdeaVerbByQualifiers. Such as: SurveyUpdate, or AnswerGetByQuestionId. They can kind of get long winded though when you have intermediate tables linked to several tables.

    But the reason I brought it up was because I think I remember a WTF where someone mentioned that method as a WTF. Can't find it, though... so I can't remember why it was a WTF. Maybe it was just a really long name.

  • MindChild (unregistered) in reply to Aaron
    Aaron:
    MindChild:
    "GetCases" for instance is likely to return multitudes of records. But if you have a WorkflowID to filter some of it down, you would use "GetCasesWorkflow". Got a UserID too? "GetCasesWorkflowUser". Don't want to see any Cases older than 5 years old? "GetCasesWorkflowUserFilterBy"... etc etc etc
    Or you could do the entire thing with one GetCases procedure.
    CREATE PROCEDURE dbo.GetCases
      @WorkflowID Int,
      @UserID Int,
      @BeginDate DateTime
    AS
    
    SELECT *
    FROM Cases
    WHERE (@WorkFlowID IS NULL OR WorkFlowID = @WorkFlowID)
    AND (@UserID IS NULL OR UserID = @UserID)
    AND (@BeginDate IS NULL OR CreationDate >= @BeginDate)

    Voila. And since most modern languages support nullable primitives, you only need one code-level method to support this. No overloading necessary.

    Overloading generally isn't the best solution to, well, anything. But as the saying goes, when all you have is a hammer...

    Bullox. You completely assume this is all coming out of one table. What if, for each extra param, you had a join onto another table... not so big, you can just use an IF of some sort... but then you are taking a purely single-query-and-nothing-else Stored Procedure, which tends to get optimized, or "planned" well ahead of time, to evaluated code, which I know of several RDBMS's coughInterbasecough that then refuse to construct a plan, because the result or the path to the result isn't determinable ahead of time.

  • Derek Hartley (unregistered)

    To be honest, I'm not sure that the HTML is actually a WTF. I presume the idea is that it's a level 2 header but the class is h3? Surely this could simply be a case of having multiple header styles and the coder just wishing to use the 3rd one?

  • Some Mathematician (unregistered) in reply to tragomaskhalos
    TFA:
    And from a database schema:
    CREATE TABLE Properties
    (
      /* SNIP */
      RegionID INT NOT NULL REFERENCES Regions(RegionID),
      RealRegionID INT NOT NULL REFERENCES Regions(RegionID),
      /* SNIP */
    )
    

    The real WTF is that he forgot a NoDudeSeriouslyRealRegionID column.

    Actually, he just left out the next column. Once you see it, you'll agree the schema makes sense:

    CREATE TABLE Properties
    (
      /* SNIP */
      RegionID INT NOT NULL REFERENCES Regions(RegionID),
      RealRegionID INT NOT NULL REFERENCES Regions(RegionID),
      ComplexRegionID INT NOT NULL REFERENCES Regions(RegionID),
      /* SNIP */
    )
    

    Yes, I am customer 462846 - 6i.

  • (cs) in reply to Derek Hartley

    I was thinking the same thing? What's wrong with using a different class for the High Explosives AD #3?

  • Justin (unregistered)

    The real WTF is Stored Procedures for dynamic selects in the comments.

  • JUST ANOTHER WTF (unregistered) in reply to Smash
    Smash:
    Other than creating a completely unnecessary variable, the guy called
    sp -= sp;
    which means
    sp = sp - sp;
    Of course, it always evaluates to 0. Why couldn't he just use car[0].act.speed = 0; is beyond me

    Obviously so he can get that little bit of floating point error at the end... he doesn't want 0 he wants 1.432322323E-14!

  • (cs)
    The real WTF is that he forgot a NoDudeSeriouslyRealRegionID column.

    This is different from mysql_*_escape_string... how? There's precedent! Bad precedent, but precedent.

  • Anonymous (unregistered) in reply to Smash
    Smash:
    Other than creating a completely unnecessary variable, the guy called
    sp -= sp;
    which means
    sp = sp - sp;
    Of course, it always evaluates to 0. Why couldn't he just use car[0].act.speed = 0; is beyond me

    when sp is NaN or Infinity, sp - sp evaluates to NaN.

  • (cs) in reply to Anonymous
    when sp is NaN or Infinity, sp - sp evaluates to NaN.

    So,

    If car[0].act.speed="smokin" <-- see, not a number!

    is evaluated earlier in the program.

    car[0].act.speed=0

    would be incorrect.

  • (cs) in reply to Some Mathematician
    Some Mathematician:
    Actually, he just left out the next column. Once you see it, you'll agree the schema makes sense:
    CREATE TABLE Properties
    (
      /* SNIP */
      RegionID INT NOT NULL REFERENCES Regions(RegionID),
      RealRegionID INT NOT NULL REFERENCES Regions(RegionID),
      ComplexRegionID INT NOT NULL REFERENCES Regions(RegionID),
      /* SNIP */
    )
    

    Yes, I am customer 462846 - 6i.

    You deserve to be quoted at least once.
  • (cs) in reply to bubba
    bubba:
    "Wizz-dull" or WSDL would be Web Service Definition Language.
    Nonsense. It means nothing unusual happened while you were in the restroom.

Leave a comment on “A Method by Any Other Name”

Log In or post as a guest

Replying to comment #188855:

« Return to Article