Thursday, January 31, 2008
Should we extend CF Objects with java APIs?
There have been a couple of recent posts regarding extending ColdFusion data types using the underlying java APIs.
ColdFusion array is actually an implementation of java list (java.util.List). So all the list methods are actually available for Array. CF provides most of the list functionality using Array functions but there are few things possible with java list which you can not do directly with CF functions.
For example, you can use java API to search an array to determine the position of a given search criteria.
<cfset myArray = listToArray('vanilla,chocolate,strawberry') />
<cfif myArray.contains('strawberry')>
<cfset strawberryIndex = myArray.indexof('strawberry') + 1 />
</cfif>
<cfoutput>#myArray[strawberryIndex]#</cfoutput>
Note the adjustment that I've made to account for java arrays starting at 0. Russ Johnson, Rupesh Kumar and Adrian Moreno go into how to do this in more detail.
It's really quite cool that we can do this sort of thing, but should we? One of the great strengths of ColdFusion is its backwards compatibility. I have code, written for ColdFusion 4.5, that's been running untouched for 6 or 7 years. For those keeping count that's about 5 major releases ago. Adobe/Macromedia/Allaire has been great over the years about letting us know what's changed with various versions of ColdFusion. What happens if a future version of ColdFusion ends up breaking this functionality? We certainly can't expect Adobe to keep us informed when one of their changes breaks undocumented features of the product.
Perhaps it's because I'm in the middle of planning a ColdFusion 8 migration, but for my money maintainability nine times out of ten outweighs the short term gain of using these features. That's not to say that I'll never use this knowledge, but that I'll think very carefully about the possible consequences and benefits before doing so.
Labels: Adobe, ColdFusion, Java
posted by Luis - 0 commentsFriday, July 28, 2006
Should ColdFusion developers be more Java-like?
As the ColdFusion community is thinking about what we'd like in CF 8, it dawns on me that in some ways we're going through growing pains. In discussing and disagreeing with desired new features, we're asking, "What do I want to be when I grow up?" Should the ColdFusion community as a whole stay focused on web pages with interactivity, or should we start thinking and acting like application developers?Personally, I answered that last question for myself last Summer after we hired a Java developer. Through discussions with him, I realized that I was building web based applications, but treating them as if they were web pages with interactivity. Because of this, most, if not all of my projects ended up being nightmares to maintain, often with quick-fix solutions tacked on later. At that time I decided that I needed to start thinking like, and ultimately become an application developer (since that was what I was in fact doing for a living.)
Where I work, we pretty much use ColdFusion for our websites. In the past we've used ASP, and Perl, but for the most part we're a CF shop. The reason for this and the main reason we stick with it is that using CF allows our web designers to work alongside of our developers using the same IDE (Dreamweaver), while all still being productive and focused on our individual strengths. Sure, our HTML folks have picked up a bit of CF here and there, much the same way that as a CF developer I know some HTML, but for the most part they are experts on graphics and HTML, whereas I'm expected to be the expert on CF. What this has meant is that when our designers need some complex capability, our developer's encapsulate it in a ColdFusion Tag and document it with a dreamweaver extension. The designers simply need to learn one new tag, and they're off to the races. (heck, Dreamweaver even lists out all the attributes for them.)
My point is that while, I don't want to see the ease of entry into ColdFusion change, I do think that those of us who write ColdFusion based web applications for a living need to keep up with and take advantage of the programming innovations and techniques that are in use in other languages such as Java. There are some that do so, but far too few of us. I've learned a great deal from our Java brethren in the past year, and I'm sure there are plenty of lessons to learn from those working in other languages as well. We need to seek out those opportunities and share them within the ColdFusion community.
Will this create a divide in our community? I really don't think so, rather I think that by learning from our Java brothers, we may find opportunities to share with them as well, and in the process perhaps broaden the appeal of CF. All I can say definitively, is that for my part, I've managed to show one Java developer the strengths of CF in such a way that he now prefers CFML to JSP for his web based applications.
Labels: Adobe, ColdFusion, Java
posted by Luis - 0 commentsThursday, July 06, 2006
Taking a Java course
I've been wanting to learn some Java for a while, so when I learned about the free course being offered at http://www.javapassion.com, I signed up immediately. Truth be told, this is the main reason this blog has been so slow in getting off the ground. For the most part I'm finding it clear and fairly easy to follow, although I must say, I'm having my issues with the "this" scope. It doesn't seem to work the way that it does in either CoildFusion or Actionscript.Labels: Java
posted by Luis - 0 comments

