By: Stephan Herrmann
Strictly enforced encapsulation is a key concept for modular software designs. However, in many situations like unanticipated reuse, productivity can be raised by a more flexible approach to encapsulation. Also the discussion about the role of 'obliviousness' in aspect-oriented programming is one instance of a general conflict between strictness and flexibility. Here, different technologies take different stands and the choice of a particular technology locks a project into prioritizing one side over the other. In this paper we suggest that this choice should not be determined by technology but technology should support the co-existence of encapsulation and its inverse -- decapsulation -- within a single system. We postulate four principles that define a solution space, called 'gradual encapsulation', in which each project should find the best fitting balance between encapsulation and decapsulation with the option to shift this balance during the life time of a system. We use the programming language ObjectTeams/Java for illustrating how encapsulation and decapsulation can be supported by technology and how the four principles can be implemented on top of such technology.