Entries Tagged as 'Best Practices'

Design Patterns

Best Practices , ColdFusion , Design Patterns , Frameworks No Comments »

I have been looking into "Design Patterns", as they are related to what we're actually doing or trying to implement as part of our new development process (Composite View, Front Controller, Singleton, MVC etc.), and also the ColdSpring Framework recently.

Sean Corfield has just published the following presentation which pretty much details understanding Design Patterns, and their use, in CF.

It's well worth the read as it also details patterns for CF ORM Frameworks like Reactor and Transfer!

Design Patterns in Coldfusion

Has anyone had much exposure to design patterns with ColdFusion? Thoughts?

Bookmark and Share

CFFILE upload gotcha with IE and JPG files

Best Practices , ColdFusion 1 Comment »

This is one of those blogs that will probably save an hour or two, when you're trying to figure out what the hell is going on with a users file when they are trying to upload in just IE.

And no, it didn't happen to me, but it's something I came across and thought it would be worth adding to the blog.
Basically, IE sets the content type of a JPG file to "image.pjpeg" when uploading a JPG file.

So you must ensure that your upload accepts this MIME type along with "image/jpg" and "image/jpeg".

The full accept string for JPGs should be:

NB: This doesn't happen in FireFox.

Credit: Rips Domain - CFFILE upload gotcha with IE and JPG

Bookmark and Share

Using Stored Procedures Within CF Applications

Best Practices , ColdFusion , SQL No Comments »

I found a very good article entitled "Harnessing the Power of SQL Server Using Stored Procedures".

It details how and why stored procedures should be used rather than embedded SQL in cfquery's.

Details can be found here: http://coldfusion.sys-con.com/read/45571.htm

Bookmark and Share

Comparing strings in coldfusion

Best Practices 1 Comment »

This point was taken from the Coldfusion coding guidelines written by Sean Corfield.

Unless you are absolutely CERTAIN that the strings you are comparing will never contain leading zeros, you should ALWAYS do string comparisons using Compare() and / or CompareNoCase().

Not because it's faster than using IS but because it is the only way to truly compare such strings as strings.

If you use IS (or EQ) to compare "001" and "0001" you'll be told that the "strings" are the same. I say "strings" because CF is obviously not comparing strings (else you wouldn't be told those two different strings are the same) --it is obviously comparing numbers. But Compare() and CompareNoCase() always compare actual strings more accurately.

I have also found this interesting link / article on this subject which delves even further into string comparison using CF.

Bookmark and Share
Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds