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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1108a1,59ec73856b699922 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,5f529c91be2ac930 X-Google-Attributes: gidfdb77,public X-Google-Thread: f43e6,899fc98b2883af4a X-Google-Attributes: gidf43e6,public X-Google-ArrivalTime: 2003-05-19 09:30:23 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mcq95@earthlink.net (Marc A. Criley) Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,comp.software-eng Subject: Re: Logic Errors and Ada (Was: A big hairy thread on Ada, Quality, and Drivers) Date: 19 May 2003 09:30:22 -0700 Organization: http://groups.google.com/ Message-ID: <254c16a.0305190830.21c61eca@posting.google.com> References: <9fa75d42.0304230424.10612b1a@posting.google.com> <9fa75d42.0305130543.60381450@posting.google.com> <254c16a.0305140549.3a87281b@posting.google.com> <9fa75d42.0305141747.5680c577@posting.google.com> <1053027582.984315@master.nyc.kbcfp.com> <3ec4b5c5$1@news.wineasy.se> <254c16a.0305160930.40bb42f9@posting.google.com> <9fa75d42.0305181502.53703035@posting.google.com> NNTP-Posting-Host: 12.158.183.115 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1053361822 15021 127.0.0.1 (19 May 2003 16:30:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 19 May 2003 16:30:22 GMT Xref: archiver1.google.com comp.lang.java.advocacy:64173 comp.object:63693 comp.lang.ada:37523 comp.software-eng:19299 Date: 2003-05-19T16:30:22+00:00 List-Id: softeng3456@netscape.net (soft-eng) wrote in message news:<9fa75d42.0305181502.53703035@posting.google.com>... > That sounds to me an unrealistic level of discipline: subtyping > to the extent that all lattitudes and longitudes (and things > along that line) are separate types. More common usage is that both > will be just real numbers (floats), whatever the language chosen. So As noted elsewhere, this "unrealistic" level of discipline is the norm in an Ada software shop. You don't see this, and you see the common usage as being just using floats in such situations, because you don't work with Ada programmers. You've indicated you work primarily with C++ and Java, neither of which provide the simple, direct support for the strong typing of scalars, so of course you won't--and simply can't--see this sort of usage. > academically this is an advantage, in practice it won't be there. > (Similarly, as other messages point out, in practice, any usage of > subranges you will see in Ada is just what you have in C++, > int8, int16, int32. Though in a classroom setting it may sound like > a great advantage to be able to have my own subranges of integers > from 1 to 9102 each and every time I need it...) I'm not sure which other messages you're referring to (though I may have just overlooked some--this has been a BIG thread :-), but the only references to such definitions that I recall have been to denigrate that practice (outside of the realm of external interfacing), since it nullifies the benefit of strong typing and is typically done by those unfamiliar with Ada and strong typing. > But in any case, you sure can create Lattitude and Longitude classes > in C++ as well if you are so disciplined, so the advantage you are > pointing out is not very clear. Of course one could create such classes--but _No_One_Does_ as a matter of course--it's more work! You said yourself that the more common usage is to just use real numbers(floats). Again, in Ada it's just as easy to create distinct types for quantities like this and gain all the benefits of strong typing and the services (attributes) that the language automatically provides, as it is to declare a Latitude member as plain vanilla float. Doing the latter, though, requires that all the supporting constraint, limit, and verification code be explicitly written by the programmer--which is the case with C/C++ and Java. Regardless of whether you encapsulate it in a class or do it inline with reference to consts and #define's. How does one justify doing and debugging all this extra work to duplicate what Ada gives you out of the box? Marc A. Criley