| Citations: | 6 - 1 self |
@TECHREPORT{Kniesel96encapsulation=,
author = {Günter Kniesel},
title = {Encapsulation = Visibility + Accessibility},
institution = {},
year = {1996}
}
This paper reviews the relationship of encapsulation and sharing and proposes a unified notion of encapsulation and sharing. We show that the key to a more flexible and more general encapsulation model is the use of access rights in addition to the traditional visibility-based interpretation of encapsulation. The traditional interpretation prevents "private" variables of an object from being accessed, but it does not protect their values, i.e. the objects referenced by these variables. Thus it permits indirect changes to the state of an object, e.g. implicitly changing an address object by changing the street object that it references. In contrast, the access-right-based model allows prevention of such undesired manipulations of an object's state, without excluding sharing of objects. We also consider the interaction of encapsulation with higher forms of sharing like inheritance and delegation. In particular, we refute the claim that delegation breaches encapsulation. This claim is supported neither by the purely visibility-based view of encapsulation nor by the extended one proposed in this paper. Keywords encapsulation, inheritance, delegation, visibility, accessibility TABLE OF CONTENTS 1
Developed at and hosted by The College of Information Sciences and Technology
© 2007-2010 The Pennsylvania State University
