S
S
StudMG2020-06-05 18:53:56
Python
StudMG, 2020-06-05 18:53:56

Application architecture with GUI?

Good day.
I recently started my own project, working on a program interface with PyQt5.
Having written a window for solving one type of problems (And there are 5-7 of them in total) with the settings of the solver and the interface, I realized that the code came out to about 1.5 thousand lines, the file turned out to be quite loaded and in the end it was already quite difficult to find specific object initialization methods and methods that track events.
The preliminary final program will have about 15,000 lines of code, I understand that the complexity metric is not entirely correct, but the question for more experienced programmers is the following:
What architecture should be used when building fairly large interfaces?
So far I have the following options in my head:
1) A file that is rather difficult to edit, which contains all the methods for initializing, setting and managing the event logic
2) Create several modules: the first with a class for initializing objects and settings, the second with a class for describing the logic of events and methods, the third will be the main module itself, with the described window initialization class, which will inherit the 2 previous ones and will execute these methods
3) Divide into many modules that will fully describe separate groups of widgets (For example: Button, Label, LineEdit, BrowserText, CommandBox, etc.), separate module with interface logic and then also inherit all classes and describe the main methods in the main file.

Until more options came to mind, I would like to choose exactly the combination that will give both the relative ease of editing the code, its readability and at the same time not produce a huge number of modules.
What architecture do you use when solving such issues?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MechanicZelenyy, 2020-06-06
@MechanicZelenyy

In general, there are already standardized architectures for such cases, such as for example MVC .
Also, keep in mind that composition is often better than inheritance.
And of course, you don’t need to fence a monofile or god objects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question