Web Development · WDC-88

Python OOP

Python OOP is an intermediate course in object-oriented Python, from object thinking and class design to encapsulation, inheritance, polymorphism, dataclasses, protocols and type hints checked with mypy, through to SOLID principles and Pythonic design patterns. It suits developers who have written Python for a while and team leads who set coding standards.

Updated
From 8,550 THB / person 9,500 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration18 hours · 3 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Object-oriented programming (OOP) keeps growing Python code readable, easy to change and reusable, because it groups data and the behaviour that belongs to it into objects with clear responsibilities. Widely used frameworks such as Django, FastAPI and pytest are designed this way, so people who understand OOP can read and extend framework code much faster.

This course takes people who can already write Python through object-oriented thinking and design, from identifying objects in a problem and writing classes and objects to applying abstraction, encapsulation, inheritance and polymorphism. Learners use dataclasses, abstract classes and protocols, check types with type hints, and move on to the SOLID principles and commonly used design patterns written the Python way, finishing by refactoring an existing script into object-oriented code with tests. (3 days, 6 hours per day, 18 hours in total, Intermediate level.)

What you’ll gain

  • Understand the reasons for and principles of object-oriented thinking compared with procedural code
  • Design classes from a problem and write classes and objects in Python
  • Apply abstraction, encapsulation, inheritance and polymorphism in the right places
  • Use dataclasses, dunder methods, abstract classes and protocols
  • Check the types in object-oriented code with type hints and mypy
  • Apply the SOLID principles and composition to design code that is easy to change
  • Choose and write commonly used design patterns in a way that suits Python
  • Write tests with pytest so code can be restructured with confidence

Who this course is for

  • Developers who have written Python for a while and want better-structured code
  • Those who have finished a basic Python course and want to move on to web application development
  • IT managers and team leads who review Python code and set coding standards
  • Students and teachers who want to understand OOP and design patterns in Python

Prerequisites

  • Able to program in Python, including variables, conditions, loops, functions, lists and dictionaries
  • Have written Python for a while or completed a basic Python course
  • Able to use the command line and VS Code at a basic level
  • A laptop on which you can install software

Curriculum

Course Details

This course is the 2026 edition of Python OOP. It runs for 3 days, 6 hours per day (18 hours in total, 09:00-16:00), as lectures with labs. Intermediate level. This edition moves to Python 3.14 with projects managed by uv, adds dataclasses, typing.Protocol, the new generic syntax, the @override decorator and type checking with mypy, adds the SOLID principles and composition, and teaches design patterns the way they suit Python rather

than translating code from other languages line by line. It keeps the original core of object-oriented thinking, classes and objects, abstraction, encapsulation, inheritance, polymorphism, abstract classes and design patterns such as Singleton, Composite, Factory Method, Observer and Strategy, and finishes with a workshop that refactors an existing script into object-oriented code with tests in pytest. Every lab uses open source or free tools. Learners take home a lab guide and the source code.

Day 1 Thinking in Objects and Writing Good Classes

Section 1: Lab: Setting Up and Why OOP

  • Install uv, let it install Python 3.14 and create a project
  • Set up VS Code, Ruff and pytest for the whole course
  • Procedural code compared with OOP: pros, cons and where each fits
  • The problems of scripts that grow without structure
  • Lab: read the original shop script and find the parts that are hard to change

Section 2: Object Thinking and Class Design

  • What an object is: state and behaviour
  • Identify objects and their responsibilities from a problem
  • Abstraction: keep only what the system needs to know
  • Read and draw basic UML class diagrams
  • Workshop: design the classes of a shop system on paper

Section 3: Lab: Classes and Objects in Python

  • Declare a class, the __init__ method and the meaning of self
  • Instance attributes compared with class attributes
  • Regular methods, @classmethod and @staticmethod
  • Add type hints to attributes and methods
  • Lab: product, customer and shopping cart classes

Section 4: Lab: Encapsulation and Properties

  • Encapsulation and Python's _ and __ naming conventions
  • Control reading and changing values with @property and setters
  • Validate data and raise clear errors
  • Immutable objects and when to use them
  • Lab: prevent negative prices and insufficient stock in the cart

Section 5: Lab: Dunder Methods and Dataclasses

  • The Python data model with __repr__, __str__ and __eq__
  • Compare and sort objects with __lt__ and total_ordering
  • Make objects iterable with __len__ and __iter__ and use them with with
  • @dataclass with field, frozen, slots and kw_only
  • Lab: rewrite the product class with a dataclass to make it shorter
Day 2 Inheritance, Polymorphism and Flexible Design

Section 6: Lab: Inheritance and the MRO

  • Inherit from a class and call the parent with super()
  • Override methods with the @override decorator from typing
  • Multiple inheritance and the method resolution order (MRO)
  • Mixins that add small capabilities to several classes
  • Lab: regular customers and members with different discounts

Section 7: Polymorphism and Duck Typing

  • What polymorphism is and calling the same method on different objects
  • Duck typing, the idea Python uses instead of enforcing types
  • Operator overloading with __add__ and related methods
  • Dispatch by type with singledispatchmethod and match
  • Lab: several payment channels used through one piece of code

Section 8: Lab: Abstract Classes and Protocols

  • Abstract classes with the abc module, ABC and @abstractmethod
  • The difference between ordinary classes and abstract classes
  • Python-style interfaces with typing.Protocol
  • Runtime checks with @runtime_checkable and their limits
  • Lab: define the contract for a delivery system and write several implementations

Section 9: Composition and the SOLID Principles

  • Composition over inheritance and signs of too much inheritance
  • Single responsibility and open/closed
  • Liskov substitution, interface segregation and dependency inversion
  • Pass dependencies through the constructor to make testing easy
  • Workshop: change the shipping cost system to add new rules without editing existing code

Section 10: Lab: Type Hints for Object-Oriented Code

  • The new generic class syntax, such as class Repository[T], and the type statement
  • Self, ClassVar, Final and Enum for constants
  • Deferred evaluation of annotations in Python 3.14
  • Check the whole project with mypy and read its warnings
  • Lab: a generic repository for products and customers
Day 3 Pythonic Design Patterns and Workshop

Section 11: Design Patterns and Creational Patterns

  • What design patterns are, their Gang of Four origins and the three main groups
  • When to use a pattern and when Python offers a simpler way
  • Singleton with __new__ compared with a module-level object, and the caveats
  • Factory Method and a registry built from a dictionary of classes
  • Lab: create a payment connector from configuration

Section 12: Lab: Structural Patterns

  • Composite for tree-shaped data such as product categories
  • Adapter to connect external libraries with mismatched interfaces
  • The Decorator pattern compared with Python decorators
  • Facade to hide a complex subsystem behind one method
  • Lab: multi-level product categories and a shipping data adapter

Section 13: Lab: Observer and Strategy

  • Observer to notify several parts of the system without tight coupling
  • Strategy to switch calculation methods at run time
  • Use functions and callables instead of classes, the Python way
  • Choose between Strategy and inheritance
  • Lab: order notifications and several kinds of discount

Section 14: Other Common Behavioural Patterns

  • Command to store actions for repeating or undoing
  • State to change behaviour with the status of an order
  • Template Method to set the main steps for subclasses to fill in
  • Iterators with generators and yield
  • Lab: order states from awaiting payment to delivered

Section 15: Workshop: Refactoring to OOP with Tests

  • Write tests with pytest and fixtures before restructuring
  • Use test doubles in place of external dependencies
  • Refactor the original shop script into classes and patterns step by step
  • Use an AI assistant to explain code and suggest refactorings, and always check the result yourself
  • Workshop: an object-oriented shop system that passes tests, Ruff and mypy

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How do you create a class and an object in Python?

Declare the class with the class keyword and its name, then write an __init__ method to set the object's initial values, with self as the first parameter, meaning the object itself. Store data as attributes on self and create an object by calling the class like a function. When a class mainly holds data, @dataclass lets Python generate __init__, __repr__ and __eq__ automatically from the type hints of each field.

How do you create abstract classes and interfaces in Python?

Python has no interface or abstract keyword, so you use the abc module: inherit from ABC and mark the methods subclasses must implement with @abstractmethod. A subclass that does not implement them all cannot be instantiated. When you only need to state which methods an object must have without forcing inheritance, use typing.Protocol with a type checker such as mypy, which fits Python's duck typing approach.

How do you implement the Singleton pattern in Python?

A singleton guarantees that a class has only one instance in the whole program, such as a configuration object. A common approach is to override __new__ so it returns the existing instance if there is one, but a simpler, more Pythonic option is to create the object in a module and import it, since a module is loaded only once. Use singletons sparingly, as they make testing harder; passing the object in through the constructor is often more flexible.

Who is the Python OOP course for, and what should I know beforehand?

It suits developers who have written Python for a while, people who have finished a basic Python course and want to move on to web applications, IT managers and team leads who review code, and students and teachers. You should already write Python, including variables, conditions, loops, functions, lists and dictionaries, and be able to use the command line and VS Code at a basic level.

What will I be able to do after the Python OOP course?

You will be able to design object-oriented programs in Python, write classes and objects, apply abstraction, encapsulation, inheritance and polymorphism, use dataclasses, abstract classes and protocols, check types with mypy, structure code with the SOLID principles and design patterns such as Singleton, Factory Method, Composite, Observer and Strategy, and refactor existing code with tests in place. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the Python OOP course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your own work, such as restructuring Python scripts or systems your team maintains into an object-oriented design with tests. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.