Skip to main content
June 22, 2009
Question

Why use CF in a Java Shop?

  • June 22, 2009
  • 4 replies
  • 1316 views

Sorry, this is a pretty generic question, but why would we use CF in a Java shop? What does CF offer that we can't already do with Java? I've tried to speak to our Java developers about CF and I get the standard answer "it's a specilized language with no resources".

Any feedback on this would be great.

Thanks!

This topic has been closed for replies.

4 replies

Inspiring
July 6, 2009

In the Perl community, the designer of the original language, Larry Wall, along with the writer of one of the O'Reilly textbooks, came up with what he called "the three virtues of a programmer":

from Wikipedia:...

  1. Laziness - The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don't have to answer so many questions about it. Hence, the first great virtue of a programmer. Also hence, this book. See also impatience and hubris.
  2. Impatience - The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer. See also laziness and hubris.
  3. Hubris - Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won't want to say bad things about. Hence, the third great virtue of a programmer. See also laziness and impatience.

In many ways, "ColdFusion is like that."  It lets you write Java programs ... with all the cool stuff that this entails ... much more easily than you otherwise might, because you are impatient.  It works very well at this task because, let's face it, all web-sites (and services) are "99.9% the same."  This is a twist on the virtue of laziness because CF is now doing most of the routine, dull, heavy lifting for you.  (As for the third virtue, hubris, nothing immediately comes to my mind so I won't force the analogy . . .)

You want to "get a routine thing done," and you have a lot of it to do.  So, you express your intentions in the form of CF tags and let the CF engine do its "just in time" magic, and presto... you rode the bus instead of walking.  But you were not locked-out in any way from doing "mongo goovy Java voodoo" if you actually needed to do voodoo...  which 99.9% of the time you don't.

Based on the declarative-style logic that is represented in the CF code, the CF application-server grinds out a lot of Java for you, and a lot of JavaScript code besides, and it's all "good enuf."  Nothing that would qualify as "hubris" but you're not looking for that.  You just have several thousand very-boring web pages to get from this side of town, to that side of town, with reasonable dispatch and without dropping any bits.

June 23, 2009

Great answers...Thanks!

davidsimms
Inspiring
June 23, 2009

Because it will reduce your development time significantly.

Inspiring
June 22, 2009

Hi, Jim,

For me, the top two reasons to give CFML/ColdFusion a close look are (1) Developers have the power of Java at their disposal and (2) It is far and away faster and easier to write web applications with ColdFusion because it's not nearly as complex (in coding, that is).

It gives you the power of Java because, in essence, CF is Java (version 6, aka MX, was a complete rewrite of ColdFusion using Java back around 2001). What this means for Java developers is that ColdFusion gives you access to any Java objects/libraries right from your CFML code. If one has a call for using a Java object in their web application, it takes but one line of code to get going:

<cfset java_object = createObject( "java", "java.lang.some.library.class" ) />

Then you can use that object elsewhere in your CFML code, calling methods, retrieving properties, etc.

In addition to having the Java world at its fingertips, CFML is far less complex to code, thus making it faster and easier than Java alone for developing and maintaining web applications.

Borrowing a commonly referenced example or illustration of CF's ease of use, ask your Java developers if they can connect to a datasource and execute an SQL statement in less code (below) than what CFML needs.

<cfquery name="rs_myresultset" datasource="my_dsn">

    select * from my_table

</cfquery>

Naturally, the aforementioned examples of object creation and data access are oversimplified. That said, I do think they serve to illustrate the larger point: CF is just as powerful as Java for web applications but is far easier to write and maintain.

This doesn't mean CF is the right tool all the time but, I believe that given how many programmer hours can be saved using CFML over Java makes it worthy of a close review.

Good luck!

Craig

June 23, 2009

Thanks for the great answer Craig! I had used CF from 96-99 but not since Adobe bought Macromedia. Since then I've changed companies. My current shop is about 75% Java.

We are investigating Lean so I naturally thought of CF because I know how quickly programs can be written.

I'm going to post another thread on CF and Lean.

Thanks again!!!