If you write a program in OOP style in Python, is it worth going deep into OPP, avoiding constants (not singltons) and usual functions (not methods) or should it be combined?
A real-life task: I need to build a small but expandable service on the Flask framework. What am I doing:
I make a file with routes (distribution) of urls.
I make the
handlersmodule in which I add all the handlers of routes. They are presented in the form of classes, since This allows you to use inheritance and other OOP tools.Understandably, the models module, which contains a database view.
A small module in which I connect routes to the handlers of these routes. Also here I can specify some general settings for the handler, for example, logging.
So, isn't it better than writing a bunch of functions that both accept the request and immediately process this request? And if there is a more optimal and flexible way to do this, could you tell?