I find myself in a situation where I have several interacting widgets (in the web interface), all of which can be in several different states and whose behavior depends on others. I work in situations where, for example, a data set is sorted twice, or data is displayed before it is sorted, and not vice versa. This is a bit of a wack-a-mole problem, where, I think, I simplified the situation and got its job, only to find out that I broke things somewhere else.
I have functions that do things like:
widgetAFunction
load data into widget B
tell widget B to sort the data
tell widget B to display the data
My love of code reuse makes me want to do something like writing a loadData function in widgets A, which looks something like this:
widgetBLoadDataFunction
update data
sort the data
refresh the view
, widgetA, widgetB. , , , :
widgetBSortFunction
sort the data
refresh the view
, ,
widgetBFilterFunction
, , , ,
widgetBNoSortLoadDataFunction
update data
refresh the view
, , . , .
, ? - , - , , . , , .
- , , , - , ?