Hi,
<snip>
>>At a certain point a form goes beyond these simple UI object / business
object interactions. Decisions about UI state become more complicated. UI
controls need to react to the events raised by the use of other UI
controls. UI controls may be disabled if the user does not have
authorization , if the business object is read only, if a particular tab is
not selected etc. This is when I use a separate object. The code behind
remains simple and the form once again returns to simple UI control /
object interaction, e.g. this.deleteEmpl oyeeButton.Enab led =
myObject.Empl oyeeDeletionAll owed;
I agree, but in this example you still only need to set an Enabled
property. That could be done using simple property-binding.
Yes, but the logic required to work out if the button should be enabled is
something that should be encapsulated outside of the code behind in it's own
object. I guess I use the Mediator pattern.
"Define an object that encapsulates how a set of objects interact. Mediator
promotes loose coupling by keeping objects from referring to each other
explicitly, and it lets you vary their interaction independently"
Yes, we're on the same page here as well.
The mediator pattern is interesting. Here's some more information I found on
the subject in the context of an article on the Message Broker Pattern [link
after sig]:
"Mediator [Gamma95]. The Mediator pattern separates objects so that they are
only aware of the mediator but not each other. The Broker deals with similar
concerns, but it can only be used in the context of enterprise applications."
So your example does seem like the mediator pattern. And if the actual type
of "myObject" was the "UserUICapabili ties" class from my original response,
that would make even more sense. It would just need a property named,
"EmployeeDeleti onAllowed". Since it was created by a User object, it would
act as the mediator between the User and the UI.
<snip>
Thanks for the discussion.
--
Dave Sexton
"Message Broker Pattern"
http://msdn.microsoft.com/library/de...sagebroker.asp