Log In
0% completed
All Lessons
Free Lessons (3)
Preface
Getting Started with Clean Code in Python
Introduction to Clean Code, Code Formatting, and Tools
An Introduction to Clean Code
Code Formatting
Documentation: Code Comments
Documentation: Docstrings
Documentation: Annotations
Tooling for Type Consistency and General Validations
Tooling for Automatic Formatting
Quiz on Introduction to Clean Code, Code Formatting, and Tools
Pythonic Code
Indexes and Slices
Context Managers
Comprehensions and Assignment Expressions
Properties, Attributes, and Different Types of Methods for Objects
Creating Classes with a More Compact Syntax
Iterable Objects
Other Properties, Attributes, and Methods
Summary of Magic Methods
Caveats in Python
Quiz on Pythonic Code
General Traits of Good Code
Design by Contract
Defensive Programming
Best Practices for Exception Handling
Using Assertions in Python
Separation of Concerns
Acronyms to Live By
Inheritance in Python
Multiple Inheritance in Python
Arguments in Functions and Methods
Variable Number of Arguments in Python
More on How Function Arguments Work in Python
Optimizing the Number of Arguments in Functions
Final Remarks on Good Practices for Software Design
Quiz on General Traits of Good Code
The SOLID Principles
The Single Responsibility Principle
The Open/Closed Principle
Liskov's Substitution Principle
Integration Segregation Principle
Dependency Inversion Principle
Quiz on the SOLID Principles
Challenge: The Single Responsibility Principle
Solution: The Single Responsibility Principle
Using Decorators to Improve Our Code
What Are Decorators in Python?
Function Decorators
Class Decorators
More Advanced Decorators
Decorators with Default Values
Decorators for Coroutines
Extended Syntax for Decorators
Good Uses for Decorators
Effective Decorators—Avoiding Common Mistakes
Dealing with Side Effects in Decorators
Creating Decorators That Will Always Work
Decorators and Clean Code
The DRY Principle with Decorators
Decorators and Separation of Concerns
Analysis of Good Decorators
Quiz on Using Decorators to Improve Our Code
Challenge: Creating Function Decorators
Solution: Creating Function Decorators
Getting More Out of Our Objects with Descriptors
A First Look at Descriptors
Get Method of the Descriptor Protocol
Set Method of the Descriptor Protocol
Delete Method of the Descriptor Protocol
Set Name Method of the Descriptor Protocol
Types of Descriptors
An Application of Descriptors
Different Forms of Implementing Descriptors
More Considerations for Using Descriptors
Analysis of Descriptors
Final Remarks About Descriptors
Quiz on Getting More Out of Our Objects with Descriptors
Challenge: Creating Descriptors
Solution: Creating Descriptors
Generators, Iterators, and Asynchronous Programming
What are Generators?
Generator Expressions
Iterating Idiomatically
Itertools
Simplifying Code through Iterators
The Iterator Pattern in Python
Coroutines
More Advanced Coroutines
Further Uses of the yield from Construction
Asynchronous Programming
Magic Asynchronous Methods
Asynchronous Iteration and Asynchronous Generators
Quiz on Generators, Iterators, and Asynchronous Programming
Challenge: Asynchronous Programming
Solution: Asynchronous Programming
Unit Testing and Refactoring
Design Principles and Unit Testing
Forms of Automated Testing
Unit Testing and Agile Software Development
Unit Testing and Software Design
Getting Started with Testing
The unittest Module
Parameterised Tests Using unittest
The pytest Framework
Parameterized Tests Using pytest
Fixtures in pytest
Code Coverage
Mock Objects
Using Mock Objects
Refactoring
More about Testing
Common Themes in Testing
Test-Driven Development
Quiz on Unit Testing and Refactoring
Common Design Patterns
Design Patterns Considerations in Python
Design Patterns in Action
Creational Patterns
Shared State
The Borg Pattern
Adapter
Composite
Decorator
Facade
Chain of Responsibility
The Template Method
Command
State
The Null Object Pattern
Final Thoughts about Design Patterns
Quiz on Common Design Patterns
Clean Architecture
From Clean Code to Clean Architecture
Separation of Concerns
Monolithic Applications and Microservices
Abstractions
Software Components
Packages
Managing Dependencies
Docker Containers
Use Case
The Service
Analysis of the Architectural Traits
Quiz on Clean Architecture
Conclusion
An Overview of the Course
Ending Notes
Clean Code in Python
/
...
/
Solution: Creating Function Decorators
Solution: Creating Function Decorators
Learn how to create a simple function decorator.
We'll cover the following...
Solution overview
Code explanation
Solution overview
...