Module 2: Advanced Python¶
This module focuses on writing clean, professional-grade Python code and introduces the fundamental concepts of data engineering.
Advanced Python & Unit Testing¶
Session 1: From Functions to Classes This lesson builds on the students’ understanding of functions by introducing object-oriented programming as a way to manage state and structure code. We’ll explore pure and higher-order functions, then transition into defining classes, creating objects, and distinguishing between instance and class attributes. By the end, students will see why classes provide a natural way to model real-world entities and organize code beyond simple scripts.
Session 2: Organizing and Designing Code Here we move from single classes into building larger, well-structured programs. Students will learn how to organize code into modules and packages, and deepen their understanding of object-oriented features like inheritance, composition, and encapsulation. We’ll also introduce common design patterns, such as Strategy and Factory, to show how they make code more flexible and reusable. The goal is to give students the tools to design and scale their programs with clarity.
Session 3: Writing Robust, Maintainable Code This focuses on professional practices that make Python code reliable and future-proof. We’ll cover type hints and static analysis with mypy, how to use linters and formatters to enforce style and catch errors, and how to write clear, standardized docstrings. Finally, we’ll introduce Pydantic as a practical way to validate and enforce structure in real-world data. By the end, students will know how to make their code both elegant and production-ready.
Unit Testing and Validation¶
Session 4: This session is all about writing high-quality, testable code. We'll introduce unit testing and practice writing tests for a Python application using the pytest framework. We'll emphasize the principles of test-driven development (TDD) to build features that are robust from the start.
Session 5: We'll focus on data validation and error handling. Students will learn how to write tests that specifically challenge Pydantic models to ensure that incoming data is always correctly formatted. We'll also cover best practices for creating custom validation logic.