Archive for September, 2003

Validation – Client or Server-side?

I used to be pretty fanatical about implementing both client and server-side validation, however recently, I have stopped bothering with client side error messages almost entirely. The conventional wisdom is that client-side validation is necessary because it:

  1. Gives your users instant feedback.
  2. Saves CPU cycles.
  3. Lowers bandwidth use.

While all of these things are true, it is also true that:

  1. Client-side validation adds coding and QA time to the development process.
  2. Large amounts of JavaScript (which are often required for validation frameworks) also use bandwidth.
  3. Thanks to CSS-P, pages can be small enough that reloading them doesn’t have to take as long as loading
  4. You have to do server-side validation in addition to client-side validation anyway since client-side validation can always be bypassed.
  5. JavaScript alerts can be alloying and less intuitive than well positioned, verbose server-side error messages.

In my experience, the amount of additional CPU cycles and bandwidth required to process requests with data that does not validate is really quite negligible (if it weren’t, I would say your app is not as user-friendly and intuitive as it should be). Additionally, I would personally rather reload a page and get clear instructions on exactly which fields need attention rather than instantly get something less helpful. DHTML solutions (which I have not experimented with extensively) may be a good compromise, but I think you would need to come up with a very solid framework to make the additional development costs such that they are practical since data must still also be validated on the server.

What are your thoughts on validation?

Simplifying Component Inheritance

When you want one component to extend another, if the parent component is in the same package (directory) as the child component, you don’t have to specify a fully-qualified name. For instance, if both components were in the directory “/myApp/components/handlers” rather than doing this…

<cfcomponent name="myComponent" extends="myApp.components.somePackage.Parent">

…you can do this…

<cfcomponent name="myComponent" extends="Parent">

This is particularly useful when you want your component path to be dynamic or configurable since if you hard-code the entire path, and you want to move your components or your entire application to a different directly, all your component inheritance would be broken.

And Now For Something Completely Different: Macromedia Central

Macromedia recently launched the Macromedia Central SDK Beta program, so if you are curious about what Central is, go check it out. Central is a very innovative application model from the perspectives of both the end user and the application developer.

End users will like having one “central” place to run lots of data-aware applications, on or offline. A Central application can do almost anything, but the quintessential examples include things like stock, weather and movie-related apps. When I first heard about Central, I sat down and tried to come up with a list of all the cool applications that would fit inside a Central type framework, and easily came up with over a dozen in just a few minutes.

If you are a Mac user, you will understand what I mean when I say that Central is similar to Sherlock and Watson, however the applications themselves are only half the story. The other half is the development model. From Macromedia’s website:

“Macromedia Central will help Flash application developers sell and deploy their applications to the public. Central will provide an integrated online marketplace, including a try/buy framework and secure managed transactions.”

Multiple Threads in ColdFusion

I have gotten a lot of great feedback and suggestions from yesterday’s post about new ColdFusion features. One that really interests me is the idea of a CFFORK or a CFTHREAD tag. I agree that certain operations would benefit from the ability to happen concurrently (in fact, keep your eye out for DRK 5!), but I’m wondering what specifically people envision spawning new threads for. And what would the programming model be? When you spawn a new thread, execution obviously continues in the original thread, so how do you know when the new thread is finished, or get back the results of whatever operation it performed, or know if an error occurred. One way to do it is with callback functions, which may be something that can be built into components. I have an interesting idea of how this can be done (again, keep an eye out for DRK 5), but I want to get some other suggestions, as well.

What’s Your Dream ColdFusion Feature?

Let’s say the entire ColdFusion engineering team were at your disposal for the purposes of adding any single feature you wanted. What would it be? Don’t just think in terms of tags or functions, either. Think big. It can essentially be any change you want to the language or server. The person who comes up with the coolest, most interesting and innovative new feature request will win tons of respect from everyone who reads this weblog, guaranteed.

Mad Scientists at Google

If you haven’t done so already, check out As Google describes it, is Google’s “technology playground” and has some very cool functionality including Search by Location, News Alerts, Google Glossary, Voice Search (can anyone get this to work?), Keyboard Shortcuts and a few others. It’s great to see a company play around with technology like this for no other reason than to have some fun and learn.

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:

./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.

OT – It’s Hard to Blog Without Power

I missed a day of blogging yesterday, primarily because of hurricane Isabel. Being just south of Washington DC, we were directly in the storm’s path, and although it was downgraded to a tropical storm while it was moving through Northern Virginia, it was still by far the worst storm I have ever seen. We lost power for about 11 hours, lost some trees, and won’t be able to drink tap water without boiling it for at least another week since all four water conditioning plants that serve the area lost power at the same time, allowing untreated water to make its way into the system. Fortunately our house was not damaged although a neighbor’s tree was uprooted and fell onto our property, and a huge shutter was blown off her house. Anyway, power is back and we have plenty of bottled water, so all is back to normal. My satellite dish is safe, and as far as I can tell, my TiVo didn’t miss anything it was scheduled to record. I consider myself extremely lucky since I have friends in the Annapolis area (where I used to live) who will likely be without power for another week. It’s strange to see pictures of people canoeing over areas where I used to walk my dog. Reviews ColdFusion MX 6.1 has an extremely positive review of ColdFusion MX 6.1 entitled “Take another leap forward with ColdFusion MX 6.1”. The article discusses installation, J2EE deployment, expanded OS support, performance, CFCs, CFMAIL, CFHTTP, and even mentions the Mach-II framework. If you are already using CFMX 6.1 and you are aware of the differences between it and CFMX, you may not get much out of the article, however if you haven’t upgraded yet, or still aren’t sure of everything CFMX 6.1 can do, you might find it useful.

Choosing Macromedia Technologies over .NET and Java

There’s an interesting article on INTERNETWEEK about a company called Mitem Corporation which has decided to go with Macromedia technologies over .NET or Java for an application they are building for the healthcare industry. The application is called Blue Iris, and it will allow doctors to use computers to do a lot of things they currently use stacks and stacks of paper for now, like documenting medical histories, recording test results, and prescribing medication.

According to the article, what Mitem finds particularly attractive about using Flash to implement the Blue Iris user interface is that they are able to easily recreate some of the paper-based processes that doctors are accustomed to. Apparently doctors are generally not overly excited about getting acquainted with new technologies, so the key to getting them to accept a new system is to keep the learning curve as gentle as possible.

Continue reading…