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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews2.google.com!not-for-mail From: kevin.cline@gmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: 10 Sep 2004 17:23:32 -0700 Organization: http://groups.google.com Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <6F2Yc.848$8d1.621@newsread2.news.pas.earthlink.net> <2L-dnRmP6qOePaLcRVn-ug@megapath.net> NNTP-Posting-Host: 198.23.26.253 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1094862219 1314 127.0.0.1 (11 Sep 2004 00:23:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Sep 2004 00:23:39 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:3576 Date: 2004-09-10T17:23:32-07:00 List-Id: "Randy Brukardt" wrote in message news:<2L-dnRmP6qOePaLcRVn-ug@megapath.net>... > "jayessay" wrote in message > news:m3wtz7e4hd.fsf@rigel.goldenthreadtech.com... > > kevin.cline@gmail.com (Kevin Cline) writes: > ... > > > I thought so too, until I tried incremental test-first development. > > > Retesting a unit after adding a few lines of code means that type > > > mismatches are caught immediately with or without strong typing. But > > > it goes faster if you don't have to compile and link every iteration. > > > > Exactly. Actually this sort of development will save you much more > > time and money than you could ever hope for from typical static typing. > > This seems like complete nonsense to me. (I'll admit that I've read other > people making similar claims). The reason is that writing a good subprogram > test takes on average 10 times as much code as is in the subprogram itself. > That's because of the need to set up the needed global state for the > preconditions, and the need to test all of the possible permutations of > input. Making the test reusable and automatible adds even more effort. A 10:1 ratio of test code to production code seems extremely high. Keeping subprograms small will reduce the number of permutations of input that must be tested. It's much easier to test five ten-line subprograms taking one input each than to test one fifty-line subprogram taking five inputs. It's also much easier to maintain the five ten-line subprograms, and easier to demonstrate code correctness. Another benefit of unit-level testing is that in the absence of any other documentation, the tests at least demonstrate correct use of the unit. > The best way to save time and money is to avoid the need to do that testing > in the first place. We do that with Ada's strong compile-time and run-time > checking, combined with occassional invariant assertions. And then we do > extensive, repeatable system-level testing to find any logic errors. I do not like having only system-level testing because it makes changes either risky or expensive, and inhibits refactoring. It drives developers to stick with the first code that passes tests, and inhibits extraction of duplicated code because of the cost of retesting.