comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: List container straw man (NJR V4)
Date: Sat, 17 Nov 2001 20:47:50 GMT
Date: 2001-11-17T20:47:50+00:00	[thread overview]
Message-ID: <3BF6CCD6.F7195928@acm.org> (raw)
In-Reply-To: 9t69pc$jh6l$2@ID-25716.news.dfncis.de

Nick Roberts wrote:
> 
> Okay, I've popped my own proposal on a web site:
> 
> http://www.adaos.ukf.net
> 
> with pointers to the rivals^H^H^H^H^H^Halternatives I'm aware of. Do please
> pay a visit.

This is difficult to understand. This is the only place I've ever seen
the concept of "cursorage"; it is certainly not a standard list concept.
Combining the indexed operations and the cursor-based operations is
called control coupling and makes the operations difficult to
understand.

The use of undefined types is confusing. I suppose they're declared in
the parent package, but since we can't see the parent package it's still
confusing.

The use of an abstract type and operations followed by a non-abstract
extension and non-abstract operations doubles the size of the
specification without adding any value that I can see. Every concrete
list is going to have to declare and implement every operation, so
declaring them abstract an additional time seems like a waste of time.

Is_Empty and Length are basic list operations that are missing.

A component should not raise predefined exceptions such as
Constraint_Error. Use meaningful exceptions such as Cursor_Is_Null.

A concrete implementation should document the time complexity of every
operation, so the client can make appropriate choices of operations.
This argues against putting them in the private part. For an unbounded
list, the time complexity of the string- and dequeue-like operations
will be O(N), since they will have to do deep copies. The time
complexity of the indexed operations will be O(N), since they have to
count down the list. The cursor-based operations will tend to be O(1);
since they have the lowest time complexity they should be the preferred
operations and should therefore be presented first.

Each operation should document its pre- and post-conditions, where
applicable. Each operation should document what exceptions it may raise
and under what circumstances; since exceptions are generally indications
that the client has violated a precondition, the documentation for
preconditions is usually a good place to document exceptions.

With some more work this could be an acceptable standard specification.

-- 
Jeff Carter
"Hello! Smelly English K...niggets."
Monty Python & the Holy Grail



  parent reply	other threads:[~2001-11-17 20:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-16  0:14 List container straw man (NJR V4) Nick Roberts
2001-11-17 18:22 ` Nick Roberts
2001-11-17 19:26   ` Stephen Leake
2001-11-17 23:30     ` Nick Roberts
2001-11-17 20:47   ` Jeffrey Carter [this message]
2001-11-17 23:44     ` Nick Roberts
2001-11-20 19:39       ` Mark Lundquist
2001-11-19 17:14   ` Ted Dennison
2001-11-22  3:18     ` Nick Roberts
replies disabled

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