Professional Documents
Culture Documents
On Understanding Data Abstraction Revisited
On Understanding Data Abstraction Revisited
On Understanding Data Abstraction Revisited
net/publication/221321133
CITATIONS READS
34 638
1 author:
William R. Cook
University of Texas at Austin
120 PUBLICATIONS 3,721 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by William R. Cook on 31 May 2014.
William R. Cook
University of Texas at Austin
wcook@cs.utexas.edu
Figure 7. Object-oriented integer set interface Insert(s, n) = if s(n) then s else µ this. {
isEmpty = false,
contains = λi. (i = n or s(i))
insert = λi. Insert(this, i)
union = λs. Union(this, s)
concepts do not apply in this case. One might say that }
this approach represents sets as functions from integers to
booleans. But this ‘representation’ looks like an interface, Union(s1 , s2 ) = µ this. {
not a concrete representation. isEmpty = false,
Note that there is no “contains” operation, because the contains = λi. (s1 (i) or s2 (i))
set itself is the contains operation. Although it may not seem insert = λi. Insert(this, i)
like it, the characteristic function is the pure object-oriented union = λs. Union(this, s)
approach to defining integer sets. You may not accept this }
statement immediately, because I have not talked about any
classes, methods, or inheritance, which are supposed to be
characteristic of objects.
Figure 8. Object-oriented integer set implementations