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: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/10/02 Message-ID: #1/1 X-Deja-AN: 277496546 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1997-10-02T00:00:00+00:00 List-Id: Robert A Duff (bobduff@world.std.com) wrote: : ... : By the way, speaking of negative logic, what do people think about : negative logic in "if" statements? I tend to try to reduce the number : of "not"s in the code. But other people tend to use some other : heuristic, such as "do the normal case first" or "do unusual case : first". FWIW, one of my heuristics is if one case is much shorter than the other, do the shorter case first, as it is easier to see what is happening. When you see something like: ... 200 lines else Do_Something; end if; you can pretty easily lose track of what was the original condition being tested. Of course, another solution is to put a nice comment after the "else" to say what is the condition governing the second case. However, even if you put a comment on the else, I still find it clearer to finish off the short case first, and then do the complicated one. : - Bob -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA