I wrote such a "getMetaData()-based method validation" last time we
discussed interfaces. It was just for fun, so i haven't used it in
production, but it could serve as a source of ideas. I've attached the
files here - hope they make it through. The basic idea is that the
init() method of the "interface" cfc checks whether the wrapped cfc
instance implements the correct methods and throws an error if it does
not.

/t

>-----Original Message-----
>From: [EMAIL PROTECTED] 
>[mailto:[EMAIL PROTECTED] On Behalf Of Barney Boisvert
>Sent: Monday, June 06, 2005 5:06 AM
>To: [email protected]
>Subject: Re: [CFCDev] Interfaces: Is is my approach getting a 
>little silly?
>
>I'm definitely on the pro-interface side of things, but I've also
>decided that hoping for CF to have that sort of feature is probably
>never going to happen.  CF is a very runtime-centric language, so
>having the MethodNotFoundExceptions (or whatever they are) thrown at
>runtime for a CFC that doesn't adhere to the proper method set is
>appropriate.
>
>The biggest thing you lose is not being able to find errors until you
>actually run the code, which means you absolutely HAVE to have some
>sort of testing framework in place, but such is life.  With Java (or
>other langauges with strong typing) the compiler will do all those
>type checks for you, and ensure everything's valid, but not CF.
>
>Bottom line, I wouldn't worry about implementing your interface
>proxies, but I might consider the getMetaData()-based method
>validation as part of your build or testing process.  It's too
>expensive to built into your app (both in terms of performance and
>maintainability), but as a testing tool, it could prove very valuable,
>especially as the size of you application grows.
>
>cheers,
>barneyb
>
>-- 
>Barney Boisvert
>[EMAIL PROTECTED]
>360.319.6145
>http://www.barneyb.com/
>
>Got Gmail? I have 50 invites.
>
>
>----------------------------------------------------------
>You are subscribed to cfcdev. To unsubscribe, send an email to 
>[email protected] with the words 'unsubscribe cfcdev' as the 
>subject of the email.
>
>CFCDev is run by CFCZone (www.cfczone.org) and supported by 
>CFXHosting (www.cfxhosting.com).
>
>CFCDev is supported by New Atlanta, makers of BlueDragon
>http://www.newatlanta.com/products/bluedragon/index.cfm
>
>An archive of the CFCDev list is available at 
>www.mail-archive.com/[email protected]
>
>
>



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Attachment: testinterfaces.cfm
Description: testinterfaces.cfm

Attachment: interface.cfc
Description: interface.cfc

Attachment: baseInterface.cfc
Description: baseInterface.cfc

Attachment: b.cfc
Description: b.cfc

Attachment: a.cfc
Description: a.cfc

Reply via email to