Posts in Category "Uncategorized"

CFCs vs. UDFs

Ben Forta recently blogged about a conversation he had with Simon Horwith in London about when to use a CFC versus when to use a custom tag. I completely agree with the conclusion they came to, which was basically that CFCs make sense for logic and data abstraction, and Custom Tags primarily make sense for presentation.

Another interesting question to ask is when should one use CFCs versus UDFs? While I would much rather have this conversation at a Starbucks in London, I guess my weblog will have to suffice.

Since the release of CFMX, I actually find myself writing very few UDFs. I still find them occasionally useful for “one-off” application-specific functionality, but in general, I’m much more inclined to write a component for the following reasons:

  • State: Components can contain state while UDFs cannot. For instance, many native ColdFusion functions require you to pass in the data being operated on in addition to parameters to configure the operation. Having a stateful data structure can promote better encapsulations, make your code cleaner, and in general, be more convenient. Even if your function appears as though it should be static, why not put it in a component and allow yourself some flexibility to expand the functionality in the future?
  • Logical Grouping: I like to be able to put related functions together in a single component rather than just create a bunch of basically unrelated functions. For instance, one could imagine a single date component with 41 different functions as opposed to 41 date-related functions among a total of 235 unrelated functions.
  • Organization: I like having the ability to organize my components into packages. Although you can organize your UDFs into directories, packages provide additional benefits and flexibility.
  • Inheritance: I honestly don’t use a ton of inheritance with ColdFusion components, but I do use it occasionally, and I think my application architecture benefits from it. Although UDFs can certainly invoke each other to achieve the “code reuse” aspect of inheritance, in general, inheritance allows for far more sophisticated modeling.

So how do you decide when to use a component versus a UDF? And who’s up for rewriting all 235 native ColdFusion functions, grouping them into components, and organizing them into packages?

A MAX Retrospective

So how was MAX? How were the Day One and Day Two keynotes? How were the sessions? How was the food? What did you think of Salt Lake City? How was your hotel? Did you get one of those cool rockets from the B-Line Express booth? How did the experience compare to DevCon last year?

I, for one, had a blast. My hotel was nice (but a little far from the conference center, so my legs are still sore). I thought the keynotes were great (especially the DRK portion of Day Two!). The sessions I attended were very informative, and I really enjoyed being in Salt Lake City. It’s actually a beautiful place with good restaurants and breathtaking scenery.

I think what I most enjoyed about MAX was talking to Central developers and really getting a sound understanding of the platform. I have always like and understood Central, but it wasn’t until I started using it that I really started to understand the value of it. I’m looking forward to seeing what the community does with it.

Post your thoughts here, or send them directly to me. I’d like to hear from you.

MAX Update II

I just got out of the day 2 keynote which turned out great. The format was that of a morning talk show. Eileen Stanley played the clueless blond hostess, and Tim Buntel played the cheesy baritone host. They both did a great job. I did a small segment on the DRK, highlighting a Flash extension and Blog Man. I really liked the more casual nature of the day 2 keynote. I think everyone had a great time.

Last night, I went to the Central developer playground. You can find some pictures posted on Community Vision (I’m the one kicking butt at SSX 3). It was a great event with all kinds of games, pizza, beer, and a sneak peak at the Central easter egg.

I have a lunch to go to, and then I will spend the rest of the day in sessions until the event tonight. I’m not entirely sure what it is, but I hear it involves bungie jumping. Hopefully I’ll be around to blog again tomorrow.

By the way, I still have one more DRK 5 CD to give away. I’ll give it to the next person to post a picture of Mike Chambers on Community Vision.

MAX Update

I haven’t had a lot of time to blog since I’ve been here, but quite a lot has happened. First of all, it’s been a blast hanging out with so many great developers in the Flash and ColdFusion communities. I don’t want to start listing names because I don’t want to leave anyone out, but it’s a great group of people who I always look forward to seeing at these events.

I just got out of a session by Danny Dura during which he dissected a Central app. The idea of Central is really growing on me. I’ve always thought it was cool, but now I’m really realizing how much potential it has. I’ve talked to some people here who aren’t quite sure what the advantages of Central apps are over Flash apps embedded in web pages. This is the way I see it:

The browser equivalent to Central would be a collection of bookmarks or favorites pointing to various sites with Flash applications embedded in them. If these applications were important to you, you would presumably visit them daily. The process would be something like:

  1. Go to a bookmark
  2. Log in
  3. Load data
  4. Browse and/or interact with the applications
  5. Go to the next bookmark and start again

Now consider the Central model. Rather than visiting one site at a time, all of your favorite applications are always open, always updating themselves, always caching data, potentially communicating and collaborating, and always ready to alert you in a standard way of something you should be aware of. And since they are running locally, there’s no need to log in. Incremental caching is a very important aspect of Central since it allows you to grab your laptop and go, and still browse information offline that is potentially new to you. Asking what the difference is between Central and Flash on the web is like asking what the difference is between instant messaging and email. The differences may seem subtle, but they are in fact profound.

And speaking of instant messaging, it was announced during the keynote that an AIM and ICQ Central API will be available. That means you will be able to integrate AIM and ICQ instant messaging right into your applications. Incredibly cool! There was a demo of two guys chatting — one with an Central AIM client, and one with the standard Windows client. It was seamless!

The Flex demo was wild. Christophe Coenraets built an awesome RIA right in front of us in about 3 minutes using nothing but a text editor. The crowd was amazed.

Ben Forta did a great job with ColdFusion during the keynote. It kind of seems like ColdFusion isn’t getting a huge amount of attention right now simply because it is so mature and solid at this point. Don’t be fooled, though; there are some great new features in the works. Although we obviously can’t get into specifics, Ben did mention sophisticated reporting and printing capabilities and some interesting new deployment options involving encryption.

If you are here at MAX, come say hi! If you’re not, more to come…

Introducing Community Vision (beta)

I just finished installing a beta version of a new application called Community Vision. I’ve been working like mad this weekend trying to get it ready in time for MAX. Community Vision lets anyone email pictures up to 40K as attachments to vision@markme.com, and within five minutes, the pictures will automatically get published to Community Vision. The subject of your email will become the picture’s title, and the body (text only) will become the caption. Give it a try and see how it works.

Let me know if you find any issues with Community Vision (it’s still in beta). Also, feel free to email me with suggestions for future versions as I intend to continue to develop Community Vision once MAX is over.

For those of you going to MAX, the first three people to post MAX photographs to Community Vision, then find me at the conference, will get a free copy of DRK 5.

Oh, and keep an eye out for the Community Vision Central front-end. Mike Chambers and I were up late last night discussing it, so I’m sure it won’t be long…

MAXBloggers Now Supports RSS 2.0 Filters

Previously, in order to be able to filter out MAX specific posts from feeds containing posts for multiple categories, MAXBloggers’ filter expected the category to be specified as <dc:subject>. I tweaked the filter this morning so that it now supports the RSS 2.0 <category> tag, as well. If you’re feed is RSS 2.0, you can now contribute to MAXBloggers!

Recruiting MAX Bloggers

Why haven’t I been blogging for the last couple of days? Because I’ve been working like mad on MAXBloggers.com. MAXBloggers.com is the official MAX weblog aggregator. If you are going to MAX and you plan on blogging it, we want you to contribute to MAXBloggers. If you are not going to MAX, keep up with the latest news by reading MAXBloggers.com.

Here’s how it works. If you are attending MAX and you have a weblog (or want to set one up before you leave), we will aggregate your feed provided that you either:

  1. Create a dedicated MAX feed, or
  2. Create a dedicated MAX category that we can filter on.

We can accommodate either method, so do whichever is easiest for you. For more information, click on the “Add Your Feed” link at www.maxbloggers.com.

MAXBlogger Test

This post is to test MAXBlogger.com’s filtering ability. I will explain further in my next post (assuming this works).

DRK 5 Released

DRK 5 was released today to DevNet subscribers. As always, there is plenty of cool ColdFusion content.

  • Blog Man: Blog Man is a web log manager built in ColdFusion. A year in the making, this application balances manageability with scalability. It features many of the tools you’ve probably seen in Movable Type and other blog applications…
  • Lighthouse Bug Tracker: Lighthouse Bug Tracker is a simple system that enables bug tracking in projects. It makes tracking (and tackling) development issues simple and straightforward…
  • Pollster 2.0: Macromedia Pollster 2.0 is a hybrid ColdFusion/Flash application for easily creating and deploying polls and poll results on your website. Some of the new features in Pollster 2.0 include user accounts, unlimited options, automatic and manual updates of poll results, and automatic poll archiving…
  • Weblog Service: Weblog Service is an application that allows you to expose any RSS feed (regardless of version) as a web service. Once this feed has been exposed, clients can query your RSS data as though it were a database…
  • Socket.cfc: The Socket component allows you to create a two-way communication link between your server and another server. Socket connections are often called “raw socket connections” because they work at a lower level than something like the CFHTTP tag and they don’t assume any kind of protocol other than what’s needed to make and manage the socket connection…
  • CFID3 Component: The CFID3 component is based on the open-source JD3Lib Project, which allows you to manipulate the ID3 tags of MP3s natively with ColdFusion MX. Additionally you can update a database with parsed ID3 information…
  • HTTP Agent: Every time your application uses the CFHTTP tag, it spends a sizable amount of time waiting for a response from the HTTP request. During that time, your application sits idle. This may be all right if you have only a single request to make but imagine if you have dozens or hundreds to make. Wouldn’t it be great if you could put that time to better use? HttpAgent does just that. Instead of executing a single request and having it block (wait for response), you can execute as many simultaneous connections as you wish…
  • Query Randomizer: The Query Randomize user-defined function, queryRandomize, randomizes the rows in a query object so that they are not ordered by anything…

Right now, DRK 5 is only available for download by subscribers because the CDs aren’t ready yet, but they will be shortly. I’ll post here when I find out more.

A CFMX for J2EE Startup Script

The other day, I was trying to debug some Java code that I was running with ColdFusion by using System.out.println() and System.err.println(). The first writes to standard out, and the second to standard error, which, in Java, are accessible as two static PrintStreams contained within the System object. Typically, writing to either of these streams will result in output to your console or to a log file. I’m not sure where the output was actually going when I started JRun with the default “jrun” executable, but it wasn’t immediately obvious and I wasn’t able to find it. To fix the issue, I wrote a script to start JRun instead, which redirects the standard out and standard error streams to specific log files. The script is only a few lines, and looks like this:

#!/bin/bash
LOGDIR="/home/cantrell/Unix/JRun4/logs"
./jrun -start default 1>$LOGDIR/default-out.log 2>$LOGDIR/default-err.log

I saved the file in JRun’s bin directory, made it executable (chmod 755), and now when I use it to start JRun rather than the “jrun” executable, standard out and standard error are redirected to their respective log files. As you may have already guessed, the “1″ in the command above indicates standard out, and the “2″ indicates standard error. The greater-than symbols simply indicate redirection. This script will work on any Unix system (including OS X), but will not work on Windows.