• Stiggy (unregistered) in reply to Zecc
    Zecc:
    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.

    You really have a complicated imagination.

  • user (unregistered)

    Windows Workflow has the disadvantage that you create a lot of members, i.e. an IfElse branch with at least 2 Members (the actual IfElseActivity, and then at least 1 Branch). If you want to name them properly, you end up with something like in Screenshot 1 even for simple Workflows.

    Still, WF is a neat little technology.

  • (cs)

    How the hell have we not had a joke about "data processing data data processing" yet?

  • RH (unregistered)

    The real WTF is Big Rigs: Over the Road Racing.

    But we all knew that already.

    I'm sure the whole story behind that could warrant an epic tale ala <a rel="nofollow" href=""http://thedailywtf.com/Articles/Virtudyne_0x3a__The_Founding.aspx" target="_blank" title=""http://thedailywtf.com/Articles/Virtudyne_0x3a__The_Founding.aspx">The Digital Donkey.

  • Anonymous (unregistered) in reply to RH
    RH:
    The real WTF is Big Rigs: Over the Road Racing. I'm sure the whole story behind that could warrant an epic tale ala The Digital Donkey.
    I dunno.

    It might have been a test if Activision will publish any crap you throw at them. Or an attempt to collect some americanski dollars. Or both.

    Those are the sane options. So, go crush my hopes for humanity...

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

    Ha, first you beat me to it and then you're too cowardly to post using your real made up pseudonym.

    I just wonder what Einstein would have had to say about infinitely fast cars.

    JUST ANOTHER WTF:
    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!

    Not counting special numbers like inf, x-x is exactly 0 for every float x and a conforming IEEE 754 implementation. Now if I only knew whether it's +0 or -0...

  • (cs) in reply to MindChild
    MindChild:
    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 *cough*Interbase*cough* that then refuse to construct a plan, because the result or the path to the result isn't determinable ahead of time.
    SELECT *
    FROM Cases
    LEFT OUTER JOIN Foo
        ON (Foo.ID = Cases.FooID)
    LEFT OUTER JOIN Bar
        ON (Bar.ID = Cases.BarID)
    WHERE (@WorkFlowID IS NULL OR Cases.WorkFlowID = @WorkFlowID)
    AND (@UserID IS NULL OR Foo.UserID = @UserID)
    AND (@BeginDate IS NULL OR Bar.CreationDate >= @BeginDate)
    

    There's more than one way to skin a cat.

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

    Was the original coder's name Ken? I had a guy (Ken) in my senior project who loved this type of stuff. His explanation: "otherwise it breaks" (translation: I've ran into a timing issue that occurs rarely and by adding a passthru method it prevents the timing problem, like a synclock).

    That translation took about 6 hours to figure out. He had a race condition and tried adding a new method that called the offending method. The next time he ran it the race didn't occur, so he knew it had to be the solution. From then on every time he called the method he would add another layer.

    I had 0 responsibility for that area of the app, and didn't want to clean it up (like I had to for the common code). I almost had tears of joy when he was presenting and the problem surfaced again! He showed the prof afterwards what he had done and asked why it wouldn't work on the machine he was presenting on.

    Sadly, he still graduated with the same degree as me.

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

    What sound did the WTF make as it went over your head?

    "Whoosh"? "Roarrrr"?

    Addendum (2008-04-09 15:49): Edit:

    After reading the responses, I see that none of the commenters understood the zero joke.

    In assembly, the way to store a zero in a register would be to use a "load immediate" command. This command would have an opcode followed by the literal value to be loaded, ie. "ldi 0".

    The actual opcode for this would be different for different platforms -- some CPUs wouldn't even have a "load immediate" opcode -- but let's assume it was "0xf0", then the full command would be assembled as "0xf000" (2 bytes for this instruction on my imaginary 8-bit CPU).

    Back in the days where developers would literally count clock cycles to provide precise timing in certain tight loops, a 2 byte opcode might be overkill if there was another, shorter opcode that could achieve the same result by a different means. Say there was an opcode called "and A,B" which would take the bitwise AND of the value in register A with the value in register B. The opcode for this instruction is "0xba". If you knew that register B would be set to zero on entry of this subroutine, then you could set A to zero with this opcode, which would assemble into a single byte.

    So it's just a tricky way to squeeze as much memory as you can out of your code. Trying the same tricks in a language like C clearly makes no sense because you're actually using MORE instructions when you do something like this... and thus, a WTF.

  • (cs) in reply to Zecc
    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.

    Actually, that would be ImaginaryRegionID -- complex is (real + imaginary * sqrt(-1))

  • (cs) in reply to Yoooder
    Yoooder:
    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).

    Was the original coder's name Ken? I had a guy (Ken) in my senior project who loved this type of stuff. His explanation: "otherwise it breaks" (translation: I've ran into a timing issue that occurs rarely and by adding a passthru method it prevents the timing problem, like a synclock).

    That translation took about 6 hours to figure out. He had a race condition and tried adding a new method that called the offending method. The next time he ran it the race didn't occur, so he knew it had to be the solution. From then on every time he called the method he would add another layer.

    I had 0 responsibility for that area of the app, and didn't want to clean it up (like I had to for the common code). I almost had tears of joy when he was presenting and the problem surfaced again! He showed the prof afterwards what he had done and asked why it wouldn't work on the machine he was presenting on.

    Sadly, he still graduated with the same degree as me.

    Well, that's DeVry for ya.

  • (cs) in reply to savar
    savar:
    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

    What sound did the WTF make as it went over your head?

    "Whoosh"? "Roarrrr"? Say there was an opcode called "and A,B" which would take the bitwise AND of the value in register A with the value in register B.

    Today my head is full of bits, but:

    Even in ancient assembler, the reason to use the XOR trick wasn't simply to save on clock cycles. Sure, in Z80 (AFAIR) and in i8086 (AFAI can faintly remember), it took one cycle, rather than maybe three for an immediate load. But even 1980s assembler programmers weren't that bit-headed. The real value of the thing was that it reset various flags, which made "safe" programming in assembler a hell of a lot easier.

    After a while, it became something that you just did automatically.

    A bit like programming in Java, without understanding what a real language might do for ya.

  • Vlad (unregistered) in reply to tragomaskhalos

    That's some kind of acceleration technique... You cannot just start running.

  • (cs)
    1. Copying a variable to a temporary is not always a WTF. In release code, it will be optimized out anyway. In debug code, it may be helpful to be able to view the value of the temporary to see what was going on.

    2. s-=s is not always a WTF. It is often the most efficient way to set 's' to zero (or nearly so) if it's a number and leave it as a NaN if it's not. Especially on modern CPUs, 'clever' evaluation code is generally faster than testing and branching.

    That said, this is almost definitely a WTF.

  • Me (unregistered) in reply to DZ-Jay
    DZ-Jay:
    SELECT *
    FROM Cases
    LEFT OUTER JOIN Foo
        ON (Foo.ID = Cases.FooID)
    LEFT OUTER JOIN Bar
        ON (Bar.ID = Cases.BarID)
    WHERE (@WorkFlowID IS NULL OR Cases.WorkFlowID = @WorkFlowID)
    AND (@UserID IS NULL OR Foo.UserID = @UserID)
    AND (@BeginDate IS NULL OR Bar.CreationDate >= @BeginDate)
    

    There's more than one way to skin a cat.

    -dZ.</div></BLOCKQUOTE>
    

    Why incur the performance penalty of even an outer join on a table, when you possibly know ahead of time if you need to touch it at all? Just because you don't want so-wordy-I-know-what-they-do methods?

  • Rourke (unregistered)

    RegionID is the region for commoners; RealRegionID is the region for the King. The King has superuser rights to this schema and may alter the constraint by decree.

    Stop being so Anglocentric ...

  • Grassfire (unregistered) in reply to Stiggy

    Is it just me, or is the WTF:

    Order Summary

    Not really a WTF?

    I mean, 'head3' as a css class doesn't nessecarily have to correspond to a document structure level 'head3'.

  • (cs)

    PostWTFCommentWTFCommentPostByUserName("I find the last method name most perplexing.", "NoDudeSeriouslyRealWTF", "Eternal Density");

  • Moikal (unregistered)

    I came to this thread looking for a GetThePapersGetThePapers() reference.

    I was disappointed.

  • The Real WTF (unregistered)

    Don't be silly. The real region code is for REAL ID Act compliance. The other one is just a fake to throw off terrorists who want to steal our region codes for some nefarious plot.

  • Toshio (unregistered)

    As far as the function naming goes, it might just have been caused by Visual Basic code, which also never heard of overloading. It might have been "wizard-converted" into VB.Net, causing this to appear as grotesque as it does. Without more info it couldn't be said whether this is a real WTF or not.

    RegionID and RealRegionID stuff, also happens a lot in RealLife(TM) and usually for a good reason. Occasionally some beginner architect or developer makes a mistake of believing some outside entity codes never change (PO numbers, currency numbers, ...) and uses them for database keys. What happens then is that system runs just fine for couple of years and then suddenly the entity that maintains the codes, changes them. ETL processes completely break down, data is suddenly invalid and no reports (for example) can be generated to return to the govt. or bank.

    Simple solution is then to add a mapping table which maps codes from outside the system to the codes used inside the system. A thing that should be done at the design phase is then bolted on to the production system, where only edge methods (usualy just ETL & reporting) change.

    Still, this is lesser evil than completely shutting down the system, destroying database consistency checks (removing all triggers and perhaps even foreign key constraints), updating all KEYS and then hoping that updates didn't damage the data in the system. Personally, in working system, I would always choose mapping tables and extra programming. They might be ugly to see, but when new code exhibits an uncaught bug, things mostly break fast and loud, without causing any hidden damage to the data in the system or damaging more than just a few entries before being caught.

    Again, without more info I cannot say whether this is a WTF or not.

  • Smash (unregistered) in reply to JUST ANOTHER WTF
    JUST ANOTHER WTF:
    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!
    Supposing car[0].act.speed is a class or anything unable to hold a float (e.g. a string), that could be some try/catch flow control. Then again, that was the WTF earlier this week. There can't be two articles based on the same WTF in such a short time
    dextron:
    If car[0].act.speed="smokin" <-- see, not a number!
    If I was that programmer, I would rather use "Hyperspace Drive" instead.
  • Bob (unregistered) in reply to MindChild

    These are types not methods - look at the icons...

  • captain obvious (unregistered)
    <wtf class="wth" type="NoDudeSeriouslyRealWTFSeriouslyRealWTF -= SeriouslyRealWTF"> Just when you thought it could not get worse, those "methods" are actually classes! </wtf>
  • 28% Genius (unregistered) in reply to Even Faster Zero Speed
    Even Faster Zero Speed:
    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.

    Three lines is the minimum braking distance

  • Harrow (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).
    We started on a Monday but we had no spec doDoRunRunRun(), doDoRunRun() The existing site was a total wreck doDoRunRunRun(), doDoRunRun() Yeah, we had no spec, yeah, a total wreck And when we clicked 'submit' doDoRunRunRun(), doDoRunRun()

    Where we couldn't guess we just assumed doDoRunRunRun(), doDoRunRun() Unsurprisingly, the job was doomed doDoRunRunRun(), doDoRunRun() Yeah, we just assumed, yeah, job was doomed And when we clicked 'submit' doDoRunRunRun(), doDoRunRun()

    The client was happy 'til he got the bill doDoRunRunRun(), doDoRunRun() If he had more money we'd be coding still doDoRunRunRun(), doDoRunRun() Yeah, he got the bill, yeah, be coding still And when we clicked 'submit' doDoRunRunRun(), doDoRunRun()

    doDoRunRunRun(), doDoRunRun() doDoRunRunRun(), doDoRunRun() doDoRunRunRun(), doDoRunRun() doDoRunRunRun(), doDoRunRun() doDoRunRunRun(), doDoRunRun() doDoRunRunRun(), doDoRunRun()

  • Harrow (unregistered)

    Sorry about that -- I submitted as soon as I saw tragomaskhalos's post, before reading the rest of the thread.

    -Harrow.

  • iToad (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.

    Bah. Back in the days of C, you could be -absolutely- sure that all the bits in a floating-point value get set to zero by:

    union
    {
      float f;
      long i;
    } sp;
    
    sp.f = car[0].act.speed;
    sp.i ^= sp.i;
    car[0].act.speed = sp.f;
    

    This method uses the tried and true technique of clearing all the bits by performing a bitwise XOR of the value against itself. It doesn't use this newfangled method of simply setting the value to zero.

  • Kuba (unregistered) in reply to jo42
    jo42:
    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

    If sp was a number, I fail to see how this operation would not return 0.0. Floating-point operations are really integer operations in a thin disguise. An FP substitution will bsically shift the mantissas to align them, do an integer subtraction, and then shift the mantissa of the result again, if needed. Shifting the mantissa adjusts the exponent of course. The initial alignment of the mantissas will be performed in the same way on both minuend and subtrahend (they are the same, after all).

    It'd take some very contorted implementation to have this subtraction yield non-zero. Of course the compiler can move operations around so in some cases it may not work, but in this case methinks the operations are localized enough for the results to always be zero. Modern compilers (gcc methinks) will just optimize it out as a store of a zero constant anyways.

  • Kuba (unregistered) in reply to real_aardvark
    real_aardvark:
    Today my head is full of bits, but:

    Even in ancient assembler, the reason to use the XOR trick wasn't simply to save on clock cycles. Sure, in Z80 (AFAIR) and in i8086 (AFAI can faintly remember), it took one cycle, rather than maybe three for an immediate load. But even 1980s assembler programmers weren't that bit-headed. The real value of the thing was that it reset various flags, which made "safe" programming in assembler a hell of a lot easier.

    I'd say that in real life, for ultra-compact code, you do the exact opposite -- you strive to preserve the flags for as long as possible, to avoid say a jump. That's why, for example, on sane architectures (tm) a load of a register with a constant won't touch the flags, and in general any opcode whose result would be universally known from its immediate arguments won't touch the flags. By "universally known" I mean for any immediate value, not just a particular case.

  • Mike (unregistered) in reply to tragomaskhalos

    "doDoRunRunRun()" is clearly an intentional reference to the song. "Met him on a Monday..."

  • (cs) in reply to Kuba
    Kuba:
    real_aardvark:
    Today my head is full of bits, but:

    Even in ancient assembler, the reason to use the XOR trick wasn't simply to save on clock cycles. Sure, in Z80 (AFAIR) and in i8086 (AFAI can faintly remember), it took one cycle, rather than maybe three for an immediate load. But even 1980s assembler programmers weren't that bit-headed. The real value of the thing was that it reset various flags, which made "safe" programming in assembler a hell of a lot easier.

    I'd say that in real life, for ultra-compact code, you do the exact opposite -- you strive to preserve the flags for as long as possible, to avoid say a jump. That's why, for example, on sane architectures (tm) a load of a register with a constant won't touch the flags, and in general any opcode whose result would be universally known from its immediate arguments won't touch the flags. By "universally known" I mean for any immediate value, not just a particular case.

    And I'd agree with you. This was, however, Z80 inside 8K of RAM. I believe the same issues applied to early i8086 implementations -- thus the XOR trick.

  • Anon (unregistered)

    The class names are clearly the result of auto-generation from an xsd schema.

  • (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
    You need
    sp -= sp;
    to get true zero~
  • (cs)

    Order Summary

    I can just picture the conversation now:

    Jeff S.: Why didn't you just use an h3 tag? Original Developer: ... Original Developer: They go all the way up to THREE??! Jeff S.: shocked, trying to hide it Well, yeah. There are actually six different heading tags. That is, they go from h1--the largest--down to h6--the smallest. Original Developer: WHOA!!! No way! You're pulling my leg. Jeff S.: No dude, seriously.

  • Jeff (unregistered) in reply to MindChild

    $jill->doRunRunRun( WTFAreWeDoingWTF );

  • Disillusioned Programmer (unregistered) 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
    Someone has been exposed to PHP, but hasn't yet managed the inconsistency --- there should be at least a CasesGetWorkflowFilter2DateBy and a WorkflowCasesGet ...
  • bri3d (unregistered)

    Do you perchance work for Sony? The PSP SDK has thousands of these function names. Some better examples are: sceKernelLoadModuleBufferForLoadExecBufferVSHUsbWlanDebug sceUmdUnRegisterSuspendResumeUMDCallBack sceUpdaterCheckChunkVersionForKernel etc. Sony also named all the PSP subsystems after Star Trek, subatomic particles, and LOTR. There are subsystems called Lepton (UMD), Pommel (watchdog), Kirk (encryption), Spock (more encryption), Baryon (WLAN), Tachyon (VME), Legolas, and so on...

  • Daniel (unregistered)

    Well, I guess one of the company's police would be "Do not use parameters, let's distinguish everything by method name"

    And about the doRun, doRunRun, doRunRunRun, RunForrestRun methods: why not naming the methods accordingly?

    RunProcess(), ExecutePart1(), CalculateWhatever(), SendToBackOfficeApp()...

    I'm not familiar with the actual code that generated the "RunRun syndrome", but I'm pretty sure you could re-think the methods name if you just take a second (and maybe a third) look into the implementation. If code review did not help you out with the method-names, then your method structure needs revising, and not only the naming.

  • Jeremy (unregistered) in reply to tragomaskhalos

    Sounds like it was starting a diesel engine?

  • Andrew A (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).
    Did you meet it on a Monday and your heart stood still?

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

Log In or post as a guest

Replying to comment #:

« Return to Article