Representational Encapsulation
Data types do not tell the full story of the representation either. Although much of the discussion about object-oriented design is in the direction of structure and syntax—the mechanics of encapsulation—you can make a strong case that meaning is the most important aspect. The purpose of an object and its characteristics need to be at the forefront of your mind as you design and use them. Ideally, the object design guides you toward the correct usage, but mainstream programming languages currently have little provision to encode full semantic intent.
With respect to the usage of an object, all of this protects us from creating objects with inconsistent internal state and provides the object’s implementation avenues ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access