This has already been done, I think by Dave Shuck - Search Google for
"SimUDuck + ColdFusion" - that should give you what you need.










"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Andrew Scott
To: CF-Talk
Sent: Wed Jul 11 07:25:31 2007
Subject: RE: SURVEY RESULTS: Is ColdFusion OO?

Sean,

I am going to ask in a different way, and I would hope that you can provide
a code example to explain you reasoning in more detail. When learning design
patterns in Java, the book Head First Design Patterns gives a good example
on the duck, with interfaces and implementation.

I would like for someone like yourself help us understand this in CF better,
because I am not getting it from the technical side that you mention, call
me stupid but I don't get it.

After reading this book, I see that when creating interfaces I can create an
object and know that these methods are going to exist for the object. But to
confuse the issue you say that CF doesn't need it, and I believe it provides
a stronger mechanism for robust code.

So if we take the duck example in the book, how would you apply this in
Coldfusion without using interfaces?



Andrew Scott
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au
Phone: +613  8676 4223
Mobile: 0404 998 273



-----Original Message-----
From: Sean Corfield [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 10 July 2007 7:00 PM
To: CF-Talk
Subject: Re: SURVEY RESULTS: Is ColdFusion OO?

On 7/10/07, Andrew Scott <[EMAIL PROTECTED]> wrote:
> Sean why are you so against this? I welcome this with great open arms...

Java needed interfaces because it is a statically typed language and
had chosen not to support multiple inheritance. It had no choice.

In ColdFusion, all type checking is done at run time. So if you use
interfaces, you will get a *runtime* check, just like all the other
checks. And if you screw up, you'll get a runtime error. If you use
interfaces, the error just has different text in it (OK, that's a
*slight* oversimplification :)

Furthermore, since CF is a dynamic language, you can change methods on
an object after constructing it, thus removing any guarantees that an
interface would buy you. You remove a method or simply replace a
method with a different signature. The interface no longer applies.

Then there's the actual details of how cfinterface performs its type
check. It requires that the function signatures match exactly, as do
the return types. That's not how interfaces work in statically typed
languages. An interface defines a constraining API, not an exact API:
you can specify arguments (in an implementation class method) that are
compatible with the interface method arguments (e.g., adding optional
arguments or using more permissive types). You can also specify more
constrained return types since those can't violate the interface
(i.e., an implementation method can return a subtype of the interface
method's return type).

Finally (thank god you say!), other dynamic OO languages don't have
interfaces - and don't need them. The only reason CF8 has interfaces
is to satisfy the CF-should-be-more-like-Java crowd. And, yes, I admit
I was the person who entered the original ER to add interfaces and,
yes, I whipped up support from the community. I regret that. I should
have left well alone. I've probably done more to cause the
CF-should-be-more-like-Java argument than anyone and that was a big
mistake on my part. I've seen the light now... I hope others do too...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283441
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to