On Friday, Sep 12, 2003, at 12:52 US/Pacific, Brad Howerter wrote:
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).

OK, by convention I assume, since CFPROPERTY doesn't 'do' anything...


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].

Interesting. And things don't get into 'self' unless that have a CFPROPERTY tag... I see. Of course, I'm still going to argue that such 'blind' get/set methods break encapsulation because you might just as well use 'this.propertyName' instead of 'self[propertyName]' and cfproperty name='propertyName' and a get/set call... But at least you're containing what the get/set methods can access!


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 HTML UI layer would have a rich API that provided methods to render all sorts of 'controls' etc. The (business) object would then call the appropriate method (say 'renderDropDown()') passing in the necessary data (perhaps a query containing 'data' and 'label' columns).


Of course, it would have to be quite a complex UI layer (look at Swing and you'll get an idea of what you'd need) and it still suffers from the inherent limitation that HTML is a very procedural, top-to-bottom sort of layout mechanism.

Another option is to build a set of UI 'objects' that render to HTML all in one go and then have your business code create and popular these logical controls. That would be more Swing-like:

        <cfscript>
                page = createObject('component','ui.page');
                page.init('Some page title','xhtml');
                page.addStyle('/path/to/style.css');
                header = createObject('component','ui.div');
                header.init(id='header');
                page.addElement( header );
                ...
        </script>

(This is why we write HTML instead of Swing apps :)

Now, I'm not saying you need to go quite that far (we'd never get anything done) but we need to bear that sort of idiom in mind when we are designing/coding so that we don't fall too far into the habit of mixing presentation and logic.

About the best we can reasonably do is to create separate view and model layers and pass data between them using memento / value object style objects - which have the 'bad' getters (the approach Barney so eloquently describes in his post).

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
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