LISTSERV mailing list manager LISTSERV 16.0

Help for TEAM-ADA Archives


TEAM-ADA Archives

TEAM-ADA Archives


TEAM-ADA@LISTSERV.ACM.ORG


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

TEAM-ADA Home

TEAM-ADA Home

TEAM-ADA  August 1998

TEAM-ADA August 1998

Subject:

Re: Release 0.6 of the ASL containers

From:

Corey Minyard <[log in to unmask]>

Reply-To:

Corey Minyard <[log in to unmask]>

Date:

Thu, 20 Aug 1998 16:14:02 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (129 lines)

"Robert I. Eachus" <[log in to unmask]> writes:

Thanks for the comments.  I'll think some more about some of these
things, I don't think my way is necessarily better, I'm just giving my
rationale for the decisions I made.

>
>    ( I'm sending this to you directly, but if you want to copy your reply
> to TEAM-ADA, I have no problem with that.)

I will.  These are good comments.

>
>    I've started to look at your components.  What follows are a couple of
> questions and comments.  Much of this is questions of style, I'm not saying
> what you did is wrong, I'm just feeling around for "more right."
>
>    1) Why is Limited_Object derived from Controlled, not Limited_Controlled?

That's a mistake.  Thanks for the info.

>
>    2) Why have the Baseclass package at all?  There seems to be no
> generality gained by not declaring these types in Asgc.  Usually this
> structure is chosen to avoid some elaboration order problems, but I don't
> see any currently.

The idea of Baseclass is not really for generality at that level.  The
Asgc object could have been its own tagged type and everything would
have worked fine.

However, after using Java for a while and doing work in object-based
fault-tolerance, I find that it is quite convenient to have all
classes in the system derive from one base class.  That way containers
of more general objects can be built, all objects can be treated the
same at certain levels, etc.  Also, making handling general interfaces
(like Java, a special form of multiple inheritance) more general to be
useful, too.  So the expectation is the user would derive from
Baseclass.Object, too, for their tagged types.

So it is not required, but it seems to me to be more convenient.
It's not that big a deal, though.

>
>    3) Personally, I would find it more appropriate to make the generic type
> Object instead of Contained_Type, and to have the container classes derive
> from a root type Container:
>
>    type List is new Container with private;
>    ...
> (and in asgc.lists.fixed:)
>    type Fixed_List is new List with private;
>
>    4) My style for doing this would be to have a single non-generic parent
> package, each of the types of container as a non-generic child, and finally
> the "real" packages as generic grandchildren with the Contained_Type
> (renamed ;-) as a generic parameter.

I wanted to push generality as far down the package hierarchy as I
could.  So, for instance, you can take any container and search it,
get values from it, etc.  Without the genericity pushed all the way
down the package hierarchy, that was not possible except for a very
limited set of operations.  Making things as general as possible as
far down the package hierarchy as possible allows the most allows the
most flexibility for replacing containers, too.

If for instance, I am using a fixed doubly linked list and later on I
determine that I need a dynamic list, or that I need to use an
array-based list (AList), etc. I can instantiate the variable with a
different package in one place (if the variable is as generic as
possible) and the job is done.  There are other useful ways to
accomplish this, too, such as renaming the packages you want and then
working with those package names exclusively.

My examples currently don't do this, I probably need to add some that
do and add some documentation that this is my intent.  The test
routines do take advantage of this.  For instance, there is one
routine to test graphs, but nine different types of graphs.  The
routine takes a generic graph baseclass and does the tests, it gets
called with nine different types of graphs.

The main disadvantage I have seen so far is that lots of package
instantiation has to be done.  It's kind of a pain, but I don't think
it contributes much to executable bloat because all but the "leaf"
packages tend to be very abstract and quite small.

>
>    5) You have many different access types named Object_Class.  This
> creates a painful confusion if you use more than one container type in a
> program.  It would be nice to have Container_Class, List_Class,
> Fixed_List_Class, etc.  Better might be to name them _Pointer, or _Handle,
> but that is a different discussion.

I have quit following that discussion :-).  _Handle might be a better
name, but I really wanted to convey that fact that is is class-wide.
(I use _Ptr for things that are not class-wide).  Anyway, I believe
that having everything as an Object and Object_Class makes things less
confusing, not more.  I don't like to "use" packages unless they are
very familiar, I like to rename them to what I want and use that name
throughout.  So for the the containers, you might take a doubly linked
list (DList) and use it as a queue.  You would rename or instantiate
the DList package you wanted to be a Queue package, but wouldn't "use"
the Queue package.  Then you would say something like:

  package Integer_Base is new Asgc(Contained_Type => Integer);
  package Integer_Queue is new Integer_Base.Ordered;
  package Integer_Queue_DList is new Integer_Queue.DList;
  package Integer_Dynamic_Queue_DList is new Integer_Queue_Dlist.Fixed;

Then later on, instantiate it with:

  My_Queue : Integer_Queue.Object_Class
               := new Integer_Dynamic_Queue_Dlist.Object;

Then I would use the methods defined in Integer_Queue to operate on
the queue.

If it was done the way you suggest, you would end up saying:

  My_Queue : Integer_Queue.Dynamic_DList_Ptr
               := new Integer_Queue.Dynamic_DList;

which I don't like as much, personally.  However, as threads on
comp.lang.ada show, there are quite a few opinions on this :-).

--
Corey Minyard               Internet:  [log in to unmask]
  Work: [log in to unmask]       UUCP:  [log in to unmask]

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

December 2017
November 2017
October 2017
September 2017
June 2017
May 2017
April 2017
January 2017
December 2016
November 2016
October 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
December 2010
November 2010
October 2010
September 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
June 2007
May 2007
March 2007
February 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
January 2001
December 2000
November 2000
October 2000
September 2000
August 2000
July 2000
June 2000
May 2000
April 2000
March 2000
February 2000
January 2000
December 1999
November 1999
October 1999
September 1999
August 1999
July 1999
June 1999
May 1999
April 1999
March 1999
February 1999
January 1999
December 1998
November 1998
October 1998
September 1998
August 1998
July 1998
June 1998
May 1998
April 1998
March 1998
February 1998
January 1998
December 1997
November 1997
October 1997
September 1997
August 1997
July 1997
June 1997
May 1997
April 1997
March 1997
February 1997
January 1997
December 1996
November 1996
October 1996

ATOM RSS1 RSS2



LISTSERV.ACM.ORG

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager