DSA Factory
All free lessons
OOP and design

Free Object-oriented basics lessons

9 lessons, about 2 hours in all. Each teaches one idea with a visual, then gives you a problem or a few questions on it. Read the lessons here, then create a free account to practise and keep your progress.

Stage 0Objects and references

  1. Classes, objects and referencesThe difference between a class and an object, what a variable really holds, and why == and equals are not the same.13 min
  2. Constructors, this and staticHow objects get built, what this refers to, and what changes when a member belongs to the class instead of an object.14 min

Stage 1Protecting state

  1. Encapsulation and invariantsWhy fields are private, what an invariant is, and how access modifiers and careful getters keep an object valid.13 min
  2. Immutability and value objectsWhat makes an object immutable, what final does and doesn't do, and why defensive copies matter.12 min

Stage 2Inheritance and polymorphism

  1. InheritanceHow a subclass reuses and extends a class, in what order objects are built, and when inheritance is the wrong tool.13 min
  2. Overriding and overloadingTwo ways the same method name appears twice, decided at different times, and the rules that tell them apart.13 min
  3. Polymorphism and dynamic dispatchHow one call can run different code depending on the object, and the cases where it doesn't happen.14 min

Stage 3Abstraction and design choices

  1. Abstract classes and interfacesTwo ways to define a contract without an implementation, what each can hold, and how to choose between them.13 min
  2. Composition over inheritanceHolding another object and delegating to it, instead of extending it, and when each is the better design.12 min

All of Object-oriented basics is free

That’s the whole topic, from the first idea to the mastery stage, with no card needed. Create a free account to practise, keep your progress and carry on to the next topic.

Create your free account