Wednesday, 21 August 2013

Cocks: or "the Stack Overflow community" as they perhaps prefer to be known

G'day:
F*** me Stack Overflow is populated by cocks. I was amidst answering someone's CFML question when an insecurity of self-appointed moderators (I have decided "insecurity" is an apt collective noun for these people) closed the question underneath me, so I could not post the answer.


So in the spirit of a) helping the person; b) not wasting my time; I'll reproduce the answer here, and link to it from a comment on the question. I've also voted to re-open the question, as it is possible to give the person the guidance they need to get moving forward.
 
Realistically, you really should be able to resolve this by simply RTFMing a bit more thoroughly than you already have. However - despite it being a lazy question - it's fairly easily answered. Firstly let me disabuse you of something though:

> there is no option to create classes in coldfusion without using the
> java,com and corba

This is just you not reading properly. Even on the page you link to (cfobject, which is pointing to an obsolete version of ColdFusion btw), the third link it provides "component object" discusses instantiating native CFML "classes" ("components" in CFML parlance, for some reason). It's perhaps not clear from top-level browsing that a "component" is a "class", but if you're learning something, you should be doing more than top-level browsing.

You are approaching your learning from a very odd angle: reading up on how to instantiate an object is not the direction you ought to be taking if you want to find out how to define the class the object will be an instance of. It kinda suggests a gap in your knowledge of OO (which could make this work a challenge for you).

Anyway, of course CFML allows for the definition of classes and the usage thereof, natively in the language. And has been able to do so since v6.0 (although this was not really production-ready until 6.1, due to some poor implementation decisions), over a decade ago.

The answer to your question (beyond "learn the tools of your trade") are kinda too broad for a Stack Overflow question/answer, but you need to read the docs starting with "Building and Using ColdFusion Components". But the basic form is:

// Foo.cfc
component {
    public Foo function init(/* args here */){
        // code here
    }
    // etc
}


And that sort of thing.

So RTFM, and get back to us if you have any specific CFML questions that can't be answered by Google or a search of the docs. Those are the sort of questions one should be asking on Stack Overflow. And which will be unlikely to be closed by a bunch of fascist zealots.
So I'm being a bit blunt, but I think that's "warranted" (or not "completely misplaced", perhaps).

Anyway, it's not very interesting narrative for a blog article, and I have a better one up my sleeve, so I will crack on with that. Back soon.

--
Adam