Using a Session Facade in Mach-II

{ Posted By : Eric Cobb on August 24, 2009 }
2623 Views
Related Categories: Mach-II, CFML

Last week I added an entry to the Mach-II wiki on using a Session Facade. This was my first time writing anything for the wiki, and I have to say that I really enjoyed working on it. Do you ever have those "Ah-ha!" moments when you're trying to figure something out and suddenly everything just clicks? Well, that happened to me 3 or 4 times while putting that wiki entry together.

When Peter first suggested that I consider writing the entry, I knew absolutely nothing about session facades and next to nothing about Mach-II. Like many people just getting started with Mach-II, I had a lot of questions. The more involved I got, the more questions I had. Especially when it came to working with session variables. I knew that I didn't want to reference the Session scope inside of my CFCs. I try to never reference any of CF's shared scopes (Session, Application, Client, Cookie, ect...) in a CFC unless it's is absolutely necessary. But Mach-II didn't seem to have any built in mechanism for handling sessions. Since working with sessions is a pretty common thing in CF, and keeping encapsulation is pretty common in the OO world, I knew that there had to be some way to do this. I just had to find it. Between scouring over the blogosphere for examples, researching the Mach-II Google Group, and pestering Peter, I finally started figuring things out. And as I figured it out, I began to see just how dead simple it was!

I realized that as I struggled through trying to figure out session facades, other beginners were probably struggling with it as well. So, I told Peter I would write the wiki entry. I felt like I could help others who may be having the same questions I had. I tried to make it as simple as possible, explaining the concept while also showing how to wire up and use a session facade in Mach-II. I feel like it's a good beginner reference, and I'm already planning on adding a second entry on using a session facade with ColdSpring in Mach-II (once I learn how to do it!).

Now, just to be clear, by no means do I consider myself an authority on Mach-II, session facades, or anything else for that matter. I realize that there are varying opinions on the subject of session facades, as well other (possibly better) ways to accomplish the same thing. If anything, my wiki entry should be considered a guide for beginners, written by a beginner. My hopes are that I've written it in a way that can give other beginners one of those "Ah-ha!" moments that we programmers do so enjoy. They can then expand on their newfound knowledge to make better applications, and possibly take over the world.

By the way, if by some chance you do read my wiki entry and find a way to use it to take over the world, all I ask in return is a small island somewhere in the South Pacific.

Comments
Brian FitzGerald's Gravatar I just read the article (really nicely done) and wanted to say thanks for jumping in to help out on the wiki. The more people we have that are comfortable contributing to it the better our documentation will be. And like you said, I find that it really helps your understanding when you force yourself to formalize your thoughts into coherent sentences :)

Cheers,
Brian

ps I just so happen to be in the process of taking over the world with a Mach-II app, so start doing some research on your island of choice
# Posted By Brian FitzGerald | 8/24/09 9:11 AM
Eric Cobb's Gravatar Thanks Brian. I hope to be able to help out with more entries in the future. It has definitely helped me understand Mach-II better.

Sweet! I'll take Bora Bora! :-)
# Posted By Eric Cobb | 8/24/09 9:30 AM
James, F.E.'s Gravatar Thanks for putting the Session Facade entry together. It makes a lot more sense to me now.
# Posted By James, F.E. | 8/24/09 11:03 AM