Stage 1 · Lesson 4 of 7
Functions, classes and objects
Once a program passes 100 lines, structure matters more than syntax. Split the work into small functions that each do one job. Give each function its input as , instead of letting it read (values the whole program can change).
Then learn . An object bundles data with the methods, or functions, that act on it: an Expense with an amount, a category and a method that formats it. Keeping that data inside the object, and changing it only through its methods, is called .
Your object-oriented programming course teaches the vocabulary; here you use it on your own programs. Start with plain functions, and add a class when several functions share the same data. Prefer : give a class the object it needs, rather than building a tall family of subclasses.
Common trapwhat courses often reward: deep inheritance trees and a class for everything.
A question to check yourself, an AI practice session and 3 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Python Fundamentals
Design Gurus · Beginner · $50
If Python is your language: short lessons with an in-browser exercise after each one
- CourseFreeCS50: Introduction to Computer Science
Harvard University · Beginner
The free course your first year should have been: C, memory, then Python, with hard problem sets