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: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: jdege@jdege.visi.com (Jeffrey C. Dege) Subject: Indicators of program quality? (was Re: Software landmines) Date: 1998/10/15 Message-ID: #1/1 X-Deja-AN: 401253136 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@news.erols.com> <6sdiav$e0g$1@hirame.wwa.com> <6sfcft$70p$1@hirame.wwa.com> <1dg8p3r.vfredh1aou58iN@n207167116191.inetworld.net> <6v2nr9$t8l$1@hirame.wwa.com> <1dgane6.16owv2g7g8ov8N@u2n207167116151.inetworld.net> <1dge7py.7401x8z7ne24N@u2n207167116162.inetworld.net> <1dghyt5.oik1lzhxzf2N@n207167116176.inetworld.net> <1dgt6f1.1oau40z1p1ueeuN@n207167116181.inetworld.net> <3624700D.52F1@dmu.ac.uk X-Complaints-To: abuse@visi.com X-Trace: ptah.visi.com 908430440 209.98.6.59 (Thu, 15 Oct 1998 00:47:20 CDT) NNTP-Posting-Date: Thu, 15 Oct 1998 00:47:20 CDT Newsgroups: comp.object,comp.software-eng,comp.lang.ada Date: 1998-10-15T00:00:00+00:00 List-Id: Followup-To: On Wed, 14 Oct 1998 10:34:05 +0100, Graham Perkins wrote: >Charles H. Sampson wrote: >... >> The above structure, that I don't remember writing, is not a loop >> that fails to contain a procedure call in its body. It's a loop whose >> body consists entirely of a single procedure call. > >A very frequent construct in student programs! > >Also we often find "main program" which consists of a single procedure >call, and many individual procedures which consist of nothing but >two or three parameter-less procedure calls. > >We try to reform such people before they graduate!! But many >slip through. Odd. I find both constructs (loops with bodies consisting of single procedure calls, and mains that consist of single procedure calls) occur quite frequently, in perfectly reasonable situations. while ((count = fread(buffer, 1, BUFFER_SIZE, iFile)) > 0) fwrite(buffer, 1, count, oFile); MyApplicationClass theApplication; int main() { return theApplication.run(); } Now I don't doubt that you see poorly modularized programs, but the "problems" you describe aren't very good indicators of poor program quality. I've seen this sort of program, and the problem, for example, in a procedure that consists of three parameterless procedure call isn't that there are three parameterless calls, but that the called procedures communicate via global variables, or worse, that the division of functionality between the procedures is completely arbitrary. Single line loops, single line main()'s, procedures containing only calls to other procedures, all can be perfectly reasonable. And I'd hate to think that students were beaing taught not to do these specific things, instead of learning the underlying principles that made these poor choices in specific cases. -- For every problem there is one solution which is simple, neat, and wrong. -- H. L. Mencken