A couple of weeks ago, I blogged about the behavioral differences of the Arguments scope across different ColdFusion versions and contexts. In the comments to that blog, Elliott Sprehn mentioned that I might be able to use Java's TreeMap to allow for ordered arguments. Having not used the TreeMap before, I did some quick googling and found that one of the few references made to the TreeMap in the context of ColdFusion appeared in the book, Java For ColdFusion Developers, by Eben Hewitt. I found this reference in the free online version of Java For ColdFusion Developers; but, finding the topic quite interesting, I decided to pick up a used physical copy on Amazon.
| || || || || |
| || |
| || || |
Java For ColdFusion Developers was published shortly after ColdFusion MX came out; this was the point at which ColdFusion had been completely rebuilt, from the ground-up, to run on top of Java. As such, integrating ColdFusion with Java became a very real possibility (far beyond the CFX-based custom tags). As a language, Java is somewhat of a beast; but, Hewitt takes the topic and presents it in a way that is very straightforward and easy to understand, often times, relating the Java concepts back to the ColdFusion concepts we know already.
The book starts off by walking you through the Java installation process and showing you how to compile and run Java code files. From there, it covers core data types and class architecture, gradually building up to package design and object oriented concepts like inheritance, interfaces, and polymorphism. Even as someone who has done very little Java, I found Hewitt's walk-throughs to be very easy to follow.
The second half of the book gets a little sticky for me. Hewitt goes on to cover JDBC (Java Database Connectivity), Java Server Pages (JSP), and Servlets. Basically, the last half of the book makes you understand why ColdFusion is such an absurdly sexy language. I ended up skimming the last 150 pages because I wasn't sure it would be worth it, at this time, to wrap my head around the complexity of servlets and JSP files. However, servlets do look very interesting; and, when I do have some time, it would probably be very beneficial to understand the context in which ColdFusion files are being executed.
The last 90 pages of the book present a case study of how to build a small ecommerce store using JavaBeans, JSP, and JDBC. The JSP pages look somewhat like ColdFusion templates; but, the half-tags/ half-script approach is reminiscent of the junky CFScript integration that some people use in CFML "views" (you know what I'm talking about - wrapping 2 lines in a CFScript tag in the middle of a 300 line CFML file). Also, there didn't seem to be any JSP-based equivalent to Application.cfc. I don't know if it was just omitted or if it simply doesn't exist; either way, it's unfortunate as the ColdFusion application framework is such a powerful feature of the ColdFusion application platform.
All in all, I rather enjoyed the book. While I did end up skimming the latter half, the book definitely provides an easy-to-digest introduction to Java. And while I know the book wasn't trying to compare Java to ColdFusion, it definitely gives you an idea of why using ColdFusion makes your life so much easier. The book is about 7 years old at this point; but, if you want a good guide to Java, including everything from core data types, to Tomcat installations, to CFX tag authoring, to JDBC, to JSP, it might be worth it to pick up a used copy.
This book won't teach you everything about Java. No book can. As a friend of mine says, "Saying 'I know Java' is like saying, 'I know science.'" There's plenty of material to work with for years to come. But this book will give you a working knowledge of Java basics and a firm foundation on which to increase your knowledge. If you're a ColdFusion programmer looking to learn Java, I can offer no better advice than to buy this book and study it.
Having read the book, this is a sentiment that I can definitely agree with.
Looking For A New Job?
- Senior Web Application Developer at Fidano
- Jr .Net Software Developer at Marketing Holdings
- ColdFusion Developer Position at AIMG
Urk . . . I can see why you decided to buy the hard copy of the book.
Ha ha, yeah - it's "free" online; but it's not packaged in any particularly nice way (like a PDF or anything). Plus, I like to read in bed... which doubles as my couch, and my home office (woohoo for studio apartments!).
Thanks for the review and write-up Ben. Much appreciated!!
My pleasure. If you are interested, check out the online version to get a sense of what the book is like.
Java definitely has corollaries to Application.cfc in the ServletContext--all the same stuff's available, and CFML's application "stuff" is a subset of (and stored in) the ServletConext under the covers. You can learn some pretty interesting stuff by dumping some of the Java ServletContext, request, and session objects and seeing where the CFML application, session, and request variables are located.
Great explanations of all this stuff in O'Reilly's "Head First Servlets and JSPs"--highly recommend it.
Thanks for the insight. The servlet stuff seems very cool. I really with I knew more about it; just didn't want to put in the time at this time to really get a good handle on it. I'll check out that Head First book - their series is pretty awesome in general.
Your CFML/Groovy integration leveraged a bunch of servlet stuff, right?
Yep, had to tap into all the Java stuff since when you integrate Grails and CFML the way I did, Grails is in charge of all the HTTP requests. Everything's still there, you just have to find where it is. ;-)
Very cool! One day, I will know all of this :D
Wow, 2003? Still refers to ColdFusion MX? Amazon makes it available only through used book resellers?
How many computer books can you think of that have remained relevant even this long after they're out of print?
I remember how, just prior to the CFMX release, Ben Forta was writing books on JRun and J2EE. But they weren't the knowledge bridge between the two worlds that this book is.
Too bad it isn't available for iPad (or even Kindle, according to Amazon).
I started out on ColdFusion after developing on Java, so writing Java natively in ColdFusion is what I end up doing, if by accident. Being able to access many methods, such as variable.toString() for a random example are insanely useful.
Then, being able to create objects from classes with createObject.init(variables) saves the day. When I did point in polygon, I used the java shape libraries. Top this off with the ability to thread applications and it surpasses PHP. Of course, it's really a moot argument if you don't use any of that.
From my days in Java, no.. Java, PHP, Perl, Python (that I've worked with) ever have something so SPECTACULAR as application.cfc. onServerStart()? Please, I have a thousand lines of code in there alone to pre populate caches and monitoring services. CF runs most of my windows environment through command line! Written in Java of course.
All in all, CFML is good... be it Adobe's or Railo's or what have you :]
Interesting book, Ben. I'm gonna order this book soon.
It is providing to all a new definition of ColdJava (ColdFusion + Java):)