When it comes to writing reusable and extensible code in Python, abstract classes are an essential tool in your arsenal. Abstract classes define a set of methods that a subclass must implement, but it doesn’t provide an implementation for those methods itself. This feature makes them a powerful way to enforce certain behavior while also…
Read moreCategory: Python Design Patterns
Design Patterns and SOLID principles in Python
Facade Pattern in Python
![](http://karolos.me/wp-content/uploads/2020/03/facade-1.jpg)
The Facade design pattern belongs to the structural design patterns and provides a unified interface to a set of interfaces. It is commonly used in apps written in OOP languages and it intends to provide a convenient interface to the client, thus the latter avoid dealing with complex parts (subsystems). Keep in mind although that,…
Read morePython Decorators
![](http://karolos.me/wp-content/uploads/2021/02/decorators-1.jpg)
A decorator is a design pattern in Python that allows a user to add new functionality to an existing function or object without modifying its structure. Decorators are usually called before the definition of a function you want to decorate. Functions as First-Class Objects Before diving into decorators we need to understand how functions work in Python where they are first-class objects.…
Read moreS.O.L.I.D. Principles in Python
![](http://karolos.me/wp-content/uploads/2021/02/solid.jpg)
In object-oriented programming, S.O.L.I.D. is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. S.O.L.I.D. Concepts Let us initially briefly describe each one of the principles, before our attempt to elaborate on each one of them with Python examples. Single Responsibility Principle: Any class should only have a single responsibility, meaning that…
Read more