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: mheaney@ni.net (Matthew Heaney) Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/10/04 Message-ID: #1/1 X-Deja-AN: 277909009 References: <34316EC3.5B62@dynamite.com.au> <199710011402.QAA02444@basement.replay.com> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-10-04T00:00:00+00:00 List-Id: In article , bobduff@world.std.com (Robert A Duff) 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". For example: I like to handle the exceptional case first, and return early. >Or perhaps even: > > if Is_Evil(X) then > print error message; > return; > end if; > ... -- 37 lines of code doing the normal thing This one gets my vote. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271