Bill Rawlinson wrote:

Not passing the bean but instead a transfer object (that uses the "this" scope to store its variables) isn't necessarilly a waste. To me it is a matter of style.

After some discussion with people, I've been thinking about the use of the "this" scope in the LTO and whether it's appropriate. You can easily change the values in the LTO because of its' use.


If in your view you prefer to write syntax such as #myTo.someValue# as opposed to #myBean.getSomeValue()#

Obviously this is kind of trivial. But I think the first one is "cleaner". I use TO's when passing into a view and Beans when passing out of a form.

I've been trying to come up with a reason to use the LTO with adding any other methods [such as getValue("someVar") and moving the "this" to the variables scope]... I agree not having to call a method and using it like struct is really nice and simple. I wouldn't however use the LTO if I needed to expose it in an API used by other people.


Typically Only the M and C of my application ever see a bean. The V would only see TOs.

View (Form) -> Controller -> Bean -> Validate() | onFail -> TO -> Controller -> View
View (Form) -> Controller -> Bean -> Validate() | onPass -> Controller -> Model



In the end I think alot of the decision comes down to personal style for most apps. However, If I have disparate systems interacting with mine, when passing data out to them to consume, I think a TO is a much smarter choice. My TO has a MUCH smaller footprint and thus makes for more rapid transfer and, cumulatively, far less bandwidth consumption.


Bill

I've been thinking about using a generic TO, but after some thought I felt that the TO should model the data that it represents. In the terms of the LTO, the modeling occurs with the arguments in the init() method. The purpose of the LTO is easy to see when using the cfc explorer or any other CFC documentation system. I think the trade off only having "quasi-encapsulation" [meaning the encapsulation left up to the developer] versus the representation of the data is acceptable for the "smaller footprint".


Best,
.Peter

--
Peter J. Farrell :: Maestro Publishing

blog    :: http://blog.maestropublishing.com
email   :: [EMAIL PROTECTED]

Create boilerplate beans!
Check out the Mach-II Bean Creator - free download.
http://blog.maestropublishing.com/mach-ii_beaner.htm

"Bread doesn't make people fat - people make people fat."
Garisson Keillor - A Prairie Home Companion
--



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

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




Reply via email to