SOLID Python Development Techniques
Published by Pearson
Write production-ready Python code using best practices and SOLID techniques
- Learn how to write high-quality Python code properly
- Understand the role of the SOLID principles applied to Python
- Explore examples of coding best practice
Python is an eclectic and programmer-friendly programming language. In many ways, it’s too easy. You can write Python code that is a nightmare to maintain and has latent bugs lurking in dark corners, waiting to catch you out.
SOLID Python Development Techniques shows how to apply the SOLID programming principles and object-oriented best practices to create professional-grade Python code that is well structured, self-documented, predictable, and production-ready.
What you’ll learn and how you can apply it
- Use object-oriented techniques properly and effectively in Python
- Apply SOLID programming principles and design patterns
- Write type-safe Python code by using Python typing and Pydantic
- Implement automated testing by using PyTest, PyTest-Mock, and PyHamcrest
This live event is for you because...
- You are a Python developer and you want to elevate your skills to the next level, so that your Python code becomes more “production ready.”
- You want to follow best practices and patterns to write code that is easier to read, test, and maintain in a professional environment.
Prerequisites
- At least 3 months Python programming experience
- Awareness of object-oriented principles would be beneficial
Course Set-up
- Install Python- Install any IDE, e.g., Visual Studio Code, PyCharm, or Spyder
- Download course materials and demos: Link to be provided
Recommended Preparation
- Attend: SOLID Principles of Object-Oriented and Agile Design by Robert C. Martin
- Attend: Clean Code by Robert C. Martin
- Watch: Python Fundamentals with Paul Deitel
- Attend: Introduction to Python Programming by Arianne Dee
Recommended Follow-up
- Watch: Skill Up with Python (Video Collection) by Shaun Wassell
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Segment 1: Using object-orientation effectively in Python (50 minutes)
- Defining and using a class
- Class-wide methods
- Managing attributes
- Implementing dunder methods
- Using inheritance
- Understanding multiple inheritance and the method resolution order (mro)
- Using polymorphism effectively
- Q&A
Break (10 minutes)
Segment 2: Writing type-safe Python code (30 minutes)
- The need for type safety in Python
- Defining type-safe variables, functions, and classes
- Typing techniques
- Using Pydantic to enforce object field validation rules
- Designating abstract classes, abstract methods, and interfaces
- Q&A
Break (5 minutes)
Segment 3: Test automation (50 minutes)
- Tools for testing Python code
- The FIRST principles of unit testing
- Writing and running tests
- Test techniques (parameterized tests, setup/teardown, testing exceptions)
- Using PyHamcrest to formulate higher-level tests
- Grouping tests into suites and running tests selectively
- Using PyTest-Mock to mock values, functions, and classes
- Q&A
Break (5 minutes)
Segment 4: SOLID principles and best practices (60 minutes)
- What are the SOLID principles?
- The Single Responsibility Principle and class design guidelines
- The Open/Closed Principle and inheritance guidelines
- The Liskov Substitution Principle and polymorphism
- The Interface Segregation Principle
- Associated design patterns
- Q&A
Segment 5: Case Study (25 minutes)
- Worked example to illustrate SOLID principles in action
Course wrap-up and next steps (5 minutes)
Your Instructor
Andy Olsen
Andy Olsen is a freelance consultant, instructor, and developer with more than 30 years of experience in IT. Andy began his professional career as a C/C++ developer and has also worked in Rust, Go, and other languages as the years passed. Andy is actively involved in a wide range of technologies including full-stack development, cloud native applications, data science, and more. Andy is passionate about technology education and runs training courses around the world across diverse market sectors.