Setting up the GUI in OOP
The text editor we developed in the previous chapter was implemented in procedural code. Although it offered some benefits for quick coding, it had some typical limitations:
We started encountering global variables
The function definitions needed to
be defined above the code that called them
Most importantly the code
was not reusable.
Therefore, we need some way to ensure that our code is more reusable. This is why programmers prefer to use Object Oriented Programming (OOP) to organize their code into classes.
OOP is a programming paradigm that shifts the focus onto the objects we want to manipulate rather than the logic required to manipulate them.
This is in contrast to procedural programming that views a program as a logical procedure that takes input, processes it, and produces some output.
OOP provides several benefits such as data abstraction, encapsulation, inheritance, and polymorphism. In addition, OOP provides a clear modular structure for programs. Code modification...