The Master...



  • Hello...

    I have to maintain some "Ancient" VB6 Application. One of my ChangeOrders send me deep into an uncharted part i never went before. I was forced to fight my way through a 1000+ Line Select-Case statement. After i finally managed to locate case block, which i needed to work on, I saw which parameters it set and which Database Function it called.

    I finally got my hopes up since I could leave the abyss of the thing once called code and venture into the clear and structured world of "Stored Procedures", but only to get the crushed within minutes.

    The 1st thing that should have made me sceptical was the name of the procedure in question. It was "Master". But what would justify such a powerfull name like this?

    The answer is quite simple... 2705 lines of if...then... elsif...

    I wont dare to tourture the reader of this site with the grulesome details... But there are 5 lines of code I want to share that will be able to transmit the pain I had to endure.

    Here they are:

    Another variant of the all so pupular FileNotFound boolean enumeration:

    if rblnReturn = true then
    pOutStr := '1';
    pOutRet := 1;
    else
    pOutStr :='0';
    pOutRet := 0;
    end if;

     



  • You mean 7 lines :P but you had me at VB6...



  • Sorry...

    I used up all my counting skills when i was counting the lines of the select-case and if-else blocks



  • Don't most IDEs/Syntax Highlighters count the lines for you?



  • Yes... But you still have to substract 2 numbers...

    Not sure which WTFCalc I used to do so...



  • I feel your pain, brother.  I'm applying a divide-and-conquer approach to a VB codebase where class files approach 8000 lines on average.  I don't have any 2700 line functions (that I know of), but I do have the burden of knowing that the person who designed it was promoted to Chief Software Architect, possibly to satisfy the Dilbert Principle.



  • @rdrunner said:

    Hello...

    I have to maintain some "Ancient" VB6 Application. One of my ChangeOrders send me deep into an uncharted part i never went before. I was forced to fight my way through a 1000+ Line Select-Case statement. After i finally managed to locate case block, which i needed to work on, I saw which parameters it set and which Database Function it called...

    I share your pain.  I posted a while back about a 1500+ line stored procedure. there was another stored procedure developed to actually generate that monstrosity. enjoy.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.