10 July 2007

ColdFusion IS Object Oriented

After reading a Blog Entry of Ray Camden, in a general comment, he made this statement.

"CF is not OO. CF should NOT be OO. And lastly, I pray to God that CF never becomes OO."

I didn't agree, I actually think ColdFusion is OO, and thought that view especially from Ray was odd, then I thought, well perhaps I have it wrong, perhaps CF is not OO and i'm the only one who thinks it is. So I ran a Survey, posted to both cftalk and cfaussie.

The results are quite interesting.

1. Do you consider ColdFusion to be Object Oriented?
Yes: 66%
No: 34%

2. What percentage do you think ColdFusion achieves the ability to code OO style.
0-20%: 2%
20-40%: 4%
40-60%: 24%
60-80%: 44%
80-100%: 26%

3. Would you like the Adobe ColdFusion team to further develop ColdFusion OO features?
Yes: 58%
No: 42%

4. What is the number one feature missing from ColdFusion from an OO point of view?
None / Pass: 52%
Overloading: 16%
Constructors: 10%
Overriding: 4%
Interfaces: 4%
Multiple Inheritance: 2%
Serialization: 2%
Other: 10%

That last one was free text, so I combined a lot of dumb answers into None / Pass and lots of single votes into Other. I consider that CF already does Overriding, but I left it in the stats and CF8 does Interfaces but I left it in also.

But here is my summary of the survey

Of the people surveyed 66% of people think that ColdFusion is an Object Oriented language, 70% of people think that the OO features are between 60-100%, just over half 58% of people think more development needs to be done and the main two things missing are Overloading and Constructors.

So ColdFusion is Object Oriented after all, I have always thought so and am supported by the numbers, we here code our entire application in a OO way so to me it was a no brainer. You could read deeper that if Adobe just added Overloading and Constructors that the CF OO feel would be almost complete but then again 52% of people passed on what the main missing feature was.

I'll continue to collect stats
http://www.surveymonkey.com/s.aspx?sm=vFsaAhAI9bGA0MKKJ99eQw_3d_3d

32 comments:

Raymond said...

You do know - I hope - that a survey doesn't just magically make CF OO. ;)

Todd Sharp said...

77% of statistics are made up on the fly...

Dale Fraser said...

Your quite Right,

But what it may do is make the people who don't think it is already OO realise that it is.

I'm looking forward to your post on how CF isn't OO.

Ben Forta said...

I guess I have to agree with Ray here. CFML is not object oriented. Sure, you can do some OO stuff with CFML, but the language itself is not, and should not be, object oriented. If you want real object oriented development you have that already, it's called Java, and CFML developers can leverage it beautifully. CF is all about productivity and simplicity, and (some will get upset at this, but oh well) there is nothing simple about object oriented development (the productivity of OOP can be, and has been, debated). I think that we (the CF team) need to keep finding ways to encourage better application development, and if OO concepts make sense then they should be introduced to CFML while ensuring that we maintain the simplicity that is CFML (like we did with CFCs). But OO for OO sake? No way. Bottom line, I don't see OO as a goal for CFML at all, I see it as one of the many tools and techniques that we should cherry pick from when, and if, appropriate, so as to create a better CFML.

--- Ben

Raymond said...

Dale, I didn't get a chance to post a blog entry, so when you did yours, I posted an entry on my blog pointing to yours. No need for us to have a disagreement in two different threads, we might as well hash it out here.

First off - I definitely think Ben did a great job explaining why CF isn't OO, which makes my job easier if I just say 'ditto'. :) Shoot, the mere fact that you can write a CF app without classes is enough for me to not consider it OO. try to write HelloWorld in java w/o a class and see how far you get.

Dale Fraser said...

Ben & Ray,

Is it possible, you have been around CF so long and you remember CF being non OO for so long that you can't see that to an OO developer learning CF that all the core OO features are available.

This makes CF perfectly suited to doing either simple procedurally based or OO based developments. Which is a good thing and.

Not sure what it's like on that side of the world, but most people I speak to here use a very OO style in CF, the kind you just simply couldn't do before 6.1 when you introduced the OO featues.

Boyzoid said...

I think an even simpler way of defining it would be CF is OO-capable, but not OO in and of itself.

Anonymous said...

Thanks Ben and Ray for posting follow ups to this post. I almost pulled my hair out. CF is not object oriented. But that doesn't make it "lesser" with respect to its goals as a language for developing a class of scalable web applications efficiently.

One of the great things about the CF community is its enthusiasm, but one of the downsides to the rapid pace of adoption it enables is that often times people in its community make false claims related to engineering web applications out of a complete lack of understanding. It really makes me embarrassed in some circles to say I'm in that community when people make statements like this and then continue to try and defend them. What's worse, a poll of users vote in the MAJORITY that CF is OO when it is not. OO Features, yes... OO language, no way.

Dale, if you want to hear the objective truth, from your post and your reply to Ben/Ray, you don't know what you're talking about. I say this not to be flippant, but you should genuinely try writing some code in an object-oriented language like Ruby, Java, (even C# or some object oriented JavaScript) or even reading a book about engineering an object oriented app before continuing to claim a level of knowledge that clearly isn't there.

CF has some useful OO features. It is NOT an Object Oriented language, nor "OO-capable".

Dale Fraser said...

@Boyzoid, I agree, OO Capable.

@Anonymous, don't be embarrased by your opinion, as you obviously are as to not quote any real name. I have developed in Java & C#. If you read the Survey I never said or asked if CF was pure OO I know it's not even 100% capable, thus the second % capable question.

It's interesting that you think CF can have some usefull OO features withing being OO capable.

Darth Sidious said...

The Sith greatly frown upon those that feel OO in CF is the way to go because it sounds important.

Many Lords in the Empire come from an OO background using pure OO language and have switched to CF - because it's a language that gets the job done nice, fast, and clean.

Operator Overloading...bah... use the power of the darkside.

Dale Fraser said...

@darth aren't you supposed to be opposed to the Jedi (ray) :P

@Ray & Ben, interested if you even feel that CF is OO capable, as if it isn't I have no idea what kind of code we are writing.

Dale Fraser said...

Due to Ray linking to this blog, i've reopened the Survey.

http://www.surveymonkey.com/s.aspx?sm=vFsaAhAI9bGA0MKKJ99eQw_3d_3d

Andrew Scott said...

Well it seems I am a little late on the subject, and as Ben Forta sums it all up.

http://www.andyscott.id.au/index.cfm/2007/7/10/Is-Coldfusion-Obejct-Oriented

Gary Gilbert said...

It's hard to believe that 66% of the people surveyed think that Coldfusion is OO.

Only if one defines OO as the ability to create components, extend other components (lets leave out threading and interfaces since its cf8) and employ "OO-like" development methodologies can one claim that CF is OO.

I like the fact that I can cherry pick (thanks Ben) but am not forced to employ OO programming when I need to create something simple.

I also don't think CF should become an OO language. I don't think OO and RAD can be in the same sentence , and CF is and should remain a high class RAD tool.

Gary Gilbert said...

It's hard to believe that 66% of the people surveyed think that Coldfusion is OO.

Only if one defines OO as the ability to create components, extend other components (lets leave out threading and interfaces since its cf8) and employ "OO-like" development methodologies can one claim that CF is OO.

I like the fact that I can cherry pick (thanks Ben) but am not forced to employ OO programming when I need to create something simple.

I also don't think CF should become an OO language. I don't think OO and RAD can be in the same sentence , and CF is and should remain a high class RAD tool.

seancorfield said...

I'm going to disagree with Ben on a specific point here: he says "if you want real object oriented development you have that already, it's called Java".

That's the root of a lot of CFers problems with OO. Java is NOT the definition of OO. It happens to be one OO language with a particular set of features. Smalltalk is a much better example when discussing CF because Smalltalk is, like CF, a dynamic language. So is Ruby - very much today's darling (even among Java programmers).

Anyone who views Java as the "real OO" is completely limiting themselves. Smalltalk and Ruby are dynamically typed, they don't have interfaces, they don't have a lot of the features that Java has but that's because THEY DON'T NEED THEM!

CF is a very powerful language that has open classes (like many other dynamic OO languages - so you can add / change instance methods). CF also has dynamic variable binding (again, like many other dynamic OO languages). Java has neither of those features.

CF's dynamic typing makes it much easier to build mock objects for unit testing because you don't have to subvert the type system (in Java you are forced into stuff like having mocks extend real objects and then overriding every method to add the behavior you need - in CF, using duck typing lets you simply substitute a mock object that implements whatever methods are needed for the test).

With CF8's onMissingMethod(), CF gains a powerful feature that Smalltalk and Ruby have had for a long time: the ability of an object to respond to arbitrary messages (methods) and behave as a dynamic proxy. Java cannot do that.

Anonymous said...

Over 50% of Americans believe that Iraq had something to do with the September 11th attacks. I guess that makes it so.

Lola Lee Beno said...

I really hope that Adobe doesn't make ColdFusion so OO that it is unneccessarily complicated to use. I like it because it is simple enough to use, yet flexible enough to use OO procedures where necessary.

Dale Fraser said...

I don't think they will overly complicate things, I actually thought they had done that when they introduced CFC's but in reality it makes things easier.

Future OO features won't necessarily complicate things, as you don't have to use them, interfaces is a good example. A bit complicated to understand but you don't have to use them.

But once you understand them, you may find a need.

Brian Swartzfager said...

I think the idea of using a survey to back up one's position as to whether or not CF is OO is a bit odd. Surveys can help you ascertain beliefs and opinions, not facts.

Someone mentioned a survey about the Iraq war as an example of how the majority can be wrong: I think a better example would be the "Is the World Flat" survey in the late 1500s :).

And no, outsiders are not going to see the survey as proof that CF is OO. They're going to see it and wonder why CF programmers need to ask the question in the first place ("Don't they know their own language?").

I don't know what the "accepted" definition of OO is, but if I were to take the term "object-oriented" literally, I would then assume that an object-oriented language is one where all of the aspects of the language are geared/purposed ("oriented") towards the use and manipulation of objects (entities/constructs containing data and functions for acting upon or exposing that data).

Under that definition, CF is NOT object-oriented. I can create and use objects in CF if I choose (and I find myself using them more and more), but I can create whole applications without using a single object if I so choose: the language does not, by its nature, force me to use objects.

mattw said...

I think Brian makes a good point. The survey and the answers to "Is CF OO?" is merely a collection of opinions.

It's like asking "Is CF easy?" My wife would say no. An experienced programmer who knows several languages would say yes. It all depends on your perspective.

The question of "Is CF an OO language?" could be answered once and for all, but only if we all agreed on the definition an OO language is.

As Sean has said, some are saying it has to be like Java. But there are other non-Java-like OO languages. So until everyone agrees on a definition, we will all be stating our opinion.

Adrocknaphobia said...

I think all of the OO-esque features that have been added to CF are fantastic. I definitely wouldn't go as far as saying that ColdFusion is an OO language, simply because ColdFusion does not force you to adopt OO design patterns (like most OO languages).

However, there are two sides of the fence here and I wish we could stay away from statements like "ColdFusion is X" or "ColdFusion isn't X". There are a lot of experienced ColdFusion developers who want CF to have more OO features and there are a lot of non-ColdFusion developers who won't event try ColdFusion because it isn't 'true' OO.

On the other hand there are a huge number of developers who love ColdFusion because it's not rocket science. We certainly don't want to force OO into the language at the sacrifice of ease and productivity.

The bottom line is that ColdFusion is both procedural and OO. It's really up to each and every developer to decide if the ColdFusion code they write is OO or not. For me, thats one of the greatest benefits ColdFusion has over .NET and Java. Developers are truly free to code applications in their own way (for better or worse).

I really hope we continue to add OO-esque features to the language where it makes sense (as long as it's 100% optional).

-Adam

Falken said...

> 1. Do you consider ColdFusion to be Object Oriented?

It has createObject(), which can make things with properties and methods -
therefore it has objects, therefore it's OO.
I'd love to talk to people who said no.

> 2. What percentage do you think ColdFusion achieves the ability to code OO
> style.

See 1.

> 3. Would you like the Adobe ColdFusion team to further develop ColdFusion
> OO features?

A no brainer 'yes' as the question is just 'do you want ColdFusion to have
more features'. It does not say 'at the expense of non-OO features (like
cfprint)', which would be far less likely to get a positive response.

> 4. What is the number one feature missing from ColdFusion from an OO point
> of view?
> None / Pass: 52%
> Overloading: 16%
> Constructors: 10%

CF already has overloading (don't give cfargument a type parameter, or leave
out cfargument all together) - so I'd love to hear from people who plumbed
for that one :-)
I went for Constructors myself, as all we've got is a sort of half-baked
almost by accident convention.

> Overriding: 4%
> Interfaces: 4%
> Serialization: 2%

CF has these already, see overloading above.

> Multiple Inheritance: 2%

You do not want this. It's the wrong solution to composition.

> So ColdFusion is Object Oriented after all, I have always thought so and am
> supported by the numbers,

You're not supported- there is no proof you have a representative sample, and
I'd argue the poll was open for way too short a window as well.
Lies, damn lies and statistics, right ? :-)

Mark Holton said...

"It has createObject(), which can make things with properties and methods -
therefore it has objects, therefore it's OO.
I'd love to talk to people who said no." -Falken

Has to be one of the most ill-informed statements I've heard in awhile (since reading the title of this post on my RSS reader). I agree with Ben, Ray, Sean, and even 'Anonymous'. CF is not Object-oriented. CF is decidedly not OO, and people who know the language and are familiar with OO concepts don't claim it to be. Good luck-

David said...

What do we mean when we say "Object Oriented"?

I think that fundamental definition is missing in this discussion.

I don't know if there is a canonical definition. It seems like some of the posters here have one, and Coldfusion doesn't match it.

According to Wikipedia:
"Object-oriented programming (OOP) is a programming paradigm that uses "objects" to design applications and computer programs. It can use several techniques from previously established paradigms, including inheritance, modularity, polymorphism, and encapsulation."

It's clear that Coldfusion allows (but does not require) a paradigm that uses "objects" to design applications. And I think we would all agree that Coldfusion supports inheritance, modularity, polymorphism, and encapsulation.

So help me out, people who say CF is not Object Oriented-- what's your definition? Is it just the fact that the OO techniques are optional? Yes, there are languages out there that are pure OO-- where you can't run a single line of code without creating an object. CF clearly isn't one of those. But is that the distinction or is it something else?

Anonymous said...

As mentioned here

http://www.andyscott.id.au/index.cfm/2007/7/10/Is-Coldfusion-Obejct-Oriented

Coldfusion itself is not OO, I mean how in the hell can you take a tag like cfdirectory and apply an OO style to it?

Or lets take the CFForm, OO would mean that this would entirely be OO. And it isn't.

The introduction of CFC's and components has allowed for a developer to apply design patterns, that conform to OO style of programming but the language itself is not OO.

Eveyone has to stop and think about this for a minute, CFC's can be programmed without the style of OO try doing that with java, but you can also apply the concept of OO to CFC's thus making it universal to everyones needs.

Don't look at one aspect of the language and judge it to be OO, look at the entire language and the fact remains, Coldfusion as a language is not OO.

Like I said, OO means that I can expand upon what is already there, I can not extend Coldfusion tags or built in functions and they do not behave like OO and can't be used to program in OO styles either.

Give it a rest, Coldfusion is not OO it allows for design petterns to be applied.

Enough said.

Anonymous said...

This reminds me of a debate I had many years ago with one of my friends on whether or not C++ was an OO language.

My answer was it depends on how you use the language and what definition you mean when you say OO language.

I think the same could be said of Coldfusion. C++ does not force you to do OOP but many still consider that language to be an OO language.

If by OO language you mean that the language supports OO patterns and design, then I think Coldfusion would for the most part fit this definition.

In regards to Ben's Java comments, Coldfusion is ran on top of Java. This fact alone makes it virtually impossible to convince me at least that Java and CF are 100% independent of each other. With such a strong tie between CF and Java, it's hard to seriously say CF is not an OO language. Statements like that make me laugh...

Jason said...

It is funny that you argue with Adobe (a la Ben) when they say it is not OO. What does Adobe know? They only develop the platform. Saying it is OO does not make it OO. You can do OO but OO is not required as it is in other languages.

BTW, why use webmonkey when Ray Camden has a CF survey product? :)

Anonymous said...

If Ben said to jump off a cliff I'm guessing you wouldn't have a problem jumping.

Anonymous said...

Collectively, this is an excellent thread. Thanks to Dale for getting it started...

Clint said...

IMHO
Flex or Flash, ie. Action Script could be concidered more of an object oriented language, but not Coldfusion CFML. However, CFML has some similar charecteristics of an OO language and can imitate OO patterns. So can PHP and even Perl.

Gotcha huh. Perl is an OO language, or is it? It all depends on the state of an application. If an application has a dynamic state, the language used is OO as long as it has OO capabilities. In contrast, if an application has a static state, even if the language is "OO", it is no longer technically OO. So Perl used as script for a web site makes Perl in that case non-OO. But use Perl to program a Windows desktop application and suddenly it is OO again.

Frankly, I think that people's ideas and definition of OO is in question and needs to be re-evaluated at length. What is OO? CFML can be used to model objects in the real world, abstract ideas, and encapsulate and extend functionality, isn't that the idea of OO?

My suggestion is another definition such as 'Dynamic OOP' and 'Static OOP'. Dynamic would be traditional where static would be for the new web apps of today.

cozmotrouble said...

Ok, if CF is not OO why do MachII and Model Glue lay claim to being OO?

What's up with that? Are they not OO?

"Mach-II is a powerful, object-oriented, open source MVC framework for ColdFusion that focuses on easing software development and maintenance."

"The Model-Glue family of frameworks support Web application developers by making the construction of Object-Oriented Web and Rich Internet Applications a straightforward process."