I almost skipped over this post because it was all quotes.  ( I imagine 
that was because the list was bouncing stuff for a bit).

At 08:04 PM 8/31/2002 -0700, you wrote:
> >
> >> On Friday, August 30, 2002, at 10:35 , Jeffry Houser wrote:
> >>>   I think this is too good of a topic to pass up, and I haven't seen any
> >>> other responses, so..  I'll give it a shot.
> >>
> >> Well, I was drafting a reply but didn't have time to finish it... and
> >> you'
> >> ve actually said most of what I was going to say!
> >>
> >>>   There is some parallel to CFCs with Objects, however I think that a
> >>> better comparison is Abstract Data Types (ADTs).
> >>
> >> Interesting comparison. I'm not quite sure why you'd make that
> >> comparison given that CFCs map to Java classes directly - could you
> >> elaborate? (It's been years since I dealt with ADTs so my recollection
> >> of them may be hazy by now)

  I want to modify my original assertion.
  There is some parallel to CFCs with classes, however I think that a 
better comparison is to Abstract Data Types (ADTs).
  I think everyone understood what I meant, but classes and objects are 
like comparing apples and oranges, so I wanted to make sure I specified.
  Before moving on, I will say that a very good argument could be made that 
CFCs are a hybrid feature encompassing both features of ADTs and 
Objects.  I'll get to more on that later.

   Moving on:

  An Abstract Data Type (ADT) is a programmer-defined data type that can be 
manipulated in a manner similar to system-defined data types.
<quote>
  An ADT must be able:
   1. To export a type definition
   2. To make available a set of operations that can be used to manipulate 
instances of the type
   3. To protect the data associated with the type so that they can be 
operated on only by the routines
   4. To make multiple instances of the type
</quote>

To address each issue individually:

1. Do CFCs have an exportable type definition?  I would say yes.  You can 
load the CFC in the browser and the component meta data is displayed.  That 
seems to fufill that requirement.

2. Can CFCs make available a set of operations to manipulate instances of 
itself?  Yes!  Functions / methods created inside the CFC are by default 
public and can be used to manipulate component-specific variables.

3. Is the data created inside a component protected from outside 
forces?  I'm a little grey on this one.  You can create component specific 
variables using the this scope.  However, I think you can access those 
variables in the calling page using the componentname.componentvariable 
syntax, so this is not quite true.

4. Can we make multiple instances of a component?  Yep, that is no 
problem.  Just store each instance in a different variable.

  Common ADTs are Stacks and Queues.  I've played around with this concept 
in both CF5 and CFMX.  ( CFCs are better suited for creating Abstract Data 
Types than anything in CF5 was ).

  If we can all agree that we have a general understanding of what an ADT 
is...

  Objects add new ideas on top of an Abstract Data Type:

1. Object Passing: Any given action happens because a request was made to 
an object.
2. Overloading / overriding: The same message can mean different things to 
different objects
3. Inheritance: This means that classes can be developed in a hierarchical 
manner.  One class can have elements / code of its parent.
4. Polymorphism: This is kind of like overloading, except it means that an 
identical message can do different things in the same object depending on 
the type of parameter that is being operated upon.

Taking each of these elements and placing them on top of CFCs:

1. Do CFCs support object passing?  Yes, they do.  We can call a method 
using object notation (I.E. objectinstance.methodname )  However this is 
really a change in perspective from ADTs.  With an ADT we would call a 
function to place the data on a stack.  The emphasis is on the 
operation.  With an object, we tell give the value to the stack and tell it 
to put the value on the stack.  The emphasis is on the data.

2. Do CFCs support Overloading / Overriding?  Not in related objects.  If 
two classes have absolutely no correlation, you can do this, however the 
defeats the purpose of an OO approach.  A child CFC inherits all parent 
methods as is.  You do not have the ability to change functionality of 
inherited methods.

3. Do CFCs support inheritance?  Yes, they do.  However without the 
overloading / overriding it is nothing more than a fancy include.

4. Do CFCs support polymorphism?  I would say no.  I cannot create two 
different methods with the same exact name, but different argument 
types.  That is the essence of polymorphism.  There might be workarounds, 
though.  You could use the cfargument tag with no specified type and then 
use functions such as IsBoolean and IsNumeric to decide what actions to 
perform.

  So, out of four aspects of an Object, ColdFusion supports two of them 
hands down.  For me, the lack of the ability to overload is what makes me 
say you cannot apply Object Oriented development to ColdFusion and why I 
say that CFCs are more aligned with ADTS than Objects / Classes.


> >> I'd lean toward custom tags for formatting - CFCs should be independent
> >> of their environment and should not generate HTML. That approach makes
> >> it easier to reuse CFCs later for web services or Flash invocation.

  That is my thought too.

  I have no additional comments at this time other than the elaborations / 
additions to my original E-mail seemed sound.



--
Jeffry Houser | mailto:[EMAIL PROTECTED]
Need a Web Developer?  Contact me!
AIM: Reboog711  | Phone: 1-203-379-0773
--
My CFMX Book: 
<http://www.amazon.com/exec/obidos/ASIN/0072225564/instantcoldfu-20>
My Books: http://www.instantcoldfusion.com
My Band: http://www.farcryfly.com 

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to