Should Your Objects Validate Themselves?

It seems quite common in the ColdFusion community to see objects with a validate() function. This is used to handle when your object contains potentially invalid data, such as invalid data supplied from a form.

This leads to a good question; should your objects be allowed to have an invalid state?

More ...

Using Constants in ColdFusion Components

In code we often need to make use of constant values. It is good practice to use named constants rather than literal values, but what is a good technique for managing constants in an object oriented ColdFusion application?

More ...

What is Abstraction?

You are a person, but clearly you are much more than that. You are good looking and very intelligent and you have a wide range of outstanding skills. You may be great at cooking, an outstanding pianist and perhaps one of the best parents in the world.

However, if I were to interview you for a ColdFusion developer role I would not be very interested in knowing that you make a mean red curry. Although you are a great many things to many people, I would primarily be interested in your skills as a developer. Do you write clean code? Have you used some of the community frameworks? How many years have you been working with ColdFusion? And so on.

In fact my focus would only be on a small part of what you are. I would be focusing on the essential characteristics in you that particularly suited my needs. I would ignore all of the wonderful things about you that are not directly relevant. I have abstracted you into something more generalised and less detailed. You become the abstraction "ColdFusion Developer."

More ...

Object Oriented Pagination in ColdFusion

There are various ways to perform pagination in ColdFusion, but I thought I would offer a few additional thoughts to the subject, including an object oriented approach to handling the results.

More ...

The Strategy Design Pattern in ColdFusion

Thoughts on the Strategy design pattern specific to ColdFusion and it's typeless nature.

What is the Strategy design pattern?

Suppose you have an object A which needs to use another object B.

[A] --- uses ---> [B]

Then a different situation requires that you need to exchange B for another object C; so object A is then making use of C.

[A] --- uses ---> [C]

The ability to exchange objects B and C without changing object A is the Strategy design pattern in action.

In order for this to be possible, objects B and C need to both implement the common set of functions that object A requires.

In this description, the object A is called our context. The objects B anc C are our strategy objects.

More ...