Unless you’ve been coding under a rock since ColdFusion 4.5, you’ve likely noticed the massive momentum behind object-oriented design and development in the ColdFusion sphere over the last 2 to 3 years. I love the idea of designing apps using object-oriented techniques–so much so that I’m presenting a session titled “OOP: What is it and why do I care?” at NCDevCon next month. After a while of developing OO-style applications you can get really spoiled to that way of writing and organizing code.
As a consultant, I get the opportunity to work for a wide array of companies and an even wider array of projects–not all of which are designed and built using the latest and greatest OO principles. Sometimes you can fall into the trap of thinking how you’d do a certain thing in an object-oriented way when the application you’re working on is written in a (good or bad) procedural manner. As tempting as it might be to scrap the client’s procedural code and write a shiny new OO block of code, you have to step back and remember what the client is paying you to do and decide if that’s the best use of the client’s money.
Unless the client is specifically paying you to refactor an older application, sometimes it simply doesn’t make sense to change the way the client’s application works so drastically. Sometimes you just have to “forget” all the OO goodness that you’ve learned to love over the last couple of years and go back to the “old” way of doing things in order to best service your client. It may not be fun, exciting or cutting edge work, but there are still a great number of procedural applications out there that we might be called upon to work on.
Disclaimer: This post was written as a “note to self”, not as an indictment of anyone that I have worked with.
After separating from active duty with the US Air Force in early 1998, I took a job working at a telecommunications company located in Brentwood, TN as a desktop and server support IT guy. About 6 months after I started, the company advertised an open position for their first full-time web developer. I applied and, owing to their policy of trying to “hire from within” first, I was chosen to fill the position.
Read more…
For those of you that normally come here for technical information, this post is completely non-technical and I’ll understand if you decide to spend your valuable time somewhere else.
As the title of this post suggests, I made it through what some people refer to as the “black birthday” yesterday. According to some statistic I found online, white males in the USA have an average life expectancy of 77.1 years. Pessimists would say that means I’m slightly over half dead. Optimists would respond with something along the lines that I have nearly half of my life in front of me. I’m really in neither category as I prefer to focus on things that I can make an impact on today (or plan today for things that I’m going to have to deal with in the near future).
Read more…
I’m writing an application that uses ColdFusion’s ORM features heavily. Various fields in my database deal with Personally Identifiable Information (PII) and need to be encrypted to meet regulatory requirements. I’ve been mulling over the best way to deal with keeping the data encrypted while in the database but have it be readily usable when loaded into an entity. None of the scenarios that came to mind felt right or could be implemented without an extensive amount of “work-around” code and I just wasn’t willing to go down those paths.
I put the question out to the folks that follow me on Twitter and got a couple of responses, one of which was from Mark Mandel who suggested using annotations. Now, I’ve heard the word annotation mentioned, but had never had the time/opportunity to research what they were or how they were used. That was a few weeks ago and in the meantime, I’d gotten busy focusing on other things and just got around to thinking about the encryption thing again a few days ago. What I found out astonished me.
Read more…
For the last year or so, all of my ColdFusion development projects have been built using the Model-Glue MVC framework. Over time, you get to where you know the most commonly used methods that are used to interact with the framework by heart. Sometimes there are lesser-used methods that you have to go look up. All the time (for me at least) I’m trying to find a way to write code faster and with less errors.
ColdFusion Builder has done a very nice job of providing code insight for ColdFusion tags, functions and CFC methods. This is especially true if you have a server configured in the “Servers” panel and mapped to your CF Builder project as it then will provide code insight for your own CFCs that you create on the page. However, when using Model-Glue, the “event” object is created for you and is always there. Because it’s not explicitly created on the page, CF Builder can’t provide code insight when you need to interact with it. However, it only takes a couple of settings in your project to make CF Builder aware of the event object and start providing help for it.
Here’s the process:
- Right click on your project and choosing “Properties”.
- In the left pane of the window that comes up, click on “ColdFusion Variable Mappings”.
- On the right side, click the “New” button and enter the following values into the boxes
- Variable Name: event
- Mapped To: html.ModelGlue.gesture.eventrequest.EventContext
- Press the “New” button and enter the following values into the boxes
- Variable Name: arguments.event
- Mapped To: html.ModelGlue.gesture.eventrequest.EventContext
- Press the Apply button then the OK button
* Note that the value in the “Mapped To” box is the actual dot-notated path to the EventContext.cfc file from your CF Builder project root. I happen to have my webroot files in a folder named “html” under the project root (see screenshot #1 below).
Once you have those settings saved, any time you type “event.” or “arguments.event.” you’ll get the list of methods contained in the Event object. Of course, this doesn’t only work with Model-Glue. Any CFC that you regularly use the same name with can be configured this same way.
I’ve attached some screenshots for reference. If you have any questions or something isn’t working, feel free to ping me.