First, solve the problem. Then, write the code.
— Jon Johnson
Object orientation has its fans and critics. Referring to the quote above, object-oriented implementation styles might provide the most benefit when they are applied by programmers who really understand the problem at hand and when there is much to gain from abstraction and generalization. On the other hand, if you do not know what exactly to do, a different, more interactive and exploratory programming style, like procedural programming, might be a better choice.
In this chapter, we do not want to discuss the risks and merits of using object orientation. We take it for granted that this approach has its place when it comes to the development of more complex financial applications (cf. the project implemented in Part III of the book) and that it brings along a number of measurable benefits in these cases. When it comes to building graphical user interfaces (GUIs), object orientation in general is a conditio sine qua non.
Therefore, we combine the two topics in this chapter and introduce first fundamental concepts of
Python classes and objects. Equipped with this knowledge, it is much easier to introduce the development of GUIs.
Wikipedia provides the following definition for object-oriented programming:
Object-oriented programming (OOP) is a programming paradigm that represents concepts as “objects” that have data fields (attributes that describe ...