On 4/4/07, Jaime Metcher <[EMAIL PROTECTED]> wrote:
Sean Corfield, in the nicest possible way, said that if the lack of static or class methods was giving me problems then my application design or my understanding of OO (or both) were faulty. Fair enough. Still trying to work out how to fix that.
Hopefully my somewhat long answer to your Part I email shows that we don't "need" static methods per se because theyr'e really just attached to either a shared non-object (Java-style: something named, e.g., application scope in CF) or to a singleton object (Smalltalk-style).
With reference to Hal Helms' "vision" article (http://www.fusionauthority.com/Views/4649-A-New-Vision-for-ColdFusion.htm), the part I don't get is - how is the "class object" workaround described in part II more in keeping with CF as a lightweight language than adding class methods and variables would be?
I don't see a Part II there - is that the correct URL?
Funnily enough, I've had to delve into some "heavyweight" OO practices (singleton pattern, dependency injection, factory methods) to get what is, in all of those "heavyweight" OO languages, an absolute basic - the notion that a "class" is both a fully-fledged object and an inherent property of every instance. (OK, maybe Java classes aren't fully fledged - they have encapsulation and polymorphism, but not inheritance).
Yeah, Java has a Class type and therefore the "class object" for a given object is an instance of the type Class. Although it has methods for reflection, not actually any "static" methods or variables relating to the actual class for which it is a representation. Smalltalk, OTOH, has real "class objects" and has (non-static) methods and variables on those which behave somewhat like static methods and variables. In ColdFusion, you could have a singleton CFC instance (of type MyThingClass) associated with your regular CFC instances (of type MyThing) and use the Smalltalk-style model. In fact, if MyThingClass was really a factory CFC for MyThing objects, the chances are that you'd be squarely in the Smalltalk-style world here - your "class methods" and "class variables" would simply be (non-static) methods and variables on your factory object and you could ask the factory for actual instances of MyThing.
Is Hal's point that if you need to solve these sorts of problems, don't use ColdFusion?
Hal's point - at least in the article you link to above - is somewhat along the lines of using Java for Java problems (large, well-specified, rarely changing, enterprise systems) and ColdFusion for ColdFusion problems (various scale, perhaps loosely-specified, fast-changing / evolving, new systems).
Or maybe (Sean's point), I actually don't need to solve these sorts of problems and if I understood design better I'd realize that.
Yeah, that was part of what I was getting at (in my sometimes cryptic way). -- 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 You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
