From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public From: "Robert Martin" Subject: Re: Software landmines (loops) Date: 1998/09/02 Message-ID: <6skerj$1u5$1@hirame.wwa.com>#1/1 X-Deja-AN: 387275611 References: <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> <6rfra4$rul$1@nnrp1.dejanews.com> <35DBDD24.D003404D@calfp.co.uk> <6sbuod$fra$1@hirame.wwa.com> <35f51e53.48044143@ <904556531.666222@miso.it.uq.edu.au> <6sf87j$47n$1@hirame.wwa.com> <6shp1i$ead$1@nnrp1.dejanews.com> <35EC937F.94420C51@ibm.net> <6sk01j$1qn$1@nnrp1.dejanews.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: WorldWide Access - Midwestern Internet Services - www.wwa.com Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-02T00:00:00+00:00 List-Id: Phil Goodwin wrote in message <6sk01j$1qn$1@nnrp1.dejanews.com>... > >I would posit that if you are changing the function at all you must do a >complete regression test on it. I grant you that the more you change the >routine the more likely you are to introduce bugs and that is an important >consideration. However, what we are doing here is deffering the risk of >creating a more complicated algorithm to the point in time where we know that >the risk is worthwhile. Unfortunately, by the time you know that the structure is wrong, it is often difficult to justify making it right. It is almost always easier to find a clever fix than it is to restructure so that the clever fix isn't necessary. (witness the windowing technique for fixing Y2K bugs). Now, you might suggest that once faced with the choice of clever fix or refactoring, one should always choose refactoring. But I will respond to that with two points. 1. Your premise is that you shouldn't pay for a risk you aren't sure will materialize. Since you don't know that you'll need another clever fix, your premise will lead you to simply make the current clever fix. 2. Multiple returns *were* the first clever fix. If you look at these two statements carefully you will realize that they form the essense of inductive reasoning; leading to the conclusion that true refactoring will never happen. I take slightly different view. If the cost of protecting myself from risk is low, and if the cost of the risk materializing is high, then I will pay for the risk up front. It's like buying insurance. >The only other option is to assume that the risk will >always turn out to be worthwhile and code the more complicated algorithm in >every case. Again, if cost of the more complex algorithm is low, and if the cost of the risk is high, then this may not be a bad decision. >My position is not that strict structured programming has no benefit, it is >that it has a cost and that the cost is not justified unless the benefit is >recieved. Is the cost of your medical insurance, or your auto insurance, or your life insurance justified? Of course it is! (and you should see my health insurance rates!) The reason it is justified is that the potential downside is enormous. So the justificaton of a maintainable approach must be that the downside potential is high enough to get us to gladly pay the up front costs of protection. Robert C. Martin | Design Consulting | Training courses offered: Object Mentor | rmartin@oma.com | Object Oriented Design 14619 N Somerset Cr | Tel: (800) 338-6716 | C++ Green Oaks IL 60048 | Fax: (847) 918-1023 | http://www.oma.com "One of the great commandments of science is: 'Mistrust arguments from authority.'" -- Carl Sagan