Object-Oriented Programming (OOP)

Learn OOP the right way: classes and objects, encapsulation, abstraction, inheritance, polymorphism, composition, UML, SOLID, equals/hashCode and design.

Start course →

What you'll learn

  • Explain classes, objects, references, constructors and static members, and why OOP organises code around objects.
  • Apply encapsulation and abstraction with access modifiers, immutable classes, abstract classes and interfaces.
  • Use inheritance and overriding correctly, and recognise fragile base classes and the diamond problem.
  • Explain compile-time and run-time polymorphism, dynamic dispatch and programming to interfaces.
  • Model relationships with association, aggregation, composition and UML, and apply the SOLID principles.
  • Implement equality, resource handling and contracts correctly, and design classes from real requirements.

Syllabus

Classes and Objects

  1. Why Object-Oriented Programming
  2. Classes, Objects, State and Identity
  3. Constructors, this and Static Members

Encapsulation and Abstraction

  1. Encapsulation and Access Modifiers
  2. Immutable Objects
  3. Abstraction, Abstract Classes and Interfaces

Inheritance

  1. Inheritance, super and Constructor Chaining
  2. Method Overriding Rules
  3. When Inheritance Goes Wrong

Polymorphism

  1. Compile-Time Polymorphism: Overloading
  2. Run-Time Polymorphism and Dynamic Dispatch
  3. Programming to Interfaces and Duck Typing

Relationships Between Classes

  1. Association, Aggregation and Composition
  2. Composition Over Inheritance and Delegation
  3. UML Class Diagrams

SOLID Design Principles

  1. Single Responsibility and Open/Closed
  2. Liskov Substitution and Interface Segregation
  3. Dependency Inversion and Dependency Injection

Object Behaviour: Equality, Lifecycle and Errors

  1. Identity, Equality and Hashing
  2. Object Lifecycle, Copying and Resources
  3. Exceptions and Design by Contract

Object-Oriented Design in Practice and Revision

  1. From Requirements to Classes
  2. OOP Across Languages
  3. Common OOP Mistakes
  4. Revision and Interview Questions