Seth Johnson (KW) wrote:
No problem...Peter: thanks for the in-depth reply! Documentation is one reason for me, however I'll link to this J2EE Pattern doc: http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html Another reason was to standardize the type of object my DAO uses (either to popular during a read or passed to update/create). Quoting from the Transfer Object Link: Typically, applications have a greater frequency of read transactions than update transactions. The client requires the data from the business tier for presentation, display, and other read-only types of processing. The client updates the data in the business tier much less frequently than it reads the dataIf you are doing a ton of reads without the need to "inject" the data into the form - the LTO is lightweight and reduces the number of calls to methods. So it comes down to invoking a fewer number of calls on getters (accessors)... Example of use with bean: First Name: #myBean.getFirstName()# Last name: #myBean.getLastName()# Example of use with LTO: First Name: #myBean.firstName# Last name: #myBean.lastName# Since the LTO uses the "this" scope, you're accessing it just like you would a struct. I do want to say I've not made up my mind if this is best or easiest solution...however, this was the choice for the project I'm currently on and until it's over -- my mind is still open on the subject. I don't pretend that I know a lot ... Quoting from the Transfer Object Link: The number of calls made by the client to the enterprise bean impacts network performance. Chattier applications-those with increased traffic between client and server tiers-often degrade network performance.Network performance -- sending a huge bean vs. a LTO around your application....etc. Maybe I think about performance here, but I don't think using it is spending time on optimization because it's just architecture. Quoting from the Transfer Object Link: It is a design choice as to whether the Transfer Object's attributes are private and accessed via getters and setters, or all the attributes are made public.Some people have said I'm "breaking encapsulation" because the LTO uses the "this" scope -- thus why I say "loosely encapsulate" (it's up to the developer not to mess with it -- just like it's their job not to mess with struct if directed). However, I'm quoting the line because in the end "it depends" on the developer. nope....just using the type attribute for documentation in the LTO (assuming that your application assumes all data from a database is assumed valid as I always validate before trying to persist data in a database). This is not really possible if you populating your bean from a form (especially HTML) because all data from a form is just strings. I assume that if you create an LTO - the data used has been validated -- so "strongly" typing the LTO shouldn't be a problem (unless you have a problem with your validation schema).Do you ever create strongly typed objects to represent fully formed, validated beans? For example, using CustomerBean.cfc to handle the data validation then using Customer.cfc to hold a valid object with strongly typed return values? Well, the plan might have changed - I'm planning a couple of things for Rooibos. Going from XHTML/_javascript_ to pure CF and a real application for a couple of reasons.
Best, .Peter -- Peter J. Farrell :: Maestro Publishing http://blog.maestropublishing.com Rooibos Generator - Version 2.1 Create boilerplate beans and transfer objects for ColdFusion for free! http://rooibos.maestropublishing.com/ Member Team Mach-II---------------------------------------------------------- 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). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] |
- RE: [CFCDev] Difference between "bean" and &... Seth Johnson \(KW\)
- Re: [CFCDev] Difference between "bean" ... Bill Rawlinson
- Re: [CFCDev] Difference between "bean" ... Peter J. Farrell
