A native data type like a ColdFusion structure or array will be much faster
than a component. Additionally, in writing your own component, you will
introduce complexity and, as a result, more opportunity for bugs. So, in
general, I'd say use a native data type unless you specifically need a
feature that the native data type doesn't support.

For instance, if you needed to reference objects using a key, but the order
is also important, you might want to create your own data type as ColdFusion
structures return keys unordered. However, if you did that, you'd be
limiting yourself to the methods and properties you write yourself. In other
words, you can't just run all of the built in structure and array functions
on your component (though you could potentially use them from within your
component).

Ben Rogers

http://www.c4.net

v.508.240.0051

f.508.240.0057

-----Original Message-----
From: Deanna Schneider [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 9:28 AM
To: CF-Talk
Subject: SOT: OO Design

Hi Folks,
I'm trying to get my head around OO design for CF and I have a ton of
questions, of course. I'll try to keep them limited, as they're sort of
off-topic (though not entirely, because whatever I have to design I have to
build in CF).

Here's my first basic question:
When you're designing an object that includes a multiple has-a type
relationship, do you typically build the objects such that their is an
intermediate "collection" type object?
For example, I'm working on a project management system. It involves tasks.
Tasks can have 0 to many "consumables" associated with them.

Do I have one object "Task" and one object "Consumable" with the consumable
object having both a "getOne(consumableID)" and a "getAll(taskID)" method?
Or, do I have an intermediate "ConsumableList" object that takes a taskID
and gets all the consumables associated with that task by calling a method
in the Consumable object.

Does that make sense?

Thanks.
-Deanna

---------------------------------------------------------
Deanna Schneider
UWEX-Cooperative Extension
Interactive Media Developer

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to