Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..
SYS-CON.TV
Today's Top SOA Links


ColdFusion and Java — A March made in E-Heaven
ColdFusion and Java — A March made in E-Heaven

Last month I stated that server-side Java was an ideal way to extend ColdFusion, and that Java would be playing a key role in ColdFusion's future. This month I'd like to continue this discussion with an overview of what Java is, what some of those acronyms mean — and what all this has to do with ColdFusion.

Understanding Java

Java started life as yet another programming language, but has quickly evolved to become a complete platform for next-generation computing. Created by Sun, and now supported by many leading software vendors, Java includes component architectures, messaging components, transaction services, security and even APIs for things like wireless communication, telephony integration, smart cards and more.

The Java Language

The original promise of Java was portability — the ability to write code once and have it execute on any platform. Portability is nothing new: C (and C++) promised it originally, and for the most part failed to deliver on that promise.

But there's a significant difference between how C and Java facilitate portability. C code is source code-portable; as long as standard libraries are used, the same source code can (at least in theory) be compiled for multiple platforms. C code can't be executed as is. It needs to be compiled (turned into binary code with instructions the computer can understand). The compiled code is specific to the platform for which it was compiled and thus is not portable. Only the source code is portable.

Java takes a different approach to portability. Instead of requiring that the source be compiled for each platform, Java code is compiled once into bytecode, and that bytecode is portable.3

The Java Virtual Machine

So how can Java be portable when compiled while C cannot? The answer is that Java isn't actually run by your operating system. Instead, it runs within a special environment that must be installed on your computer, the Java Virtual Machine.

As its name suggests, the JVM is a virtual computer that runs on your computer. It supports a special instruction set, and features all the basic functionality that an operating system requires (like file I/O). Java applications run inside that virtual machine. The JVM is very machine and operating system specific, and the internal workings differ greatly from one JVM to another. But those differences are hidden inside the JVM itself. The Java bytecode that runs within the JVM needn't be aware of them at all.

Virtual machines can be thought of as interpreters. They create a consistent environment within which applications can run, and they interpret instructions to operating system-specific calls as needed.

To run Java applications, you must have a JVM installed. The JVM is part of the Java Runtime Environment (JRE), which also includes core Java classes and other supporting files. Beans

Like any good programming language, Java supports reusable components. These are called beans, and there is an entire specification that dictates how they are to be used and developed. Put in different terms (and at the risk of offending Java diehards), beans do for Java what custom tags do for ColdFusion developers.

Enterprise JavaBeans are beans that are part of a scalable, transactional, multiuser-safe, server-side application. EJB run in an EJB server (like JRun 3.0) and are accessed via containers.

Servlets
Servlets are a special form of Java application designed specifically for Web-based applications. They provide simplified access to everything from GET and POST data to cookies and a whole lot more. They can also use beans. Servlets can be used wherever ColdFusion pages are used, as long as you write your code in Java.

To execute servlets, you need an application server that supports them. One of the leading servlet application servers is Allaire's JRun.

JavaServer Pages
JavaServer Pages is a scripting language used to write servlets. JSP developers use special tags (sound familiar?) and scriptlets (intermingled with HTML and any other client-side technology) to create pages. These pages are compiled into servlets that are then executed to process user requests.

Java 2 Platform, Enterprise Edition
J2EE is Sun's new Java platform for developing enterprise applications on top of Java technology. J2EE is less a technology per se than a collection of Java technologies (including EJB, servlets and JSP) that, when combined, provide a complete enterprise-level application development platform.

Java and ColdFusion
So what has all this got to do with ColdFusion? Right now, not that much, but that's about to change. In addition to ColdFusion, Allaire produces another application server, JRun. JRun is a Java-based server that fully supports EJB, servlets and JSP.

ColdFusion and JRun have their respective strengths. The former dominates rapid development — there's no faster way to develop Web-based applications. ColdFusion also features a rich set of core services (including security, scalability and all sorts of extensions). JRun's big advantage is that it is Java, and thus offers all the robustness, scalability, APIs, components, third-party technologies, developer resources and mass acceptance that Java can lay claim to.

And Allaire has now publicly announced that ColdFusion and JRun are going to be merged into a new killer application server — one single product that offers the best of both worlds. For ColdFusion developers this means improved performance, greater extensibility, a massive array of usable services and technologies, and far more respect from the outside world. For Java developers this means faster development (they'll be able to use CFML) and simpler access to core services that CFers have taken for granted for so long.

It's a win-win situation. Developers who want to write in CFML and not think about Java will be able to write just as they do now in ColdFusion. Similarly, developers who want to write servlets can continue to do what they do now in JRun. But for developers wanting to take their applications to the next level, this new application server (code-named Pharaoh) will open doors to a whole new world of opportunities.

Summary
Java is going to play a key role in ColdFusion's future, and the beginnings of this grand plan are visible in ColdFusion 4.5 with its ability to interact with beans, classes and servlets. And as I said last month, this is why I'd recommend that when you need to extend ColdFusion, take a serious look at server-side Java. Besides being a wonderful technology, it's also going to be part of your life in the not-so-distant future. By jumping on the Java bandwagon now, you'll be on track to take advantage of what Allaire has in store for you.

About Ben Forta
Ben Forta is Adobe's Senior Technical Evangelist. In that capacity he spends a considerable amount of time talking and writing about Adobe products (with an emphasis on ColdFusion and Flex), and providing feedback to help shape the future direction of the products. By the way, if you are not yet a ColdFusion user, you should be. It is an incredible product, and is truly deserving of all the praise it has been receiving. In a prior life he was a ColdFusion customer (he wrote one of the first large high visibility web sites using the product) and was so impressed he ended up working for the company that created it (Allaire). Ben is also the author of books on ColdFusion, SQL, Windows 2000, JSP, WAP, Regular Expressions, and more. Before joining Adobe (well, Allaire actually, and then Macromedia and Allaire merged, and then Adobe bought Macromedia) he helped found a company called Car.com which provides automotive services (buy a car, sell a car, etc) over the Web. Car.com (including Stoneage) is one of the largest automotive web sites out there, was written entirely in ColdFusion, and is now owned by Auto-By-Tel.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Dear Ben

Thanks for your help.

Can you recommend any books for a beginner building web application using ColdFusion with JavaScript?

Thanks again.
JT


Your Feedback
JT wrote: Dear Ben Thanks for your help. Can you recommend any books for a beginner building web application using ColdFusion with JavaScript? Thanks again. JT
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers
ADS BY GOOGLE