• test (unregistered)

    test100

  • Anonymous Coward (unregistered)

    Frist!111111111eleven

  • Captain Obvious (unregistered)

    if os.path.isDir(ectToHell) == True: print("Error deleting comment from the The Daily WTF.") Conn.RollbackComment

  • Il Baffo (google)

    In c# (Thread.CurrentThread.ThreadState != ThreadState.Running) can be very true because that enum hs other states, tipically ThreadState.AbortRequested which is when the program is being halted (ex when shutting down the machine or the service)

  • Deduplicator (unregistered)

    Hey Remy, that path snippet should look familiar to you, you just wrote about it last week: http://thedailywtf.com/articles/finding-a-path

  • map (unregistered)

    That's not hell! It's only 9 ifs deep! Hell is not being able to frist because of 500 errors!

  • (nodebb)

    Upon which time you realize that this was just the preparatory phase of a well-planned-out "upgrade" process, of which this is just the first step in fourteen for the prep phase...

  • TimothyB (unregistered)

    "At the end of my haunted house is… VBSCRIPT… running… in… THE BROWSER!"

    And how is this more scary than JavaScript running in the browser?

  • (nodebb) in reply to map

    << That's not hell! It's only 9 ifs deep! Hell is not being able to frist because of 500 errors! >>

    AGREED!

  • TheCPUWizard (unregistered)

    Il Baffo is spot on.... checking the ThreadState for one of the multiple (at least 3) states which are not "Running", but yet the thread is executing code can be important. More than once I have had to debug systems with "strange problems" because this was not being done.

  • (nodebb)

    What about the code for deleting from the JobHeader_WorkAReas table?

    What is a Reas anyway?

  • isthisunique (unregistered)

    ROLLBACK THAT LOOP

  • Dan (unregistered) in reply to TimothyB

    VBscript in the browser means you're running Internot Exploded instead of a real browser like Chrome, Firefox, Opera, Lynx, or even Edge.

  • Nicholas "LB" Braden (github)

    My morning started with an image of a demonic white laughing reindeer. I just couldn't comment about it earlier because the site was broken.

  • Quite (unregistered) in reply to dkf

    A reason that's just not on.

  • Quite (unregistered)

    I've noticed that whenever I've tried to connect at around 11:30 (UK time: BST), it's broken (taking too much time to get a response, usually) and this persists for some hours. By mid-afternoon it has soon recovered, but it puts paid to using my mid-day break for WTFery.

  • not that much of a wtf (unregistered)

    As for #3: The code is not that bad, I have seen much, much, much worse.

    • Obviously the developer knows the concept of a transaction - either everything works, or nothing
    • If something fails along the way the error is reported, and the transaction is rolled back making it easy to track possible errors down and doesn't leave the database in an inconsistent state

    So without knowing how DeleteSummaryTable is implemented AND the RDBMS hiding behind this I don't consider this a real WTF.

    I really rather see this nested IF then code which throws meaningless (or none at all) errors, or commits for every change of every single record of every single table making a rollback in case something went wrong along the way impossible.

  • dudeNumber4 (unregistered) in reply to not that much of a wtf

    3rd sample not WTF at all. Totally readable (even a non-programmer could easily see what it's doing), and it works. In fact, I like it.

  • Appalled (unregistered)

    3rd sample is total bullshit. You can't even easily verify that the correct message goes with the correct execution. And it ISN'T correct, the Grips message is there twice, once for the execution, and once for incoming ozone (assuming error was initialized to zero) This is where you should convert it to a fall through, and since modern language don't allow GOTO's, you put it in one function and use Returns.

    If ........Grips Failed { Message Rollback Return } If ........Ground Failed { Message Rollback Return } If ........Environment Failed { Message Rollback Return } Repeat as many times as you want.

    And don't forget Beautiful classic straight line code and GOTO's are NOT dead, you just gotta be a touch inventive.

  • Ex-lurker (unregistered)

    Am I just missing something? How come there are more ELSEs and END IFs than there are IFs??

  • Appalled (unregistered)

    You weren't missing a thing, the code is dead wrong (probably snipped as it went on for 36 more levels deep).

    And Jeez Louise how tough is it to convert a CRLF to a BR when displaying it Mr. WTF Web-Master?

  • Brian Boorman (google)

    Seems like something of this sort would work better (I make no assertion that the syntax is 100% correct):

    list[] = { "Summary_Grips", "Summary_GroundType", "Summary_Enviroment", "Summary_FloorType", "Summary_Control", "Summary_HandToolType", "Summary_FingerMovement", "Summary_LiftHeights" }

    i = 0 Do Error = DeleteSummaryTables(Conn, sJobId, list[i]) While ((Error = 0) And (i < list.length))

    If Error <> 0 Then DisplayError "Error deleting record from the " & list[i] & " tables.", err.number, err.Description Conn.RollbackTrans Else Conn.CommitTrans End If

    Addendum 2016-05-20 11:25: Not sure what happened to the formatting. How does one post code here?

  • Brian Boorman (google)
    list[] = {
    	"Summary_Grips", "Summary_GroundType", "Summary_Enviroment",
    	"Summary_FloorType", "Summary_Control", "Summary_HandToolType",
    	"Summary_FingerMovement", "Summary_LiftHeights"
    }
    
    i = 0
    Do
    	Error = DeleteSummaryTables(Conn, sJobId, list[i])
    While ((Error = 0) And (i < list.length))
    
    If Error <> 0 Then
    	DisplayError "Error deleting record from the " & list[i] & "Summary_LiftHeights tables.", err.number, err.Description
    	Conn.RollbackTrans
    Else
    	Conn.CommitTrans
    End If
    
  • Appalled (unregistered) in reply to Brian Boorman

    OK Brian.

    Now I wanna know. How the *&@^#^ did you get it to format?

  • Sumireko (unregistered) in reply to TimothyB

    JavaScript is actually arguably one of the best languages, though, second only to Perl. I'll never understand the excessive hate for it.

  • illgetmycoat (unregistered) in reply to TheCPUWizard

    Is one of those states 'A ghost in the machine'?

  • foxyshadis (unregistered) in reply to Brian Boorman

    My thoughts exactly; anyone who sees more than a dozen identical things done in a row and doesn't immediately think loops is way off in left field to me. I have to wonder if TDWTF readers are starting to get WTFy, or if that's just Stockholm Syndrome....

  • Scottie (unregistered) in reply to foxyshadis

    anyone who sees more than one identical things done in a row

    FTFY

  • TheCPUWizard (unregistered)

    "I really rather see this nested IF then code which throws meaningless ..."

    So you want to see the nested ifs, and after you have looked at that look at code which throws ....You are a gluten for punishment desiring BOTH versions sequentially.

  • Brian Boorman (google) in reply to Appalled

    This: https://community.nodebb.org/topic/4262/code-block-in-post

  • löchlein deluxe (unregistered)

    Ah yes, code from the school of "flow of control must fall off the end of the body". Fail early, fail often, I say!

  • Erik (unregistered)

    Are we sure...

    if (Thread.CurrentThread.ThreadState != ThreadState.Running) return false;

    ...isn't just checking if the world has been destroyed by the large hadron collider? http://hasthelargehadroncolliderdestroyedtheworldyet.com/

  • Appalled (unregistered) in reply to foxyshadis

    "doesn't immediately think loops is way off in left field to me"

    I'm sorry. I thought we no longer had Memory Limit issues nowadays. Why obfuscate things with a loop? What is WRONG with laying them all out as single actions? Ease of maintenance no longer trumps Compiled Memory Usage? Not in MY world.

  • Angela Anuszewski (google) in reply to Appalled

    Brian's just awesome that way.

  • TimothyB (unregistered) in reply to Sumireko

    "arguably the best"?

    It's possible to argue that COBOL is the best.

    And Here, I said:

    For reference: http://scholar.harvard.edu/files/mickens/files/towashitallaway.pdf

    For example, it would definitely be horrible if your browser’s scripting language combined the prototype-based inheritance of Self, a quasi-functional aspect borrowed from LISP, a structured syntax adapted from C, and an aggressively asynchronous I/O model that requires elaborate callback chains that span multiple generations of hard-working Americans. OH NO I’VE JUST DESCRIBED JAVASCRIPT. What an unpleasant turn of events! People were begging for a combination of Self, LISP, and C in the same way that the denizens of Middle Earth were begging Saruman to breed Orcs and men to make Uruk-hai.

  • Brian Boorman (google) in reply to Angela Anuszewski

    You were always jealous of my talent.

  • anonamouse (unregistered)

    There are some people I work with who would think that the second code exhibiting the arrow anti pattern is an example of good, well structured code...

Leave a comment on “A Spiritual Journey”

Log In or post as a guest

Replying to comment #:

« Return to Article