tracker issue : CF-4122602

select a category, or use search below
(searches all categories and all time range)
Title:

WriteOutput should be a member function

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): James Mohler / James Mohler (James Mohler)

Created: 02/28/2016

Components: Language

Versions: 2016

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Mac 10.11

Vote Count: 1

WriteOutput should be a member function. I should be able to



myObject.processresults().writeOutput();

When combined with encoding

myObject.processresults().writeOutput("html");

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4122602

External Customer Info:
External Company:  
External Customer Name: James Mohler
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

The member function can probably be named as .output(), keeping it in line with <cfoutput>
Comment by Immanuel N.
4439 | March 01, 2016 12:27:29 AM GMT
I don't know that this is particularly sound design from an OO perspective. Implementing this would mean all data types would need to know about what it is to be output; know about the request context and the response object and in general what it means to output something, which doesn't - to me - sounds like the job of those classes. A String is not an "outputter", it's just something that defines what a string is. One would use a separate class for dealing with what it is to output something. Unsurprisingly, I think languages like Java and C# get this right: static methods in the system package to output standard data types. And if one squints and pretends CF has a system package and it mounts all its methods in a headless fashion, then this is what we already have with writeOutput(). Are there any OO languages that take James' suggested approach? (Serious question). This should perhaps be a guideline when designing CFML here. If you wanted as specifically OO treatment of writeOutput(), you'd be better off exposing a System object which has it as a a method. There is already an analogy to this in the CLI class. Consider this a negative vote for this one. Also James, how did you manage to vote for your own ticket? That didn't used to be allowed..?
Comment by External U.
4440 | March 03, 2016 01:41:15 AM GMT