Title: Message
It does take some getting used to, David. As Brad points out, having an array of address objects belonging to a single person would make sense. What to do with multiple people? If your needs dictate it, you can have a collection type object -- just a fancy way of saying you can have an array of Person objects. On the other hand, if all you need is some information about people, you probably don't want to have your app instantiate a bunch of persons, if all you need is there phone number.  There's nothing wrong with simply having a CFC return a query.
 
I find that it's very helpful for people learning OO to build some apps that have NO databases involved. This is because, as CF developers, we're so used to thinking of writing code that manipulates data in a database. You really want to forget about the persistence issue until you find that you really are "thinking in objects". Then, you'll find it very easy to incorporate databases into your code. Just my advice.

Hal Helms
"Java for CF Programmers" class
in Las Vegas, August 18-22
www.halhelms.com

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Mineer
Sent: Wednesday, August 06, 2003 6:33 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] OOP cfc and Database

Would this also work if I wanted to return a query of, say, 10 people and all their addresses.  I guess I am struggling on how to deal with the traditional cfquery cfoutput type stuff that is almost 100% of what I am accustomed to doing.  A small code sample would be greatly appreciated.  Am I thinking wrong to want to output a query?
 
TIA,
 
---------------------
David Mineer
 
---------------------
Don't wish it was easier; wish you were better.
Don't wish for less problems; wish for more skills.
Don't wish for less challenges; wish for more wisdom.
----- Original Message -----
Sent: Wednesday, August 06, 2003 12:36 PM
Subject: [CFCDev]

I'd make addresses a property in the person cfc, as a list, array or
structure of address objects.  Each address would be an address object.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of David Mineer
Sent: Wednesday, August 06, 2003 2:24 PM
To: cfcdev
Subject: [CFCDev]
I have Hal's book and was reading his article on macromedia, and also
reading all the posts to this list. I am trying to cement in my mind oop and
cfc's. Can someone give me an idea on the following.
Almost every page I have has some kind of db interaction. Using Hal's
example of composition, a person has an address, I would like to understand
how to best implement this using a cfc. But, I want to understand it from
the point of a person having more than one address, a one-to-many
relationship.
If I have a list of persons in a database, with 1 or more addresses linked
via a separate table, how do I code this using a cfc (getting info on a
person from the db given their id). Right now I would simply link the two
using some type of sql join in a single cfc. But I am wondering if there is
a better way calling a separate cfc (address.cfc) that would give me better
encapsulation and such.
TIA,
---------------------
David Mineer


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