previous up next print clean
Next: Inheritance Up: WHY OBJECT ORIENTATION? Previous: Abstraction

Encapsulation

Jag requires that a vector performs all the operations that are part of the algebraic vector definition. For example, a vector can add itself to another vector of the same vector space or a vector can scale itself with a scalar. Similarly, a Jag operator can apply itself to a compatible input vector and return an output vector. The curious phrase that an inanimate vector adds itself or scales itself expresses the fact that the object-oriented implementation of the addition is carried by each object. Object orientation allows us to wrap algorithms and data structures into functional units, such as vectors that add themselves. Consequently, a solver does not need to know about the implementation details of a vector's addition method, but merely trusts that the standard add() method invokes the correct computations that result in an addition.


previous up next print clean
Next: Inheritance Up: WHY OBJECT ORIENTATION? Previous: Abstraction
Stanford Exploration Project
11/11/1997