Building, Extending and Calling ColdFusion Components

Posted: May 12th, 2009 | Author: | Filed under: ColdFusion, O-O | 5 Comments »

If you don’t know what a ColdFusion component is you may want to review this before continuing.

Every system that I’ve developed over the last few years has included a Utility component. This component is where I store helper functions. The example below contains a single function that takes one argument, dumps it out on the screen then calls CFABORT.

Read the rest of this entry »


Writing and Calling Stored Procedures

Posted: May 12th, 2009 | Author: | Filed under: ColdFusion, SQL | 1 Comment »

In my previous post we built a Cheesy Database using simple SQL Scripts. Now I want to build on that by coding a stored procedure. Stored procedures are a ColdFusion developer’s best friend. You can use stored procedures to store some/most/all of your SQL logic. This is a great way to organize your code (stored procedures are generally faster than inline queries), optimize your application’s performance and help to protect your system from SQL Injection.

Writing a basic Stored Procedure is not a difficult task. First lets take a look at our inline query…

Read the rest of this entry »


Code Formatting

Posted: May 8th, 2009 | Author: | Filed under: ColdFusion, WordPress | No Comments »

I’m checking out WP-Syntax, a WordPress plugin that makes short work of sharing code samples…

1
2
3
4
5
6
7
8
9
10
11
<cfscript>
   variables.cheeses = StructNew();
   variables.cheeses.Gouda = CreateObject("component", "Cheese").init(
      datasource="cheesyDB",
      name="Gouda"
      );
</cfscript>
 
<cfoutput>
   #variables.cheeses.Gouda.getDescription()#
</cfoutput>

If anyone has any tips for modding WP-Syntax or an alternative solution feel free to drop me a comment.


Shell

Posted: May 8th, 2009 | Author: | Filed under: ColdFusion, MVC, O-O | No Comments »

My first pet project is “Shell”, a simple O-O ColdFusion Sample Application. I’ve spent about 90 minutes on it at this point (translation: it’s not done), so consider it more of a “sketch” at this point.

Shell – Version 0.0.0.1b (pardon the hokey over-use of the shell metaphor in the code).