📦 Object-Oriented Programming

Classes and objects, the four pillars (encapsulation, abstraction, inheritance, polymorphism), composition over inheritance, interfaces vs abstract classes, object relationships, and common mistakes and interview questions, explained with real-life analogies and short TypeScript examples.

10 lessons · about 0.8 hours

Start the first lesson →
  1. 01What Is Object-Oriented Programming? OOP organizes code around objects, small units that bundle data with the behavior that uses it. See how it differs from procedural code and meet the four pillars.Beginner4 min read
  2. 02Classes and Objects A class is a blueprint and an object is a thing built from it. Learn constructors, properties, methods, this, and static members with simple examples.Beginner4 min read
  3. 03Encapsulation Keep an object's data private and let it change only through its own methods. Learn access modifiers, getters and setters, and how encapsulation protects business rules.Beginner4 min read
  4. 04Abstraction Show what an object does and hide how it does it. Learn how abstraction keeps code simple to use, and how interfaces and abstract classes express it.Beginner4 min read
  5. 05Inheritance Build a new class on top of an existing one to reuse its code. Learn extends, super, method overriding, the "is-a" test, and when inheritance causes more harm than good.Beginner4 min read
  6. 06Polymorphism One method call, many behaviors. Learn how polymorphism lets you treat different objects the same way, replace long if/else chains, and add new types without changing old code.Beginner5 min read
  7. 07Composition over Inheritance Build objects from small, swappable parts instead of deep class trees. Learn the "has-a" test, why inheritance hierarchies explode, and how composition keeps code flexible.Intermediate5 min read
  8. 08Interfaces vs Abstract Classes An interface is a contract with no code; an abstract class is a half-built parent with shared code. Learn the difference, how to use each in TypeScript, and how to choose.Intermediate5 min read
  9. 09Object Relationships: Association, Aggregation and Composition Objects work together in four common ways. Learn dependency, association, aggregation and composition with everyday examples, code, and how to draw them in UML class diagrams.Intermediate5 min read
  10. 10OOP Mistakes and Interview Questions The most common OOP mistakes (god classes, anemic models, deep hierarchies, getters for everything) and clear answers to the OOP questions interviewers ask most.Intermediate7 min read