Static Methods

New Here ,
Mar 29, 2019 Mar 29, 2019

Copy link to clipboard

Copied

Guys,

We have may CFC in our system and we primarily use them as a means to organize the application, as we have no instance date, but to use them we have to create instances  using cfinvoke.  It is similar to this post made a over 10 years back:

using CFCs statically without cfinvoke

That said from what I can tell CF doesn't have static methods: i.e. a means to create a method in an object and just call that object without instantiating the entire objects (which I'd like to avoid doing).

Views

338

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 30, 2019 Mar 30, 2019

Copy link to clipboard

Copied

nak33  wrote

That said from what I can tell CF doesn't have static methods: i.e. a means to create a method in an object and just call that object without instantiating the entire objects (which I'd like to avoid doing).

That is correct.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 04, 2019 Apr 04, 2019

Copy link to clipboard

Copied

There's got to be some solution or alternative as Adobe encourages that backend code be managed in CFC's yet they provide no efficient means to call those CFCs...this makes no sense.  That and the fact that ColdFusion is build on Java, why not leverage static methods.  I really need something to help with the efficiency of our calls.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 05, 2019 Apr 05, 2019

Copy link to clipboard

Copied

Don't take this the wrong way, but why does there have to be some solution? I mean, this is kind of a perception problem. You don't like the way the language is implemented, compared to Java. I agree that CF's implementation of OOP is not up to speed with Java's, that's for sure. But it's not necessarily a real problem - that is, it may have no actual effect on the performance of your programs.

There's no reason why you couldn't, for example, load a bunch of CFC instances into a persistent scope and call their methods as if they were static. I suspect you'd see equally good performance doing this, and it would take little effort to implement it on your part.

Have you actually measured the efficiency of your calls? What are the exact performance problems you've seen via external measurement?

Dave Watts, Eidolon LLC

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 08, 2019 Apr 08, 2019

Copy link to clipboard

Copied

LATEST

Dave,

No offense taken, and as a matter of fact I’m a long time ColdFusion user and I generally appreciate the way Adobe (and previously Macromedia) have implement things.

That said, in this case it’s a little frustrating. I understand your suggestion, however, I’d prefer not to put these objects into a persistent state as we have quite a large application with hundreds of CFCs.  Furthermore, I was researching and one of the derivitive CFML languages: Lucee, actually has implemented static methods in their CFC definition.  So naturally that‘s what lead to this post to ask ”Why not ColdFusion”? That said I’m open to suggestions or alternatives, I was just looking for something that would efficiently make the calls (moving the CFC method in and out of memory) when needed without having to instantiate the entire object (which is not needed).

Thanks,

Nadav

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines