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:07:38 -0700 Organization: http://groups.google.com Message-ID: References: <49dc98cf.0408110556.18ae7df@posting.google.com> <413e2fbd$0$30586$626a14ce@news.free.fr> <4140b5cc$0$17701$626a14ce@news.free.fr> NNTP-Posting-Host: 198.23.26.253 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1094861261 451 127.0.0.1 (11 Sep 2004 00:07:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 11 Sep 2004 00:07:41 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:3575 Date: 2004-09-10T17:07:38-07:00 List-Id: Lionel Draghi wrote in message news:<4140b5cc$0$17701$626a14ce@news.free.fr>... > Kevin Cline wrote: > ... > > I code test-first, and the amount of test code is relatively > > independent of the language. > OK, because in test-first you write typical use-cases > narrowed to the tested component. Tested features are the same whatever > is the language. > > ... > > The first version leaves me wondering if the comment is correct. > > The second version leaves me wondering if it sometimes throws > > Constraint_Error. There's no way to verify that A always returns a > > value from 1 to 10 or to verify that B never throws Constraint_Error > > without inspecting the function body. > I was not discussing about code correctness (althrough the typed version > correctness is easier to proof with static analisys tools). > > The big difference is that the typed version will raise the default > obvious as soon as possible, the other not. To reach the same behaviour > without typing, you need to do more work. > > > I'm also wondering what happens when you write Random_Index + > > Random_Index ? > > Or Random_Index * Random_Index ? > Yet another advantage of typing: you wonder about problems that also > exist without typing > I was not aware of this advantage :-) > > >>On the other hand, in the A version, I need to check the return value on > >>each call. > > > That's silly. > In my simple example, yes. It's much simpler to put some assertion in > the code. > But once more, there is more code to write without typing. > > > You have to trust functions to satisfy their > > postconditions. > I trust the code generated by the compiler to check an assertion or a > range, I trust a formal tool that certifies to me that returned value > will always be in range, but I don't trust a comment. > > > Even in Ada relatively few post-conditions can be > > handled by type checks. > But whatever is the proportion, why would you renonce to this advantage? > Typing has no cost, no drawback, only advantages. So, why should we > discuss on what typing can't do? Explicit static typing ala Ada and C++ definitely has a cost, because it makes the code longer, and also makes it more brittle. Often I don't really care what type a variable has as long as it is the same type as the value it takes. But with explicit typing a simple type change can ripple through the application forcing the change of many other functions. Simply changing the return type of a commonly used function from single precision to double precision may require every call of that function to be changed. That takes time that could be better spent on higher level pursuits. Besides the additional time to write all those declarations and keep them synchronized with the bodies and keep all the callers synchronized, there is the time lost waiting for compilation and linking, and worse the loss in concentration when developers go off surfing the web waiting for the compile to finish. > Anyway, I enter in this thread because of the claim that typing has much > less value than test-first. > I still wait for any illustration of this claim. > > (and I feel that I will wait for a long time) I don't think you will wait all that long. Test-first development is no longer a radical idea. Increasing numbers of serious software development shops, like SABRE, are getting good results from test-first development.