A concise, practical plan to learn Object-Oriented Programming (OOP) in Python. Follow this roadmap week-by-week, complete exercises, and build small projects to reinforce concepts.
- Understand core OOP concepts: classes, objects, attributes, methods, encapsulation, inheritance, polymorphism, and composition.
- Design and implement clean, testable class-based code.
- Apply SOLID principles in Pythonic ways.
- Build small projects that demonstrate OOP design and refactoring.
- Week 1 — Fundamentals
- Python class syntax, instances,
__init__, instance vs class attributes, simple methods. - Exercises: define classes for
Point,Rectangle, and simpleAccount.
- Python class syntax, instances,
- Week 2 — Encapsulation & Properties
- Access control (convention), properties (
@property), private attributes, data validation. - Exercises: add validation to
Account, implement read-only computed properties.
- Access control (convention), properties (
- Week 3 — Inheritance & Polymorphism
- Base classes, subclassing, method overriding,
super(), abstract base classes withabc. - Exercises: create
Employeehierarchy and shape classes with polymorphic area calculation.
- Base classes, subclassing, method overriding,
- Week 4 — Composition & Design Patterns
- Prefer composition, basic design patterns (Factory, Strategy, Observer examples), dependency injection.
- Exercises: implement a Logger strategy or a simple plugin system using composition.
- Week 5 — Testing & Refactoring
- Unit testing classes with
unittestorpytest, mocking, refactoring for testability. - Exercises: write tests for earlier classes and refactor to improve design.
- Unit testing classes with
- Week 6 — Mini-project
- Build a small project: e.g., Task manager CLI, Library inventory, or Simple game entities using OOP.
- Polish with tests, documentation, and readme for the project.
- Official docs: "Classes" and "Data model" sections — https://docs.python.org/3/tutorial/classes.html
- Books/Guides: "Fluent Python" (sections on OOP & data model), "Clean Code" concepts applied to Python
- Tutorials: Real Python articles on OOP, Corey Schafer YouTube series
- Testing:
pytestdocs and tutorials
- Implement a bank account system with deposit/withdraw, transfer, and statement.
- Create a shape library with
Shapebase class andCircle,Rectanglesubclasses. - Build a contact manager CLI using composition for storage and validation.
- Mini-game: simple RPG character classes with equipment (composition) and combat (methods).
- Milestone 1: Implement and test 5 small classes with validation and properties.
- Milestone 2: Design and implement an inheritance-based module with polymorphism.
- Milestone 3: Complete mini-project with tests and README; refactor using design principles.
- Use a weekly checklist in this repo or a personal journal.
- Keep short notes for each session: date, time spent, topics covered, problems encountered, next steps.
- 2026-05-19 — 1.5h — Read about
@property, implementedAccountvalidation. Next: inheritance.
- Code small, often; prefer readable designs over clever shortcuts.
- Write tests early — they document expected behavior and make refactoring safe.
- Read others' code and explain design choices aloud or in notes.
- Iterate: start simple, then add features and refactor.
- Follow the weekly plan and pick exercises that interest you.
- Use
main.pyas your main workspace for experiments, prototypes, and practice code. - Move completed items to your personal tracker or update this file with progress notes.
Good luck! If you want, I can customize this schedule to match your available time/week or generate exercise templates and starter files.