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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,103b407e8b68350b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-07 05:42:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: Richard Riehle Newsgroups: comp.lang.ada Subject: Re: Anybody in US using ADA ? One silly idea.. Date: Tue, 07 Jan 2003 05:51:33 -0800 Organization: AdaWorks Software Engineering Message-ID: <3E1ADB65.9CE834C0@adaworks.com> References: Reply-To: richard@adaworks.com NNTP-Posting-Host: 41.b2.40.7b Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 7 Jan 2003 13:42:37 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:32676 Date: 2003-01-07T13:42:37+00:00 List-Id: The debate over generics versus inheritance is quite old. Bertrand Meyer wrote an essay on this which he included in his book, "Object Oriented Software Construction." The general conclusion was that genericity could be emulated with inheritance, but inheritance could not be emulated with genericity. For some the objective of both concepts is software reuse. I seen that as a short-sighted view, but it is certainly one valid objective. Ada has taken this a little further. We have genericity, inheritance, and child library units. All three are useful tools when used for the correct purpose. All three provide a powerful combination of approaches to software reuse. Randy Brukhardt has correctly noted that Ada /= GNAT. Many compilers, one that I recall quite well was TLD Ada, did not use full code expansion for generics. Some have suggested the C++ model for generics is slightly better than that in Ada. I respectfully suggest that the improved flexibility also results in a degradation of reliability. But reliability has been widely deprecated as less important that ease of development. Ada generics, as well as Eiffel and C++ generics, do make the creation of extensible containers more sensible. In my experience, combining genericity with inheritance in Ada is quite useful. It is also helpful that we can dispatch on the result of a function when designing such containers. Child library units have turned out to be more powerful than I originally expected. I now use the package body to implement only the declarations in the specification. All supporting code within a body is now promoted to a child library unit. This has provided support for creating aspects, something we could not do easily with Ada 83, and something I see as more challenging in C++ than in Ada (though not impossible). As as consequence, I see Ada as quite friendly to the new model of Aspect-Oriented Programming, while still enforcing a strong model of encapsulation. Any tool, used unwisely, is a fool's tool. Genericity, when used intelligently, continues to be a valuable component of the Ada language. The addition of generic formal package parameters in Ada 95 has proven to be an excellent addition, even though a great many programmers are confused by it because the ALRM does not provide a simple and fully coded example. I do provide such a example in "Ada Distilled." I just returned from presenting a two week software engineering seminar in Asia. I used Ada to demonstrate my programming examples. The students, none of whom had seen Ada before, found the examples easy to read, understand, and ask questions about. If I had been using C++ for a similar audience, one that had never seen C++ before, I suspect I would have had a classroom full of confused students. Even my example using an Ada generic component was easy to follow for these students, even though English was not their native language. Some of them plan to download GNAT and experiment with Ada. Everyone of them agreed that C++ is so confusing that they spend a huge amount of time correcting errors that they wish had been caught by the compiler. Many had already rejected C++ in favor of Java, Python, and other languages because they found C++ so difficult. Ada can be made accessible to new students. We simply need to learn how to present what the students need when they need it, and to show them simple solutions they can use to work out their own problems. Richard Riehle