Ted Roche wrote:

On 8/9/06, Michael Babcock <[EMAIL PROTECTED]> wrote:


Would you have your UI button's refresh event refer to the business
object's property, or gather that property from the BO into the UI's
property set and refer to that instead?

For example, which would you choose for cmdShowPayRates.Click:

   this.enabled = thisform.oBizobj.lSuperUser

...or...


The less the calling object knows about the called object, the looser
the coupling and the better the design. Rather than always requiring a
property named lSuperUser, you call a method of
thisform.oBizobj.IsEnabled(this) and the bizobject can examine the
caller, the environment, the phase of the moon, whether the user has
enabled that feature and more, and determine what to do. It may also
pass on the decision to a security object or something else you
haven't invented yet.

"Code to interface not to implementation" also implies that it's
better to ask the object's method than to query the object's
properties.

Hi Ted,

I had originally thought of something simple like "this.enabled = thisform.oBizObj.IsSuperUser(tcUserID)" but I didn't like the idea of a function being called across object lines several times (repetitively, as Refresh events would have happen). So from the purists performance POV, I elected to simply set an object property at instantiation (because he's the same user at the beginning as he is throughout!) and refer to that instead of repeated function calls. With this design, it still follows the "Code to the interface" whereas it's using the BO's interface (properties) to get its signal.

Make sense?
--
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to