On Friday, Sep 12, 2003, Sean Corfield wrote:
>
>On Friday, Sep 12, 2003, at 07:20 US/Pacific, Brad Howerter wrote:
>>> Except that having generic property accessors like that breaks
>>> encapsulation even more (since client code can access *any* instance
>>> data!).
>> No, not any instance data, just the preoprties defined with CFPROPERTY.
>
>So your get/set methods introspect the object every time to validate 
>whether the property is accessible / updatable? Interesting approach. 
>
Yeah, sort of.  I misspoke a little.  I write my CFCs so that everything
that's a CFPROPERTY is also in the 'self' structure (or else has 
a getProperty method).

The get method just looks to see if the property being accessed has
a getProperty() (i.e. getName) method for it and if it does, 
it returns it.  

Otherwise it just returns the self[property].

The set method also first checks for a setProperty() method, but if it
doesn't find one, it does introspect everytime, so it can make
sure the type of the value being passed in is correct.

I also have getAll() and init() (like set(), but multiple 
properties can be set), both of which do introspect.

>Don't you find it rather slow?

getAll() is kind of slow, I think because it calls get() for
every cfproperty.
I should tune it to just loop through the properties and do what
get would do, instead of calling get.  A couple of times I've
overriden this method for performance reasons.

I don't seem to be having performance problems with the other methods.
Introspection seems to be pretty fast.

>>> 'drawThyself()' doesn't generate HTML. To map his scenario to web
>>> applications and CF you'd need an HTML UI layer that applications
>>> called into in order to render pages - you wouldn't have HTML 
>>> fragments
>>> in your 'drawThyself()' methods.
>> What else is there for it to do?  Wouldn't the drawThyself method be 
>> in the
>> HTML UI layer?
>
>But the HTML UI layer here - that matches the Swing UI layer Holub 
>refers to - is an abstraction layer that knows nothing about your 
>application objects. 'drawThyself()' would be a method on your business 
>object that calls the abstract HTML UI layer to render information 
>(into HTML). In other words: no business logic/knowledge in the HTML 
>layer and no HTML in the business layer - which is how Swing apps 
>essentially work. We just don't have an HTML equivalent to Swing.

Oh!  Thanks for the explanation.  So does drawThyself pass the necc.
data to the HTML UI layer?  What would the method name be in that
layer?





***
The information in this email is confidential and intended solely for the individual 
or entity to whom it is addressed. If you have received this email in error please 
notify the sender by return e-mail, delete this email, and refrain from any disclosure 
or action based on the information.
****


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to