Photo from Chile

How I Use Transfer Today - Encapsulating Database Access

I've been meaning to follow up on my How I Use Transfer series, as I've made a few changes to the way I write my ColdFusion code since that series was written. One of the biggest changes was to encapsulate all database access in my Gateway components.

Now I say biggest not because it took a lot of time and effort to make the change, in fact the opposite is true. I say biggest simply because it represented a significant shift in the way I'm designing my model. Let me start with the rationale for making this change.

[More]

The First Post to ValidateThis!

I'm excited to say that the Google group that I set up as a discussion forum for my object oriented validation framework for ColdFusion has received its first post. And it was a doozy. Some really great ideas, and I, in my usual fashion, posted a response of an appropriate length ;-)

So I'd like to invite anyone interested in becoming part of the conversation, or interested in just listening in, to join the group. I'm not necessarily going to blog about everything that comes up in the group, and judging by this first post/response, there is bound to be some pretty interesting stuff going on.

For anyone who's interested but doesn't want to add yet another source of email to their inbox, I can confidently say that the volume of traffic will be negligible. And first post moderation is active, so spam should be pretty much non existent.

Click here to join the party.

Paul Marcotte on Transient Factories

Just a note to say that Paul Marcotte has written an interesting blog post describing a ColdFusion component which is an implementation of a Factory Pattern. This component can be used to centralize creation of transient objects in your model. He has included a description of the usage of the component that he wrote (with a tiny bit of input from me), as well as a download of that component. I am using this Transient Factory inside my own validation framework and have found it to be very useful.

I believe the component will also be available on RIAForge in the not too distant future.

I Don't Care What An ORM Is!

There have been some postings recently about the state of the ORM landscape in ColdFusion, and while I have found this conversation interesting, I have not found it particularly useful.

There exists a group of ColdFusion developers, myself included, who would like to improve the way that we write and structure our code. We have been encouraged to adopt a more object oriented approach to our development, and I, for one, have found it to be of great benefit.

One of the things that has made this transition easier for me is the existence of these "ORMs" for ColdFusion. I started off with Reactor, and now use Transfer, and I have found that not only do these "ORMs" do a lot of the more menial tasks for me, but they also encourage me to "think in objects". Sure, the objects that I'm working with are closely tied to the physical database structure, but they're still objects. I still get the benefit of encapsulation, and through the use of Transfer decorators I feel that I am able to give my objects meaningful behaviour, thereby creating rich business objects.

I know from experience that when a developer is starting down this path it can be quite daunting, and we often look to those with more experience than ourselves for guidance. I hope that someone in that boat would not be "turned off" the existing set of "ORMs" for ColdFusion because they are not considered to be true ORMs.

This brings me to the title of this post, which was inspired by a post by Peter Bell. I find Transfer to be an indispensable tool for building OO-like applications with ColdFusion, and can only encourage people to investigate and use it. It may not be a true ORM, but that doesn't make it any less useful. Let's not throw the baby out with the bath water.

Performing Server Side Validations Using Objects

I'm going to continue my series about object oriented validations with ColdFusion by looking at the approach that I've taken to performing server side validations. I discussed the architecture for server side validations in a previous article, so now I want to get down to the nitty gritty of how the actual validations are performed, looking at the code involved.

I'm going to do this in the context of discussing how I added generic regex support to the framework. I want to thank Matt Quackenbush, my regex mentor, for helping me with the required syntax, and with an example for the demo application.

Because one of the design goals I had for the framework was the ability to add new validation types without having to touch any of the existing code, adding regex support was a piece of cake. Here's how I wanted this new regex validation type to work:

  • A developer can create a validation rule for an object property of type regex.
  • The developer can then either:
    • Specify a single regex parameter, which will be used on both the client and the server.
    • Specify both a clientregex and a serverregex parameter, which will be used accordingly. This will allow a developer to take advantage of ColdFusion regex syntax that would not be valid in JavaScript.
  • When processing validations, either on the client or the server, the contents of the specified property will be tested against the specified regex, and if no match is found the validation will fail.

[More]

ValidateThis! - Object Oriented Validation Code Available at RIAForge

I have made the code for my object oriented validation framework for ColdFusion available on RIAForge.

The download includes a demo application and set-up instructions. One should be able to get the demo up and running on one's machine in fairly short order. The set-up instructions also include some fairly detailed documentation about integrating the framework with an existing model, which I won't repeat here. I may write some posts about it in the future, but for now, if you're interested, just download the code, take it for a spin, and take a peek under the hood. The code base itself is actually fairly straightforward.

You may recall, if you've read my previous posts on the subject, that this project started out as a proof-of-concept for an object oriented approach to validations. I'm pretty happy with the product that resulted from this exercise, but there is definitely room for improvement and enhancement. I'm very keen to hear from anyone that checks it out and attempts to use it, and I'm willing to help anyone who runs into difficulty getting the demo up and running, or has questions about integrating the framework into an existing model.

Feel free to email me directly or use the google group (groups.google.com/group/validatethis) that I set up to facilitate more of a "conversation".

ValidateThis! - Client Side Validation Architecture

In this installment of my series about object oriented validations with ColdFusion I'm going to finish the discussion of the architecture of the framework. In a previous article I discussed that because the framework is used to generate both client-side and server-side validations, there are three categories of objects:

  • Core Objects, which are used for both client-side and server-side validations.
  • Server Objects, which are used only when performing server-side validations.
  • Client Objects, which are used only when generating client-side validation code.

That article described the Core Objects and the Server Objects, so that just leaves the Client Objects.

[More]

More Entries