Hi,

I am a little confused about cfc.  Let's say I have a user object.  I can query 
the database for one user and then populate the user object.  This works great. 
I love it.  However, when I need to display a list of users.  Should I use the 
query result to display or  should I populate an array of user objects with the 
query result, and use the array to display?  That is how you would do it in 
Java.  Do you do the same in Coldfusion?  Array is slower in query.  So it 
doesn't make sense.  It is like I am having something fast, but I convert it 
into something slow to use.

Now what if each user object has an address object.  You can access it with 
something like user.getAddress().getCity().  That means when you use 
user.getAddress(), it goes back to the database and query the address for that 
user.  If you want to display 10 users with addresses.  You would make 11 trips 
to the databases.  Now if I use user.getAddress().getCity(), 
user.getAddress().getState(), user.getAddress().getZip(), it would actually 
make 31 trips to the database.

I could do address=user.getAddress(), but that is a little bit messy on the 
presentation layer (mixing business logic within the presentation layer) and it 
still takes 11 trips to the database.

If you are not using OO, you can just use one join statement and get all the 
data from database with one trip.  Am I right?  Is this something we have to 
accept if we want to work with OO or is there a workaround?  Or am I totally 
wrong in my approach to OO?

Johnny

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208160
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to