[Extending the ButtonController to be a generic controller, which can
handle activation and deactivation of elements in the GUI according to
when different criteria are valid.]

It is an admirable goal to pursuit, but my experience is that it is
fairly difficult to design a truly generic Controller class across
different toolkits.

This is so, because you have to design the Controller to work with
very few behavioural guarantees.  For instance, with some toolkits,
the changing of an input box can trigger a callback, but in this
callback, it is not possible to get the contents of the input
box in this callback -- it is not updated until after the callback
returns.

Now, this should not put you off. I only want to warn you that it
might be a longer journey that you plan. The best advise I can give
is to design as you go: Only implement what is needed for the toolkit
at hand, and when another one is to be assimilated, have a look to
see if it is possible. If it is, great. If not, refactor it to handle
the new toolkit. It would be a mistake to think that you can design it
to encompass all strange toolkits from the start.

Greets,

Asger


Reply via email to