• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

What’s Being Compared

The four fundamental principles of object-oriented programming in Java: encapsulation, inheritance, polymorphism, and abstraction. Each addresses a distinct concern in software design, but together they form a cohesive paradigm.

The Core Tension

The four pillars balance competing goals: encapsulation hides state (safety), inheritance shares code (reuse), polymorphism enables flexibility (adaptability), and abstraction reduces complexity (clarity). Over-emphasizing any one pillar leads to design problems — rigid hierarchies from overusing inheritance, or anemic models from over-encapsulation.

Comparison

DimensionEncapsulationInheritancePolymorphismAbstraction
PurposeData hidingCode reuseRuntime flexibilityComplexity reduction
MechanismAccess modifiers, getters/settersextends, superMethod overriding, overloadingAbstract classes, interfaces
Java keywordprivate, protectedextends@Override, overloaded namesabstract, interface
Anti-patternAnemic domain modelDeep hierarchy, fragile base classType-checking with instanceofLeaky abstraction

The Insight

The four pillars are not independent — they reinforce each other. Encapsulation protects the internal state that inheritance extends. Polymorphism enables the runtime dispatch that abstraction promises. A well-designed Java class system uses all four in concert: encapsulation hides data, inheritance shares behavior, abstraction defines contracts, and polymorphism enables substitution.

Visual Explanation

java_oop_pillars A Java Oop Pillars Input B Java Oop Pillars Core Mechanism A->B triggers C Java Oop Pillars Output B->C produces

Semantic Network

semantic_java_oop_pillars THIS Java Oop Pillars REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Connections