CS core subjects

Stage 2 · Lesson 1 of 8

Classes, objects and responsibilities

Object-oriented programming and design

A class describes a kind of thing: the data it holds and what it can do. An is one instance of that class, with its own values. Book might be a class, and each copy in a library is an object.

The useful skill is not the syntax. It is deciding which classes a problem needs and what each one is responsible for. A common method: read the problem, underline the nouns as possible classes and the verbs as possible methods (actions).

Then merge and cut until each class has one clear job. Every later idea, from to , is about keeping those responsibilities clean. A class with one focused job has high , and classes that rely little on each other have low coupling. Both make change easier.

Common trapbuilding classes that only hold data while all the logic lives in one giant "manager" class.

A question to check yourself, an AI practice session and 2 cheat sheet entries 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?