Hello Scott,

You are now starting to float around the differences in philosophy of OOP
design.

Using the "HAS A" relationship you get much greater flexibility at runtime.

For example:

You may have a generic CONNECTION class that supports coms protocols (like
IRC, TELNET, HTTP, etc.)

So in the above example you could have the following:

� � � � CONNECTION
� � � � � � � � has a
� � � � � � � � � � � � PROTOCOL

This allows the PROTOCOL to be changed at runtime without having to destroy
the CONNECTION object. �You can create a single instance of each PROTOCOL
you want to use and re-use it by embedding it into each CONNECTION
object. �The CONNECTION object then simply calls methods in the PROTOCOL
object passing itself as the CONNECTION object.


In your first example, you are using the HAS A - which just means you can
then call methods in PERSON that know which CART and LOGGING to use. �You
could then do everything to PERSON through PERSON methods.

The alternative does not fall into an OOP model at all. �The objects exist
by themselves and the only relationship between them is whatever you end up
making in the main portion of your code.

I personally like the first version as it is more OOP oriented.

Having said all of that, there are so many other things that make Cold
Fusion NOT an object-oriented language that there may be little advantage
to be gained because of the ways the OOP model can be violated in CF. �It
would really depend on the rest of the design of your system and what you
want to be able to do at runtime.



Gary Menzel
IT Operations Brisbane -+- ABN AMRO Morgans Limited
Level 29, 123 Eagle Street BRISBANE QLD 4000
PH: 07 333 44 828 �FX: �07 3834 0828

[EMAIL PROTECTED] wrote on 01/21/2003 02:42:35 PM:

> Heyas,
>
> I am using a CFC process type model, in that i have a parent Object,
which i
> call person. Beneath it i have relevant objects connected to the person
> object that allow me to carry out different routines aswell as track
> different variables throughout the 'person' interaction / movements of a
> site.
>
> My question is, is it unhealthy for the application and good ol fashion
OOP
> principals to attach objects to the person object (this being the parent)
or
> is it better to simply create instances of that object that do not bolt
onto
> the parent object... eg:
>
> --- Bolted on style ----
> <cfscript>
> �// Define the Objects Instance
>
> �person � = createObject("component","comp.qh.customer");
> �person.shopCart = createObject("component","comp.utils.shopcart");
> �person.logging �= createObject("component","comp.qh.logging");
> </cfscript>
>
> vs
>
> <cfscript>
> �// Define the Objects Instance
> �person � = createObject("component","comp.qh.customer");
> �shopCart = createObject("component","comp.utils.shopcart");
> �logging �= createObject("component","comp.qh.logging");
> </cfscript>
>
> --
> Freelance Application Developer / Designer
> --
> ph: 07 3288 6702
> mob: 04040 32812
> --
> url: http://www.spidaweb.com
>
>
>
>
> ---
> You are currently subscribed to cfaussie as:
[EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to