comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@cs.rmit.edu.au>
Subject: Re: Object Oreinted Style
Date: 2000/03/28
Date: 2000-03-28T00:00:00+00:00	[thread overview]
Message-ID: <dale-617BD4.22171828032000@news.rmit.edu.au> (raw)
In-Reply-To: 8bq4hh$psj$1@ssauraac-i-1.production.compuserve.com

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




  reply	other threads:[~2000-03-28  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-28  0:00 Object Oreinted Style Michael Garrett
2000-03-28  0:00 ` Dale Stanbrough [this message]
2000-03-31  0:00   ` Magnus Larsson
2000-03-31  0:00     ` Dale Stanbrough
2000-04-02  0:00       ` Richard D Riehle
2000-04-02  0:00         ` David Botton
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox