I think it depends on how many times you will need to get "all" of the
information back from the object.  If it happends many times or in many
locations, it would result in less coding.  If it's rare, it may not be
worth it.

I prefer option number 2.  It makes the values more "atomic" in that
they return only a very specific amount of information.

If you have obj.GetName() you can be sure the component won't be
modified to add a phone number value in addition to the name.  It should
only return the person's name.

Thanks
MAD

-----Original Message-----
From: Sparrow-Hood, Walter [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 04, 2003 8:43 AM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Correct technique for a method call


I have many cases where I need to retrieve multiple items from a
stateful object (employee info, user info, etc.).  I can think of 3 ways
to 'get' the data;

1)      A single method that returns all the data in a structured
variable,
as in:

                        empData = session.thisUser.getEmpData()

                                and I could then use  #empData.name#,
#empData.dept#, etc.

2)      Have multiple methods, one for each item of data (there could be
up
to a dozen items), and use:

                                #session.thisUser.getName()#,
#session.thisUser.getDept()#, etc.


3)      Or a variation on #1, where I pass in the requested variable, as
in;

                                #session.thisUser.getEmpData(name)#,
#session.thisUser.getEmpData(dept)#

Is one approach 'better' or more correct from as deign perspective or
does it just depend on one's preferences and particulars of the
application?


Walt

Walt Sparrow-Hood
Director, E-Commerce
GenTek, Inc.
V - 973-515-1835
M - 973-723-7910
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



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

Reply via email to