comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Reuse News Brief - 96-07-26.txt [1/1]
Date: 1996/08/09
Date: 1996-08-09T00:00:00+00:00	[thread overview]
Message-ID: <dewar.839594201@schonberg> (raw)
In-Reply-To: 839542173.1185.2@earth3.demon.co.uk


Jeff said

"Cool idea.  And I reuse an awful lot of code.  But remember that
Ariane reused code.  Moral: Document the limits of the component ?"

The other thing is that you have to be careful to make sure that you
have properly parametrized the new use. It is easy sometimes to slip up
on this, and then code reuse can have the same hazards as cut and paste
in an editor -- very useful, we could not do with out this feature in
an editor, but we have all made cut-and-paste errors.

One lesson here is that in building reusable components, it is worth
giving some thought to the interface in terms of making it harder to
make this kind of error. Perhaps someone can come up with a nice example,
here is a trivial one:

  Print_Msg (S : String; N : Natural);
  --  Prints first N characters of string S.

  Print_Msg (S : String);
  --  Prints string S

The second interface is clearly better, since the first has the risk
of copying a call, and replacing the string without adjusting the
count.





      reply	other threads:[~1996-08-09  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-30  0:00 Reuse News Brief - 96-07-26.txt [1/1] ReuseIC
1996-08-08  0:00 ` Jeff Veit
1996-08-09  0:00   ` Robert Dewar [this message]
replies disabled

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