Brian Kotek wrote:

>I suppose it might provide some context to say that my perception of a
>Bean came from this article at Mach-II.com, where a Bean is described
>as:
>
>Beans are primarily carrier objects, used for passing encapsulated
>data between application layers (model-view-controller or
>architectural tiers). They typically contain minimal business logic
>(if any), and they have simple, consistent interfaces.
>
>http://www.mach-ii.com/downloads/docs/Beans%20in%20Mach-II.pdf
>  
>
That's the type of bean I use, however with some minimal business
logic.  My beans tend to have a validate(), get/setMemento, and LTO
creation/population/setting functions.  I may have some other functions
like computeXYZ() that will take information from getters and compute a
result.  For the lack of a better example, I may have a birthday date
and have computeAge() or getAge() - which of course takes the birthday
and gets the person's age.

My LTOs are used to set/get information from the db.

Form -> set to Bean -> validate Bean ->
if validate is false -> display form again
if validate is true -> get LTO -> send to DAO and run create()

The other direction might be:
pass in init() LTO and run read() ->
if record exists -> populate LTO -> pass back
if no record exists -> throw error and catch/handle in the calling code
as necessary
I may then init() my bean with the LTO if I need to pass it to the user
- using my getters to display data thus having a standard API for my data.
or just work with the LTO if it's all in the backend.

-- 
Peter J. Farrell :: Maestro Publishing

blog    :: http://blog.maestropublishing.com
email   :: [EMAIL PROTECTED]
________________________________
R O O I B O S  G E N E R A T O R...
Create boilerplate beans and transfer objects for ColdFusion!
Rooibos is free to use at: http://rooibos.maestropublishing.com/
________________________________
Member of Team Mach-II - The next rev is coming...



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