You are on page 1of 7

Migrating from ColdFusion to ASP.

NET

Architecture Comparison

• The most fundamental of all architectural differences between ColdFusion MX and


ASP.NET is the underlying framework that each is based upon.

• ColdFusion MX is Java-based, running on top of Macromedia's JRun server. It also


supports a number of other industry-standard J2EE application servers. At runtime, all
CFML pages are parsed and converted into Java source code, then compiled into Java
bytecode before being executed. After the initial compilation, the cached bytecode for a
page is re-executed without the need for further parsing or compilation.

• ASP.NET is based on Microsoft's .NET Framework. At runtime, all ASP.NET pages are
parsed and converted into source code for a .NET-compatible language (usually
Microsoft Visual Basic® .NET or C#) and then compiled into Microsoft Intermediate
Language (MSIL), a processor-independent bytecode with many similarities to Java
bytecode. This MSIL is then further just-in-time compiled into native machine code before
being executed. After the initial compilation, the cached native machine code for a page
is re-executed without the need for further parsing or compilation.

• Although the low-level frameworks underlying each system cannot be ignored, the most
striking differences between ColdFusion MX and ASP.NET that many Web developers will
notice occur at a much higher level—in the development and page execution models.
While the details vary, ColdFusion follows the same development and page execution
model as that of classic ASP, PHP, JSP, and other similar Web-scripting languages.
Specifically, code is embedded in HTML markup, and as a given page executes from top
to bottom, the output of the code's execution takes the place of the embedded code in the
resulting HTML document.

• This development model is easy to grasp, but it does have a number of drawbacks. Chief
among these is the lack of separation between application logic and presentation
markup. Mixing code and presentation makes the code harder to read, which increases
the time and effort involved in maintenance, and creates significant challenges for non-
programming graphic designers who need to modify a page. Over the years, ColdFusion
has introduced several ways to mitigate this lack of separation, including custom tags,
and others—but the fundamental model remains.

• ASP.NET, however, makes a very distinct break from the traditional model of Web
application development. Rather than being linear and page-oriented, ASP.NET code is
strongly typed, object oriented and event based. Basically, ASP.NET development is a
blending of traditional Web development and traditional fat-client GUI development. Page
elements are represented on the server-side by objects, each with its own properties,
methods and events.

• An example is a page that posts back to itself and inserts some information from a form
into a database. In ColdFusion, you might write some code to check for the existence of a
form variable corresponding to the name of the HTML submit button to see if the page is
loading for the first time, or as the result of a form submission. Then you would read the
various form variables, validate them, and perform a database insert. If one or more form
variables failed validation, you would need to write more code to display an error
message to the user and to preserve the values the user has already entered.
• In ASP.NET, you simply bind a function to the Click event of a Button server control.
Within this function, some code will read the Text property of the various form fields,
represented on the server-side with TextBox objects. By the time the button's Click
event has fired, form field validation has already been performed by any validation
controls on the page, which also take care of displaying any necessary error messages to
the user. Each individual TextBox takes care of preserving its own contents in the event
users need to edit one or more of their entries.

• Performance is also much better on asp.net. Pages that took 300 to 1500 ms on
coldfusion take 20 to 100ms (at most) in asp.net. Rarely do I see many asp.net pages
that take over 20ms to process.

• ASP.NET apps have better chance of surviving application life cycles because of better
encouraging of separation between presentation and business logic.
Whereas most of the CF apps mix it inline on the page, producing spaghetti code... easy
to create, hard to maintain.

Table 1. Comparing the Features of ColdFusion MX and ASP.NET

Feature ColdFusion MX ASP.NET


Coding Language Has two related coding Supports more than 25 languages,
languages: CFML and but the 2 that are most-commonly
CFScript. Most developers use used are Visual Basic .NET and
a mix of CFML and CFScript. C#. Most developers pick one
language but can consume
components written in any of the
other supported languages.
Compiled Supported, dynamically Supported, in both dynamically-
Application Logic compiled. compiled and precompiled
Increases website modes.
speed (precompiled
is the fastest)
Full-Page Output Supported, caches different Supported, caches different
Caching versions of the page based onversions of the page based on one
all URL parameters. or more URL parameters, browser
type, a custom function or any
combination.
Partial-Page Output No built-in support. Built-in support through use of
Caching User Controls. Data and other
objects can be cached with
sophisticated expiration rules
using the Cache API.
Database Access Supports Type III and Type IV Supports OLE-DB and ODBC
JDBC drivers, as well as ODBC directly, as well as including
via a JDBC-ODBC bridge. native drivers for MS SQL Server
and Oracle.
Database Output Formatted output using looping Templated databinding to server-
with the CFOUTPUT or side controls for ease of
CFLOOP tags. development, or manual looping
if that is preferred.
External Supports CORBA objects, Java Very good support for native C
Components and EJB object, and JSP tag libraries and COM objects, as
libraries, as well as special well as assemblies written in any
extension tags written in C++ or .NET-compliant language,
Java. COM is supported, but including Managed C++. No
from most reports is rather built-in support for CORBA
unreliable in the current release. objects or Java classes.
XML/XSLT Basic XML DOM and XSLT Comprehensive and easy-to-use
transformation is supported in support is provided for XML
an intuitive fashion, but there is DOM, XSLT, validation, and
little to no access to advanced lightweight stream-oriented
features such as XML parsing of XML documents.
namespaces, XSD validation,
and XSLT parameters.
Lightweight stream-oriented
parsing of large XML
documents (such as SAX) is not
supported.
XML Web Services The current release supports The current release provides
publishing and consuming Web extensive and flexible standards-
services with a beta version of compliant support and makes it
Apache Axis. Publishing and extremely easy to both publish
consuming Web services are and consume Web services.
very easy, but there are some Asynchronous calls to Web
known compatibility issues that services, and the creation of Web
may be corrected by an update services that can be called
that uses Apache Axis 1.0. asynchronously are supported
Another major limitation is that with ASP.NET.
asynchronous calls to Web
services, and the creation of
Web services that can be called
asynchronously are not
supported.
Session State Cookie-based, in-memory Cookie-based or cookieless
single-server session state, or session state, using a single-server
cookie-based persistent "client in-memory store, a centralized
state" using a database back- state server, or a database back-
end. Cookieless sessions are end. In addition, the extensible
supported but can require architecture allows for custom
moderate-to-extensive session-state modules to replace
modification of existing code in the built-in options. Cookieless
order to take advantage of them. sessions require only a
configuration change to enable.
Built-In ColdFusion MX has built-in ASP.NET has direct access to the
Functionality functions to cover many entirety of the .NET Framework
common tasks that a Web-based class libraries, which encompass a
application may need to vast amount of functionality. This
perform. It can also access Java functionality is comparable to
class libraries with some extra Java, but far more than is natively
work. exposed in ColdFusion.
Regular Supports a mostly-Perl-5- Supports Perl-5-compatible
Expressions compatible regular expression regular expressions, with
syntax, but has only partial additional features such as right-
Unicode support. to-left matching, precompiled
expressions, named groups, full
Unicode support. Also allows the
user to specify a function to be
called during a regular expression
replace operation.
Debugging Includes extensive tracing and Includes extensive tracing and
environment information that environment information that can
can be included in the page or be included in the page, or
displayed in a separate page. displayed in a separate page.
DreamWeaver MX and Visual Studio .NET allows for
HomeSite+ allow for interactive easy interactive debugging of
debugging of pages as they pages as they execute, in addition
execute, although the initial to debugging of client-side
setup for debugging in either JavaScript and SQL Server stored
IDE can be difficult. procedures.
Error Handling Supports structured error Supports structured exception
handling, raising custom errors, handling (with the addition of a
and specifying custom error "finally" block for code that
pages for different types of executes regardless of whether or
unrecoverable errors. not an error occurs), raising
custom exceptions, and
specifying custom error pages for
different types of unrecoverable
errors.
Charting Includes support for generating No built-in support, although
a variety of basic charts in JPG, third-party components are
PNG, or Flash format. available.
Image Manipulation No built-in support, although Includes extensive image creation
third-party components are and manipulation facilities.
available.
Code Re-Use Custom tags, user-defined User Controls, Server Controls,
functions, ColdFusion custom classes, and included
Components, and included files. files.
Threading No support, aside from the fact Fully supported. Not only do
that simultaneous page requests simultaneous page requests
happen in separate threads. happen in separate threads, but
also each page can (if needed)
spawn its own threads to perform
simultaneous or asynchronous
work.
Full-Text Search Includes a stripped-down Does not include a built-in search
version of the Verity search engine but can access MS Index
engine and allows access to a Server for full-text searching of
full-featured Verity K2 server. files. Can use any built-in full-
Can use any full-text search text search features provided by a
features provided by a database database vendor. The Verity K2
vendor, and other search server can be accessed through its
engines can be accessed provided COM and .NET API's,
through their respective COM and other search engines can be
or Java API's. accessed through their respective
COM or .NET API's.
Data Caching Allows for time-based caching Includes an extensive cache API
of database query results. Other that allows nearly any type of
types of data can be explicitly data (including database query
stored in application or session results) to be stored, with
variables, but expiration and expiration based upon time,
concurrency locking must be usage, or dependency upon a file
handled manually. or another cached item. Also
allows for a user-defined function
to be called when a given item is
removed from the cache.
Internationalization Supports Unicode strings and Supports Unicode strings and
various character encodings and various character encodings.
includes a variety of functions Date, number, and currency
for converting numbers, functions are all culture-aware
currency, and dates to a locale- and alter their output depending
specific format. Some functions on what the current culture is set
are culture-aware, and others to (rather than requiring different
are not. No built-in support for functions to be called). Support
dynamically localizing an for using resource files to
application into a specific dynamically localize an
language or culture. application is included.
SMTP, HTTP, FTP, Supported, although CFMAIL SMTP support depends upon the
POP3 is generally viewed as rather Internet Information Services
unreliable. (IIS) SMTP Service. HTTP has
very good support. FTP and POP3
are not supported in .NET, but
free and commercial third-party
components are available for this
functionality.
Web Server Support Supports IIS, Sun ONE, Supports IIS and Covalent's
Netscape IPlanet, and Apache. commercial version of Apache
2.0.
Operating System Supports Windows, Linux, Currently supports Microsoft
Support Solaris, and HP-UX. Windows® 2000, Windows XP,
and the forthcoming Windows
Server 2003.

What is ColdFusion?

• ColdFusion is the hot way to create dynamic webpages that link to just about any
database.
• ColdFusion is a programming language based on standard HTML (Hyper Text Markup
Language) that is used to write dynamic webpages. It lets you create pages on the fly
that differ depending on user input, database lookups, time of day or whatever other
criteria you dream up! ColdFusion pages consist of standard HTML tags such as <FONT
SIZE=.+2.>, together with CFML (ColdFusion Markup Language) tags such as
<CFQUERY>, <CFIF> and <CFLOOP>. ColdFusion was introduced by Allaire in 1996,
acquired by Macromedia in a merger in April 2001, and acquired by Adobe in December
2005. It is currently in version 7.0.1, but the next version of the product (codenamed
Scorpio) is already in development.

• Creating an application with ColdFusion is as straightforward as creating a static Web


site. However, in a ColdFusion application you can introduce an incredible range of
functionality that is not available either in static Web sites or in traditional client/server
applications. A ColdFusion application is very simply a collection of pages, similar to a
static Web site. But unlike the pages in a static Web site, the pages in a ColdFusion
application include the server-side ColdFusion Markup Language (CFML) in addition to
HTML. CFML gives you the ability to control the behavior of your applications, integrate a
wide range of server technologies, and dynamically generate the content that is returned
to the Web browser.

• When a page in a ColdFusion application is requested by a browser, it is automatically


pre-processed by the ColdFusion Application Server. Based on the CFML in the page, the
Application Server executes the application logic, interacts with other server
technologies, and then dynamically generates an HTML page which is returned to the
browser.

Early versions
The first version of ColdFusion (then called Cold Fusion) was released on July 10, 1995. This first
version was written almost entirely by one person, JJ Allaire. Primitive by modern standards, early
versions of ColdFusion did little more than database access.[1]
All versions of ColdFusion prior to 6.0 were written using Microsoft Visual C++. This meant that
ColdFusion was largely limited to running on Microsoft Windows, although Allaire did successfully
port ColdFusion to Sun Solaris starting with version 3.1.

Releases
1995 Allaire Cold Fusion version 1.0
1996 Allaire Cold Fusion version 1.5
1997, Jun Allaire Cold Fusion version 3.0
1998, Jan Allaire Cold Fusion version 3.1
1998, Nov Allaire ColdFusion version 4.0 (space eliminated between Cold and Fusion to make it
ColdFusion)
1999, Nov Allaire ColdFusion version 4.5
2001, Jun Macromedia ColdFusion version 5.0
2002, May Macromedia ColdFusion MX version 6.0
2003, Oct Macromedia ColdFusion MX version 6.1
2005 Macromedia ColdFusion MX 7
2007, July 30 Adobe ColdFusion 8
2007, Ongoing Adobe ColdFusion 8 Updater 1 (aka ColdFusion 8.0.1) currently under
development - due early 2008.

ColdFusion and .NET


• ColdFusion 8 is the first version to natively support .NET within the CFML syntax.
ColdFusion developers can simply call any .NET assembly without needing to recompile
or alter the assemblies in any way. Data types are automatically translated between
ColdFusion and .NET (example: .NET DataTable → ColdFusion Query).

• A unique feature for a J2EE vendor, ColdFusion 8 offers the ability to access .NET
assemblies remotely through proxy (without the use of .NET Remoting). This allows
ColdFusion users to leverage .NET without having to be installed on a Windows
operating system.

• The move to include .NET support in addition to the existing support for Java, CORBA
and COM is a continuation of Adobe ColdFusion's agnostic approach to the technology
stack. ColdFusion can not only bring together disparate technologies within the
enterprise, but can make those technologies available to a number of clients beyond the
web browser including, but not limited to, the Flash Player, Adobe Integrated Runtime
(AIR), Mobile devices (SMS), Acrobat Reader (PDF) and IM gateways.

Summary
A migration from ColdFusion to ASP.NET can be as simple or as complex as it needs to be. Your
migration could be a straightforward port of existing functionality or a complete rewrite that takes
full advantage of ASP.NET's advanced features. Nearly every feature present in ColdFusion has
an equivalent in ASP.NET, which facilitates a straight port that requires very little effort beyond
basic syntax translation. However, if time constraints allow, a re-examination of the application's
architecture (in light of ASP.NET's unique capabilities), can lead to a significant improvement in
the application's performance, scalability and functionality.

You might also like