More on Encapsulation
The notation for object model encapsulation is shown below. Methods are shown at the bottom of the class notation.
Code and data were not always packaged together. At one time, for example, it was necessary to define an age calculation in each application or have a library that contained the age calculation routine. Having an age calculation or any routine, replicated in many applications may make it difficult to ensure that a change in the routine was made everywhere that it is used. Using a library improves this situation if use of the library is enforced. Nevertheless, with a library, you can never be sure which routine is supposed to be used with which data. It is entirely possible to execute the right code on the wrong data or the wrong code on the right data.
Object systems recognize which methods belong to which data. You cannot execute the right method on the wrong data as you could with library systems. The correct execution of methods is called dispatching, and it is handled by the object system. See dispatching.
More on the general topic: Encapsulation
You may use this material for your work or classes. Reprint Policy. Be sure to check the menu at the left for other articles available on this site.
The Savvy Manager's Guide
Douglas K Barry is also the author of a book that explains Web Services, service-oriented architecture, and Cloud Computing in an easy-to-understand, non-technical manner.
Web Services, Service-Oriented Architectures, and Cloud Computing: The Savvy Manager's Guide (Second Edition)
by Douglas K Barry with David Dick
This is a guide for the savvy manager who wants to capitalize on the wave of change that is occurring with Web Services, service-oriented architecture, and—more recently—Cloud Computing. The changes wrought by these technologies will require both a basic grasp of the technologies and an effective way to deal with how these changes will affect the people who build and use the systems in our organizations. This book covers both issues. Managers at all levels of all organizations must be aware of both the changes that we are now seeing and ways to deal with issues created by those changes.