[thelist] CF: Coldfusion doesn't do OOP!

Judah McAuley judah at wiredotter.com
Thu Aug 12 14:31:24 CDT 2010


Yes, CF can be written in an OO style. It has object creation with
instance data, getters/setters, public and private methods (and
scoping such as "package"), data hiding, inheritance (the extends
attribue), composition and polymorphism (method overriding). CF also
supports interfaces.

Coldspring (and other AOP/DI frameworks) are good for lots of things
but they are particularly useful as a solution for the lack of
multiple inheritance.  A large number of OO languages (including Java
and C#) do not support multiple inheritance because of the ambiguities
it creates. Dependency injection frameworks, like Spring (on the Java
side) and Coldspring allow you to say, "I'm going to need methods from
this object, this object and this object. Make sure that they get
loaded in the correct order and that they have their dependencies
loaded so they are ready to use when I need them". This follows along
from the OO adage "favor composition over inheritance".

Hope this helps you out Frank.

Cheers,
Judah

On Thu, Aug 12, 2010 at 8:33 AM, Frank Marion <lists at frankmarion.com> wrote:
> I've run into an argument with a potential employer who exclaimed (sneered?)
> "You can't do OOP in CF, only in Java!".
>
> I know it's not true, and aside from the tricky proposition of correcting
> someone gracefully, and not being fluent in CF-OOP I wasn't able to give a
> really satisfying comeback ("Does so!" isn't compelling). I know that the
> OOP in CF is somewhat imperfect, but I was hoping that someone could offer
> me a solid response to the assertion. When I look up OOP in wikipedia, I can
> see the following.
>
> The fundamental concepts in OOP are
>
> Classes: We have those, we just call them components.
>
> Instance: Anytime we cfinvoke or CreateObject("component" "myComponent") we
> are instantiating a class.
>
> Methods: cffunction.
>
> Message passing. Yup, we can invoke one CFC from another.
>
> Inheritance: This is something that I don't think CF does unless extending a
> cfc handles this.
>
> Abstraction. Yep. We can hide our methods and feed out only within the scope
> we want.
>
> Polymorphism. I don't think so.
>
> Decoupling. Don't know enough to answer well.
>
> I could very much be wrong, but aren't frameworks like ColdSpring designed
> to address issues to emulate polymorphism?
>
>
> Can someone offer a pithy answer that is both graceful and factual? And if
> anyone wanted to clarify the above, that might be nice too.
>
> Thanks!
>
>
>
> --
> Frank Marion
> lists [_at_] frankmarion.com
>
>
>
>
>
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !


More information about the thelist mailing list