design - Pragmatism or purity - Should we rely on GUI framework to store program state? -
I was once accused of creating C # custom user controls. It has a control with a group of openable sections. Control is a label control that the user can click on to toggle between that script / extension status. Next there is an image control that will change the state to indicate whether a particular segment is collapsing or expanded. Somewhere in control, I need a function to return the status of a particular section. The question is whether the function should be restored to the state on the state under control, or should we deposit the state into an additional variable, which is in addition to the current situation beyond the danger of the sink?
Most of the time, when people go with "pure" solutions to such problems, they are just hiding, coupling it Do not remove coupling usually reflects the complex complexity of those problems which they are trying to solve. Since it can not be removed, it can be implemented in a straightforward manner.
Your case is no exception. Unless you feel that there is a good chance for the situation of image control in the future (if you are using a stable framework), by using an additional variable, which is always the image The state should consider the same value as the controller, just replace the apparent coupling with slightly hidden, underlying coupling. It does not benefit you and complexity increases and hence the bug potential.
Comments
Post a Comment