Skip to content
Guest
← All References
OOP Language-Agnostic (Java, C#, C++, JS, Python, PHP)

OOP & SOLID Quick Reference

The four pillars of Object-Oriented Programming, inheritance vs. composition, and the five SOLID design principles.

class Service { constructor(repo) { this.repo = repo; } }

The Four Pillars of OOP

PillarMeaningPractical Goal
EncapsulationHide internal state behind public methodsProtect invariants and prevent invalid mutations
AbstractionExpose essential operations, hide complexityKeep callers simple and decoupled
InheritanceSubclass extends a base class (is-a)Share common structure when a true subtype exists
PolymorphismDifferent classes share one method contractPlug in new behavior without if/else chains

The Five SOLID Principles

LetterPrincipleSummary
SSingle ResponsibilityOne class, one focused reason to change
OOpen / ClosedExtend behavior with new classes instead of editing stable ones
LLiskov SubstitutionAny subclass must work safely wherever its parent is expected
IInterface SegregationPrefer small, role-specific interfaces over huge ones
DDependency InversionInject abstractions via constructors rather than hardcoding concretions

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind