ColdFusion's been around for a long time now. Having over a dozen years of CF development under my belt, I suppose I'm a bit of a veteran, and I've seen it through a number of significant milestones. One question that I hear from time to time is this: "Is ColdFusion an Object-Oriented Language?"
The Early Days
ColdFusion first came on the scene in the early days of the modern Web -- 1995. These days, a large part of the Web includes applications, but in the early 90s, much of it included just static content. Businesses wanted their sites to be dynamic -- taking data from the users, populating pages with data from a database, and so on. Some developers used server-side languages like Perl to accomplish this, but it often involved catenating strings to form the HTML response, which is a bit cumbersome.
Instead, ColdFusion sought to accomplish this by creating additional markup tags that could be interwoven within the HTML to easily generate dynamic Web pages. As such, it was easy to learn, which made it a popular choice among Web designers who were sharp on HTML and graphic art, but didn't know the first thing about programming. In a way, this has been CF's blessing and curse during its entire lifetime -- it's had a low barrier to entry, but it's never been able to shake its scripting and templating stigma.
Stepping into the Brave New World
When Macromedia acquired ColdFusion from Allaire, it introduced the concept of ColdFusion Components in version 6. For the first time, ColdFusion developers could begin doing OO-esque techniques, and all of the procedural CF developers out there didn't quite know exactly how to incorporate this new feature into their applications. It was an exciting but bumpy ride at the time. ColdFusion versions 7 and 8 refined Components more, and the community started understanding better how to use them.
Feature Check
So let's take a look at the common features of an Object Oriented language and see how ColdFusion stands up to it.
OO Feature
|
ColdFusion Support
|
Encapsulation
(Data/method bundling)
|
Supported. In CF, classes are called ColdFusion
Components, or CFCs.
|
Instances
|
Supported. You can "new up" instances of
your CFCs.
|
Abstract Classes
|
BlueDragon
supports this, but Adobe CF does not.
Frequently developers simulate this by creating a superclass whose
methods throw an exception.
|
Interfaces
|
Supported, but not
frequently used.
|
Encapsulation
(Info-Hiding)
|
Supported. Data members can be private or public, and
methods can be private, public, package, or remote.
|
Inheritance
|
Supported.
|
Polymorphism
|
Supported, in that you can pass off a subclass as a superclass, or as an interface that it implements. Since it's a dynamically typed language, the object doesn't manifest as the base type.
|
Generics
|
Not
supported.
|
So, is ColdFusion an object-oriented language? I say it scores well enough to generally be regarded so.
Of course, there are many important aspects to consider when evaluating a language, and the most important is not whether the language is OO -- it's whether the language is a viable solution for the particular problem you're trying to solve.
Resources
- This article is discussed in Show #162 of the CFHour podcast at about time code 25:15.
No comments:
Post a Comment