
Object-oriented programming is a paradigm that organizes data into objects with methods defined by classes, emphasizes encapsulation, inheritance, and polymorphism, and supports collaboration and maintainability.
Explore how python is object oriented by default, with every entity, including primitives, as an object with a type (class) and attributes. Appreciate its elegant, consistent design.
Explore the difference between python modules and classes, learn how to import modules, access variables through a module name, and distinguish module versus class with practical examples.
Prepare for this course by mastering debugging and prerequisites, choosing an IDE, and understanding Python 2 vs Python 3 differences, plus essential modules like YAML.
Learn how to choose an integrated development environment or text editor for writing and running Python programs, comparing features like syntax highlighting, debuggers, and convenient workflows across popular tools.
Define core object-oriented terms, explain how classes act as factories and blueprints, and show how instances carry state through attributes and expose methods.
Explore how a class serves as a blueprint to create instances, access class-defined variables, and distinguish objects by identity through attributes and memory addresses.
Explore how instance methods access class variables through the instance and how Python automatically passes the instance as the first argument named self to bound methods.
Explore how objects have their own attributes by setting instance attributes with self, and see how an instance's state changes through the do this method.
Explore encapsulation as a core pillar of object-oriented programming, using setter and getter methods to guard the value attribute, enforce integer types, and handle value errors.
Learn how python's __init__ constructor initializes attributes automatically at object creation and accepts arguments to set values. Explore an integrity gate that validates inputs and handles type errors.
Explore how class attributes and instance attributes differ and how the attribute lookup order from the instance to the class governs access, assignment, and deletion in Python objects.
Explore how class data relates to instance data, and use a class attribute as shared data, such as an instance counter, accessible through class and instance objects.
Implement a max-size list in Python by using a constructor, push and pop methods, and a get list method, while managing attributes and size limits with setters and getters.
Examine an object-oriented Python solution that initializes a list with a max size, appends values, trims excess with pop(0), and returns the list, highlighting clarity, maintainability, and encapsulation.
Explore inheritance in Python through dog and cat examples, showing how attributes and methods are inherited from a base animal class for code reuse.
Delve into polymorphism, a core object-oriented programming concept, using a common interface and duck typing to call the same show affection method on different animals like dogs and cats.
Call the parent class constructor with super to initialize shared attributes, then extend with a dog-specific init, creating modular, maintainable code and reducing duplication.
Explore multiple inheritance in Python, where a class derives from several parents, and learn how method resolution order resolves attributes and handles diamond inheritance ambiguity.
Explore how instance methods bind to the object, and implement class and static methods with decorators to work with class data and as independent utilities, including a count example.
Abstract classes act as blueprints that enforce required methods on subclasses. Leverage the ABC module and abstract method decorators to define a contract and prevent instantiation of the base class.
Explore how child classes override or specialize parent methods using inheritance, abstract methods, and polymorphism, with concrete examples of getVal/setVal, validation, and history tracking.
Explore class composition as an alternative to inheritance, emphasizing decoupled, modular design and polymorphic behavior through a writer interface used by independent classes like file and string IO.
Create a simple Python object-oriented file writer using a base write file class with two subclasses: log file and delimited file for CSV-like output with timestamps.
Demonstrate solving assignment 2 by building an inheritance hierarchy with a shared parent for file writing, minimizing duplicate code, and enabling polymorphism through log file and DeLynn file classes.
Explore a composition-based Python solution that uses a right file and a formatter to format lines, include date-time stamps, handle delimiters, and write to a file efficiently.
Explore Python's advanced internals, including new style classes and operator overloading, by implementing magic methods like __add__ and __repr__, using broadcasting across lists and built-in syntax.
Learn how to subclass Python's built-in objects, override magic methods like __setitem__ and __getitem__, and reuse parent class functionality to customize behavior while preserving familiar interfaces.
Explore attribute encapsulation in Python by using the property decorator to control attribute access, replacing traditional getters and setters while balancing privacy, convenience, and Pythonic design.
Explore Python's private variable naming conventions, including single leading underscores and double underscore mangling, contrast public interfaces with internal use, and follow pep 8 for readable, professional code.
Learn how the with statement in Python enables automatic cleanup through context managers, using file objects and custom classes with __enter__ and __exit__ for safe resource management.
Compare new style and old style classes; Python 3 uses only new style. Explore features like inheritance from object, slots, C-3, descriptors, singleton classes, and metaclass constructors.
Leverages a dictionary-backed configuration class that reads from and writes to a key=value text file, enabling a familiar dictionary interface to manage config values.
Learn steps to tackle assignment 3 by inheriting from DECT, using attribute _name, checking file existence, reading lines, splitting on equal sign, and implementing setitem to write key-value pairs.
Initialize the class from a text file by reading lines, splitting on the first '=' to key-value pairs, and override setitem to persist updates back to the file.
Learn to trap and raise exceptions with try/except blocks, handle key, index, and value errors, understand stack traces, and design custom exception classes for clearer error messages.
Extend the config dict class with exception trapping and a custom config key error to handle missing keys and reveal available keys from the config file.
Demonstrates testing file write access and handling IO errors, and implements a custom config key error that reports the requested key and available keys.
Learn how to serialize Python objects with pickle to achieve object persistence, using dump and load to store and restore lists, dicts, and class instances on disk.
Explore JSON, a human readable data format for lists and dictionaries. Compare its advantages with pickle and relational databases, and learn loading and dumping for readability.
Learn YAML, a readable markup language for storing structured data, and practice loading and dumping Python structures with PyYAML.
Replace the config class's text-file io with pickle, keeping the dictionary interface intact and using a hard-coded config directory to illustrate object-oriented encapsulation.
Demonstrates reading and writing the concept file using pickle, with a configure attribute guiding the config_dir, loading a dictionary, updating the object, and dumping the serialized data to disk.
Learn to debug with the Python debugger PDB, using breakpoints, stepping, and continue to inspect variables, run code, and diagnose issues alongside print statements and IDE tools.
Use Python's logging module to replace print statements, control output with levels (debug 10, info 20, warning 30), and log to files or console with basicConfig and timestamped messages.
Explore the pytest module to write unit tests that verify small, isolated functions and handle assertion errors. Learn to import scripts, name tests, and use assertions to confirm outcomes.
Learn the pytest module by validating a double it function, handling non-numeric inputs, and applying setup, teardown, fixtures, and test driven development for robust tests.
Explore how to build classes in Python and master encapsulation, inheritance, and polymorphism. Leverage core syntax, operators, built-in functions, the with block, and exception handling to design reliable, reusable interfaces.
In this Python Beyond the Basics - Object-Oriented Programming training course, expert author David Blaikie will teach you how to design Python classes, and how to implement object-oriented programming concepts in Python. This course is designed for users that already have a basic working knowledge of Python.
You will start by learning about classes, including defining a class, class attributes, and working with class and instance data. From there, David will teach you about inheritance and polymorphism. This video tutorial also covers advanced features, such as implementing core syntax, subclassing built-ins, and new style classes. You will also learn about exceptions and object serialization. Finally, David will teach you about efficiency and testing, including debugging, logging, and benchmarking.
Once you have completed this computer based training course, you will be fully capable of designing your own Python classes, as well as implementing object-oriented programming concepts in Python.