In my applications, I create an Attributes object (REQUEST.Attributes), which is a unbinding of the URL and the FORM scope. I was first introduced to this idea in FuseBox and I really like how it can simplify a good amount of code.
I was going over the code I use to create this last week. I thought my code was very simple, and yet some how, my boss, Jim Curran, was able to make a suggestion to simplify it even further. StructAppend(). Admittedly, I had to look it up because I wasn't exactly sure what it did - I am not sure I have ever used it.
Well, it does exactly what I wanted it to do. Of course, the code was very simple before, but now, it is even more so. I was able to take this:
Launch code in new window » Download code as text file »
and make it this:
Launch code in new window » Download code as text file »
As you can see, the difference is small, but we have removed a coded Loop and let ColdFusion handle the process with a built-in, hopefully more efficient method. All to say, sometimes, I try to come up with a solution that ends up being more complicated than a solution that is built into ColdFusion. This only goes to emphasize the point that people really need to understand the basics of the language.
Download Code Snippet ZIP File
Comments (0) | Post Comment | Ask Ben | Permalink | Print Page
There are no comments posted for this web log entry.