As part of the ColdFusion User Group of Central NY CF Object Oriented Programming (OOP) series, I presented design patterns in ColdFusion. The objective of the presentation is to inform people about the basic design pattern principles that guide good OOP Programming:
- Encapsulate what varies.
- Program to the interface, not the implementation.
- Favor composition over inheritance.
- Strive for loosely coupled designs between objects that interact.
We also learned about the Open-Closed Principle; and how following these guidelines can make for better code that is more adaptable to change.
The examples used are politely borrowed from Head First Design Patterns. I had intended to create my own examples, but ran out of time and figured that their examples are great for showing the concepts.
To begin with, we talked about how we can use the Strategy Pattern to encapsulate the “HAS-A” behaviors via composition. Following that, the Decorator Pattern was shown to highlight the Open-Closed Principle and how we can program to an interface (or super-class) instead of the implementation (or concrete class). Lastly, we touched on the factory “pattern” (or programming idiom, you decide) and how we can further encapsulate our dependencies into a Simple Factory.
The next part in our CF OOP series is Inversion of Control, or in other words, using ColdSpring.
Here are the links to the slides and resources used in the presentation:

No Comments, Comment or Ping
Reply to “Introduction to Design Patterns in ColdFusion”