Optimizing Old Modify Statements

    By: Mr. Rik Brooks on Jul 31, 2014

    Addressing the Kludge — This article looks at the negative impacts of kludges and then demonstrates a real life example in which one is reconciled by combining all the items for modification into a single modify statement, thereby making the code much easier to understand and maintain.

    Back in the early 1980’s it was understood that most programs would be completely re-written within five years. Most programs and even functions, would be completely gone from production within that time period – especially if the program was a complex business program.

    More than anything else I think the reason for this is the kludge. Kludges are dangerous things. They will often break code that has been working for years. Sometimes they will break the code in such a way that the bug will only happen every now and then, when a particular set of conditions are met. For example, recently a bug was discovered in a screen that was a direct result of a kludge. There were four radio buttons in a group box. The bug ONLY happened when you went from option 3 to option 1 and hit the ‘Refresh’ button in the toolbar. It didn’t happen when you went from the second to the first, or the fourth to the first. It didn’t happen when you went from the third to the first then to the second and hit refresh.

    Of course the user that reported this didn’t see this distinction. They just proclaimed that the first option didn’t work... sometimes. A kludge is a patch. It’s a piece of code that programmers add to an existing piece of code without fully analyzing the host code so that it can seamlessly and correctly work. I am as guilty of writing kludges as anyone else. For me it happens mostly when I am under pressure. For example, I was working for a large retailer and when I came in one day there were several Directors at my desk. Apparently California had changed their requirements for documentation of hazardous materials and they had police sitting outside our retail outlets all over the state stopping our trucks. When the hazmat documents didn’t conform to their brand new format they were fining us. Already we had lost tens of thousands of dollars and it was only mid-morning of the first day.

    I had to fix this... fast. There was no time to analyze. There was little time to test. It had to be done now... NOW.

     

    Login to read the article. Not a member? Create a free account!

    3209
    Released: July 31, 2014, 11:16 pm | Updated: September 8, 2014, 12:35 pm
    Keywords: PowerBuilder Article | Technical Journal | PowerBuilder | Rik Brooks


     

     

    TwitterLLinkedinLFacebook

    Copyright © 2014 ISUG-TECH. All Rights Reserved
    All material, files, logos and trademarks within this site are copyright their respective organizations

    Terms of Service - Privacy Policy - Contact the Help Desk