comp.lang.ada
 help / color / mirror / Atom feed
* Modest proposal, 2 of 3
@ 1996-11-22  0:00 Van Snyder
  1996-11-23  0:00 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Van Snyder @ 1996-11-22  0:00 UTC (permalink / raw)



BACKGROUND

One of the reasons for code-bloat is the way we teach our children to
structure programs.

What Parnas had in mind when he recommended "information hiding" and
"encapsulation" in Comm. ACM (Dec 72) in "On the criteria for dividing
programs into modules" was that one could thereby (almost) change the
representations of objects in a program by changing their declarations,
but not their references -- no matter what representation one chooses,
the references always look the same: a procedure.

Almost.  In the procedures that support an "abstract data type" one must
still cope with changes in representation.

That's not terrible.  The amount of work necessary to change a
representation is reduced from something proportional to the size of a
program to something on the order of the complexity of the data type.
The unfortunate side effect is that it leads to innumerable tiny
procedures.  On the positive side, the design methodology is applicable
to any language.

Geschke and Mitchell had a better idea in IEEE TSE SE-1, 2 (June 75) in
"On the problem of uniform references to data structures":  Design
languages so that differences in representation are not reflected in
references.  So the [] vs () for arrays vs functions in C would be
considered to be a bad idea.

(Actually, Ross described the germs of the idea in Software Engineering
1 (1969) in "Uniform referents: An essential property for a software
enginering language.")

Minor incremental changes could bring Ada to the state of allowing one
to change the representation of objects without changing their
references.

PROPOSAL for next standardization of Ada

Allow objects to be declared in the public part of a package
specification with mode "out".  The meaning is that clients of the
package can reference the variable, but can't store into it.

Thus, a variable that a package publishes with "out" mode has the same
properties as a private variable with a public parameterless function to
access it, and no procedure to update it directly.  But it's more
efficient, and there's less code to write initially, and therefore less
to read and understand when you're the poor schmo assigned to make the
next minor change.

There's more that could be done to make programs more mutable, less
fragile, and more efficient, all at once.  See "Not so modest proposal,
1 of 1" to be posted soon.
-- 
What fraction of Americans believe   |  Van Snyder
Wrestling is real and NASA is fake?  |  vsnyder@math.jpl.nasa.gov




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1996-11-28  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-22  0:00 Modest proposal, 2 of 3 Van Snyder
1996-11-23  0:00 ` Robert Dewar
1996-11-25  0:00 ` Norman H. Cohen
1996-11-26  0:00   ` Ken Garlington
1996-11-28  0:00   ` Richard A. O'Keefe
1996-11-26  0:00 ` Tucker Taft

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