Article View: comp.lang.misc
Article #4773Re: Software reuse and WEB.
From: russ
Date: Mon, 29 Jun 1987 14:06
Date: Mon, 29 Jun 1987 14:06
86 lines
4373 bytes
4373 bytes
It's important to distinguish between (parts of) things that can be
reused and things that are designed in order to facilitate reusability.
In article <16556@brunix.UUCP> kbb@nancy (Karl Berry.) writes:
>The recent note on reuse of software made me think of the recent columns
>in Communications of ACM on WEB. [...]
Background: See May 1986 and in particular June 1986 CACM Programming Pearls.
Don Knuth was invited to solve a simple problem using web.
... a user should be able to find the 100 most frequent words in a
twenty-page technical paper ... without undue emotional trauma.
The article listed Knuth's solution, then the review you mention, by Doug
McIlroy, who also gives his own 6-line solution to the problem.
> Maybe we should be trying to reuse lower level chunks of code.
> [...]
> My own experiences with WEB code, on a
> smaller scale, are similar: it's easier to copy not abstract data types,
> but just pieces of code.
easier than what? Pascal? I find it easy, but prefer not to have to do so.
Using routines from libraries is almost always more robust and easier. And
using unix utilities usually leads to a working prototype very quickly.
The Pearls review concludes
Knuth has shown us here how to program intelligently,
but not wisely. I buy the discipline. I do not
buy the result. He has fashioned a sort of industrial-
strength Faberge egg--intricate, wonderfully worked,
refined beyond all ordinary desires, a museum piece
from the start.
Reusing code is a different issue than Abstract Data Types and Object Oriented
Programming. In the former case, an understanding of the implementation of
the code is needed; Web may facilitate this. But in the latter, no knowledge
of the contents of the black box is needed.
It's like the difference between copying the _code_ for the sort routine
each time you want to sort things, or (the Object approach) simply calling
(or "applying") the sort routine.
"A wise engineering solution would produce--or, better,
exploit--reusable parts" [July 1986 CACM p.480]
> I know people do have libraries of abstract data types that get used by
> lots of people. [...] But maybe we should look at both higher AND lower
> levels than abstract data types for reusing code.
Clearly. People who only use things on a Dogmatic Basis
X is an abstract data type <----> I can reuse X
miss out on a lot of good stuff. This is as true in Computing as elsewhere.
Common idioms (i.e. reused bits) in C are things like
while ((c = getchar()) != EOF) { /* process the entire file */
... /* a charcter at a time */
}
and
for (;;) { /* loop forever or until an exception condition */
...
}
and
for (p = src, q = dest; *q++ = *p++; ) ;
/* copy an array object by object */
But I wouldn't bother documenting them. They're known to all experienced
C programmers, and are in a sense part of the language, just as
Don't cross your bridges til you come to them
is part of the English language. You don't really know English until you
can cope with a working subset of idioms and metaphors.
Reusing lumps of code is often dangerous... the better the documentation,
the more likely you are to forget to go over it with a fine comb looking
for that tiny undocumented assumption... This is one of the strong points
of the Object Oriented Camp, that side-effects of routines are either non-
existant or well understood.
It's important to distinguish between (parts of) things that can be
reused and things that are designed in order to facilitate reusability.
Russell
--
Russell Quin, Unixsys UK Ltd, The Genesis Centre, Birchwood, Warrington WA3 7BH
{utai,ukc!mucs}!anduk!russ [please don't try to use mucs!anduk!utai!...]
+44 925 827834, or 0925 828181 from UK; Telex 946240 CWEASY G Ref. 19021810
Technical Details
Message-ID:
<19@anduk.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!man.psy!mucs!mucs2!anduk!russReferences:
<16556@brunix.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!man.psy!mucs!mucs2!anduk!russ From: russ@anduk.UUCP (russ) Newsgroups: comp.lang.misc Subject: Re: Software reuse and WEB. Message-ID: <19@anduk.UUCP> Date: Mon, 29-Jun-87 10:06:12 EDT Article-I.D.: anduk.19 Posted: Mon Jun 29 10:06:12 1987 Date-Received: Sat, 4-Jul-87 17:45:01 EDT References: <16556@brunix.UUCP> Reply-To: russ@anduk.UUCP (russ) Organization: Unixsys (UK) Ltd. Lines: 86