Chapter 5
When to Use Object-Oriented Programming
In previous chapters, we’ve covered many of the defining features of object-oriented programming. We now know some principles and paradigms of object-oriented design, and we’ve covered the syntax of object-oriented programming in Python.
Yet, we don’t know exactly how and, especially, when to utilize these principles and syntax in practice. In this chapter, we’ll discuss some useful applications of the knowledge we’ve gained, looking at some new topics along the way:
-
How to recognize objects
-
Data and behaviors, once again
-
Wrapping data behaviors using properties
-
The Don’t Repeat Yourself principle and avoiding repetition
We’ll start this chapter with a close look at the nature of objects and their internal state. There are cases when there’s no state change, and a...