From Scopes to Structures
As I think about my transition to Object Oriented Programming, I have to reflect on my 'ah-hah' moments when things started to make sense. I thought this next post was going to be about my first experiences with CFCs, but in analyzing what drove me to them I realized that my understanding of structures was an important step in the transition to OO thinking.
I was introduced to structures while consulting for a large corporation in one of their small Competitive Intelligence (CI) divisions. (CI = Think business domain specific library services) At one point in my time with them, we hosted their site on their internal shared ColdFusion host. To host a CF site with them, our site's code had to comply with their best practice guidelines. The one rule that has stuck with me all these years is: Avoid CFQUERY within a loop (CFLOOP or CFOUTPUT with the query attribute)
Note: This is the actual rule from that time period. Notice the capital tag names. I still have old sites with all their tags capitalized. (shutter) That's why I still have HomeSite installed, to use the tag case conversion tool. I'm just saying.
Prior to learning these techniques, I had only used simple variables and had never used structures or arrays. I had also used the session and application scopes extensively. My big 'ah-hah' moment came when I realized that scopes are just persistent structures. The concept of structures is a big stepping point in understanding the caching capabilities in ColdFusion and in CFCs.