CS core subjects

Stage 2 · Lesson 5 of 8

Abstraction, interfaces and abstract classes

Object-oriented programming and design

means depending on what something does, not on how it does it. An interface names a set of operations, such as save(order), without saying how they work. An abstract class can do the same.

The rest of the program then works the same way whether orders go to a database, a file or a fake store used in tests. An interface is a pure contract: a promise that certain operations exist. An abstract class can also share some code and data with its subclasses.

This is the tool that makes and testing practical. It leads straight into the in SOLID.

Common trapcreating an interface for every class "just in case", which adds files and indirection without any real second implementation.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking SOLID Design Principles

    Design Gurus · Beginner · $50 one-time

    Each SOLID principle with a broken example and its fix, at a beginner-friendly pace

  • CourseFree
    Java Programming MOOC

    University of Helsinki · Beginner

    Free, exercise-heavy course whose second half is a thorough, tested introduction to OOP

Keep handy

Also worth your time

Mark this stage as not done?