Pragmatism or purity. Should we rely on the GUI infrastructure to store the state of the program?

I was tasked with creating a custom C # control. This is a control with a bunch of folding sections. The control that the user can click to switch between the collapse / expand state is a label control. There next to it is an image control that changes state to indicate whether a particular section is crashing or not. Somewhere in the control, I need a function to return the status of a particular section. The question is whether the function should return a state based on the image control state, or should we introduce an additional variable that would preserve the state, with the additional risk that it is not synchronized with the current state?

+3
source share
2 answers

In most cases, when people come with a “clean” solution to such problems, they simply hide the connection, rather than remove it. Communication usually represents the significant complexity of the problem they are trying to solve. Since it cannot be deleted, it can also be implemented in a simple way.

. , , (, ), , , , . , , .

+3

. , , .

+1

Source: https://habr.com/ru/post/1731121/


All Articles