Skip to content

Encapsulation

Bundling data with the operations that act on it, while restricting direct access to internals, creates self-contained units that manage their own consistency

Tension Addressed

Coupling vs. Flexibility

Recognizable As

Objects with private state and public methods; modules with clear interfaces; data structures paired with manipulation functions; the principle that data and behavior should live together

Canonical Sources

Kay, Smalltalk design principles (1970s); Meyer, "Object-Oriented Software Construction" (1988)

Transfers To

Biology (cells with membranes), Organizations (departments with interfaces), Hardware (chips with defined pins), Legal Entities (corporations as encapsulated liability)

Encapsulation differs from information hiding. Encapsulation is about bundling; information hiding is about what to expose. Both are necessary but address different concerns.