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: 103376,3ad42f911d53327e X-Google-Attributes: gid103376,public From: Dale Stanbrough Subject: Re: Object Oreinted Style Date: 2000/03/28 Message-ID: #1/1 X-Deja-AN: 603378039 References: <8bq4hh$psj$1@ssauraac-i-1.production.compuserve.com> Posted-And-Mailed: yes X-Trace: 29 Mar 2000 00:13:10 GMT, r1021c-02.ppp.cs.rmit.edu.au Organization: RMIT User-Agent: MT-NewsWatcher/3.0 (PPC) Newsgroups: comp.lang.ada Date: 2000-03-28T00:00:00+00:00 List-Id: Michael Garrett wrote: > > In "Object Oriented Software in Ada 95" Michael A. Smith uses the package > as > a "class" construct, putting one tagged type and it's associated > operations > into a single package, and derived types in there own top level ( NON > child ) packages. He warns against breaking encapsulation rules by > deriving > types in child packages. In the booch components, derived types are > declared > included in child packages. In a large embedded system, which method > would > make for more maintainable > code, one type per package, or a "class" multiple derived types? Packages are (almost) orthogonal to the concept of type in Ada. You can construct an OO hierachy in Ada by declaring every single type in a single package. At the other extreme you could declare each type in a single package, where the packages are not related to each other (apart from the 'with' relationship required so you can declare a child type). The questions you have to ask are "what sort of changes am I likely to make in the future" and "what is the best way to package these things so that people will be able to easily understand and navigate around my large program" Def. child packages "open up" the full view of a parent type declared in a parent package, and in this regard invite abuse by preventing total encapsulation. On the other hand hierachical packages are a wonderful mechanism for dealing with understandability in program design. On the balance i'ld be inclined to go with hierachical packages (and perhaps you could invest in some ASIS developement to ensure your programmers don't abuse the "opened" types too much). Dale