Understanding ColdFusion

Download Report

Transcript Understanding ColdFusion

Introduction to ColdFusion
Yu Fu
2003 MEC Candidate
Agenda






What is ColdFusion
Core Components & Features
Some Statistics
Limitations
Latest Development
Conclusion
2
What Is ColdFusion





A commercial Web application development
environment
Created by Allaire Corp., owned by Macromedia Inc.
since 2001
Available on Windows, Unix and Linux
Three editions
 Developer, Standard, Enterprise
Not cheap
 $1000 plus for standard edition
 $4000 plus for enterprise edition
3
Competitors





CGI
ASP
PHP
J2EE
.NET
4
Core Components




ColdFusion
ColdFusion
ColdFusion
ColdFusion
Application Server
Administrator
Studio
Markup Language (CFML)
5
ColdFusion Application Server



A middleware between Web server and
other servers like database, email,
LDAP, FTP, etc.
The engine/processor of CFML
Parse ColdFusion application pages,
which contain CFML and HTML tags and
saved with file extension .cfm, to
generate dynamic HTML documents
6
How It Works
(Source: Macromedia® ColdFusion® MX Development By Eric Ladd )
7
Features





page cashing for short response time
Load balancing for scalable
performance and high throughput
Automatic failover for reliability and
availability
Full-text indexing and searching
Extensive support for third-party servers
8
ColdFusion Administrator


It is a Web application written in CFML!
A administration tool to configure and
maintain ColdFusion Application Server




Set up database source (DSN)
Schedule ColdFusion application page
execution
Manage debug, session, security settings
Checking server logs
9
10
ColdFusion Studio



An IDE (Integrated Development
Environment) tool
Make ColdFusion application development
much easier for developers
The part I like best



Tons of CFML code examples
Detailed documentation on CFML, HTML, CSS, etc.
Global search and change
11
12
CFML: ColdFusion Markup Language




A server-side scripting language to create
ColdFusion application pages (.cfm)
It is a language created from XML
Tag based
 All tags start with CF
Intuitive and easy to learn
 if you know HTML
13
Some CFML tags
CFSET
Defines a variable.
CFOUTPUT
Displays a variable.
CFIF CFELSEIF CFELSE Used to create IF-THEN-ELSE constructs.
CFLOOP
Repeats a set of instructions based on a set of
conditions.
CFMAIL
Assembles and posts an email message.
CFQUERY
Passes SQL to a database.
CFCOOKIE
Defines and sets cookie variables.
(Source: ColdFusion Documentation)
14
A Basic CFML Example
<HTML>
<HEAD>
<TITLE>Hi</TITLE>
</HEAD>
<BODY>
<STRONG>Message</STRONG>
<!--- Set a variable --->
<CFSET Name=“Fu Yu">
<!--- Display result --->
<CFOUTPUT>
Hello, #Name#!
</CFOUTPUT>
</BODY>
</HTML>
Original CFML Script
<HTML>
<HEAD>
<TITLE>Hi</TITLE>
</HEAD>
<BODY>
<STRONG>Message</STRONG>
Hello, Fu Yu!
</BODY>
</HTML>
Result HTML document
15
CFML Cont’

Extensive features to build powerful Web
applications







Email
FTP
HTTP
LDAP
Full-text indexing/searching
Encryption
etc.
16
An Email Example
<HTML>
<HEAD>
<TITLE>Sending a simple email</TITLE>
</HEAD>
<BODY>
<CFMAIL
FROM="[email protected]"
TO="#URL.email#"
SUBJECT="Sample email"
>
This is a sample email to show basic email capability.
</CFMAIL>
<H1>Sample email</H1>
The email was sent.
</BODY>
</HTML>
(Source: ColdFusion Documentation)
17
CFML Cont’

Strongest point is database integration


The least code amongst peers
Dirty works are handled by ColdFusion
Application Server
18
A Database Query Example
<HTML>
<HEAD>
<TITLE>Employee List</TITLE>
</HEAD>
<BODY>
<H1>Employee List</H1>
<CFQUERY NAME="EmpList" DATASOURCE="CompanyInfo">
SELECT FirstName, LastName, Salary, Contract
FROM Employees
</CFQUERY>
<CFOUTPUT QUERY="EmpList">
#FirstName#, #LastName#, #Salary#, #Contract#<BR>
</CFOUTPUT>
</BODY>
</HTML>
(Source: ColdFusion Documentation)
19
CFML Cont’

Extensible through custom tags





Java
C++
Delphi
CFML
etc.
20
Some Statistics





More than 125,000 ColdFusion servers deployed
An estimated base of over 300,000 developers
Purchased by more than 10,000 organizations,
including 75 of the Fortune 100 companies
Used to develop more than 19.7 million ColdFusion
pages (Google)
Global network of more than 360 user groups
(Source: MacroMedia Inc.)
21
Limitations


It is not free
Business logic mixed with presentation
markup




So do CGI, PHP, ASP
Not a issue for small and medium sized Web
applications
hard to maintain and enhance when logic
becomes too complex
J2EE and .NET do a better job here
22
Latest Development

ColdFusion Application Server For J2EE
 A Java application which can be deployed on J2EE
platform such as WebLogic, WebSpere, JRun, Sun
ONE, JBoss, etc
 Compile ColdFusion application pages into Java
byte codes
 Enhanced CFML to support JSP, Servlet and Web
Services
 Latest version: MX 6.1
23
Conclusion


ColdFusion is a easy-to-use and
powerful platform to build small to
medium sized Web applications with
probably the shortest time to market
ColdFusion is still evolving, ColdFusion
+ J2EE maybe a good bet
24
References






ColdFusion Documentation inside ColdFusion Studio
Macromedia® ColdFusion® MX Development by Eric Ladd
http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?ColdFusion
http://www.webopedia.com/TERM/C/Cold_Fusion.html
http://www.macromedia.com/software/coldfusion
ColdFusion MX and the J2EE Architecture White Paper.
http://www.macromedia.com/software/coldfusion/whitepapers/
pdf/6_1/cfmx61_j2ee_arch_wp.pdf.
25
Q&A
26