Representative Last-Ten-Lines



  • Speaking of "keeping it simple," I just wanted to share this snippet, really a work of art, that gave me a sense of terrible doom:

                                    Loop
                                End If
                            End With
                        End If
                        Thread.Sleep(0) : Application.DoEvents()
                    Next
                End If
            End If
        End Try

    End Sub 

     



  • Yes, it is the End World as we know it.



  • Reminds me of the end of the Hitchhiker's Guide to the Galaxy series.



  • My favorite is the uncaught try block.



  • @belgariontheking said:

    My favorite is the uncaught try block.

    How do you know it is uncaught?  This could be at the end of the finally block of the try. 



  • @KattMan said:

    @belgariontheking said:

    My favorite is the uncaught try block.

    How do you know it is uncaught?  This could be at the end of the finally block of the try. 

    That's possible.  I made some assumptions based on not knowing the language.  In java I would put an // end try  after the curly brace of the try block, then start my catches.  My bad. 



  • @belgariontheking said:

    @KattMan said:

    @belgariontheking said:

    My favorite is the uncaught try block.

    How do you know it is uncaught?  This could be at the end of the finally block of the try. 

    That's possible.  I made some assumptions based on not knowing the language.  In java I would put an // end try  after the curly brace of the try block, then start my catches.  My bad. 

    I would love to think this is in the finally. 

    Looping, iterating, decision making to that extent with no other error trapping in what is supposed to be a safe section would take this WTF to another level. 



  • @KattMan said:

    @belgariontheking said:
    @KattMan said:

    @belgariontheking said:

    My favorite is the uncaught try block.

    How do you know it is uncaught?  This could be at the end of the finally block of the try. 

    That's possible.  I made some assumptions based on not knowing the language.  In java I would put an // end try  after the curly brace of the try block, then start my catches.  My bad. 

    I would love to think this is in the finally. 

    Looping, iterating, decision making to that extent with no other error trapping in what is supposed to be a safe section would take this WTF to another level. 

    Ah, there should actually be a catch block with a re-throw in there, and an empty finally block... but I had removed them and was filling in the gaps as I posted the already-corrected code.



  • With that many Endings, it could make it into a Lord of the Rings Extra Extended Edition script!!



  • Poorly written code in VB?  I never thought i'd see the day.

    I've worked on a few legacy VB application and a lot of them have gems like this, i guess you need to get used to it but i find the { }'s alot easier to read in those big nested statements than all the End stuff



  • That doesn't seem all that bad to me, but then the legacy code I work on is pretty horrific.  I'm looking at a function right now that has a cyclomatic complexity of 210, about 2000 lines, and a nesting of 9+.  The nesting is listed as 9+ because the code analysis tool I used stops counting at 9, as no sane person would ever conceive of writing that many nested loops/branchings in a single function.  It also lists the number of code paths as "999999999".  Oh, and did I mention that it has 31 inputs and more than 160 local variables...gack.


     



  • @RayS said:

    With that many Endings, it could make it into a Lord of the Rings Extra Extended Edition script!!

     

    Ahahahahahah. Awesome. 


Log in to reply