Skip to content

matmusoevuob/Python-OOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Plan to Learn Python OOP

Purpose

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.

Learning Objectives

  • 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.

Suggested Timeline (6 weeks)

  • Week 1 — Fundamentals
    • Python class syntax, instances, __init__, instance vs class attributes, simple methods.
    • Exercises: define classes for Point, Rectangle, and simple Account.
  • Week 2 — Encapsulation & Properties
    • Access control (convention), properties (@property), private attributes, data validation.
    • Exercises: add validation to Account, implement read-only computed properties.
  • Week 3 — Inheritance & Polymorphism
    • Base classes, subclassing, method overriding, super(), abstract base classes with abc.
    • Exercises: create Employee hierarchy and shape classes with polymorphic area calculation.
  • 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 unittest or pytest, mocking, refactoring for testability.
    • Exercises: write tests for earlier classes and refactor to improve design.
  • 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.

Key Topics & Resources

  • 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: pytest docs and tutorials

Exercises & Mini-Projects (examples)

  • Implement a bank account system with deposit/withdraw, transfer, and statement.
  • Create a shape library with Shape base class and Circle, Rectangle subclasses.
  • Build a contact manager CLI using composition for storage and validation.
  • Mini-game: simple RPG character classes with equipment (composition) and combat (methods).

Milestones & Assessment

  • 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.

Progress Tracking

  • 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.

Weekly Log Example

  • 2026-05-19 — 1.5h — Read about @property, implemented Account validation. Next: inheritance.

Study Tips

  • 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.

How to use this README

  • Follow the weekly plan and pick exercises that interest you.
  • Use main.py as 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.

About

Learning OOP in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages