comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Package hierarchy. Extensibility.
Date: Thu, 12 Mar 2009 09:26:41 +0200
Date: 2009-03-12T09:26:41+02:00	[thread overview]
Message-ID: <49b8b91d$0$14980$4f793bc4@news.tdc.fi> (raw)
In-Reply-To: <91c9292b-d661-4744-bed2-b9c8a6305196@d19g2000yqb.googlegroups.com>

Jarno Neniu wrote:
> Hello. I'm not able to decide about which design is the best
> (extensibility, maintainability and recompilation friendliness are
> important), so I'm demanding for any humble and not so humble
> opinions. As an example of hierarchy consider representation of
> geometrical points. One of representations is preferable and
> considered to be the main representation (Cartesian 2D and 3D points),
> but there is unspecified amount of other representations, which could
> be added to the system later (points in polar, spherical, cylindrical
> coordinate systems). Conversion between representations should be
> somehow available and it is desirable for representations to be
> generic. Which is the best way to design the hierarchy? Should it be
> something like this:
> 
> package Points is
>    --  Preferable representation. Cartesian point.
>    type Point is ...
> end Points;
> 
> package Points.Spherical is
>    type Spherical_Point is ...
> end Points.Spherical;
> 
> package Points.Cylindrical is
>    type Cylindrical_Point is ...
> end Points.Cylindrical;
> 
> Or should it be dummy package �Points� to which other representations
> are connected:
> 
> package Points is
> end Points;
> 
> package Points.Cartesian is
>    type Cartesian_Point is ...
> end Points.Cartesian;
> 
> package Points.Spherical is
>    type Spherical_Point is ...
> end Points.Spherical;
> 
> Something else?

An interface type that defines the common view of "Points" of 
whatever representation? That would allow non-hierarchical and 
independent implementations of the representations as long as every 
representation implements this interface.


-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  reply	other threads:[~2009-03-12  7:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  0:02 Package hierarchy. Extensibility Jarno Neniu
2009-03-12  7:26 ` Niklas Holsti [this message]
2009-03-13  1:31   ` Jarno
2009-03-13 10:58     ` Niklas Holsti
2009-03-13 11:03       ` Niklas Holsti
replies disabled

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