| February 02, 2006 08:19:40 |
#4 |
| Scott Sehlhorst |
Testing Expert Member Since: February 2006 Total Comments: 8 |
RE: 1.why do we need encapsulation?2. what is a ... |
| We need encapsulation to minimize the cost of maintaining the code. When we hide the internal structure of an object, we force other objects to talk to it through a specific API. This is contract based programming. Now we can test just this object (API inputs and inspect outputs) independently of other classes. We can also make changes to this class without affecting other parts of the software - because the changes are encapsulated to the single class.Also makes it easier for multiple people to work on the same project in parallel. |
| |