An overview of design patterns
Every programming language has its elements uniquely designed and communicated to others. Design patterns give a structured and well-designed approach to developing software or applications in Python. In Python, every element is an object. Design patterns express how we are going to sequence or structure these objects to perform various operations. This allows them to become reusable.
The design patterns are divided into three categories – behavioral, structural, and creational. In this chapter, we will cover behavioral design patterns and look at three in particular, as follows:
- The chain of responsibility
- Command
- Strategy
More than 20 different design patterns are available in Python and covering all of them would require a book of its own. Therefore, we will only focus on some of the most interesting design patterns in this chapter and the next. With that, let’s explore some behavioral design patterns.