My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
Timothy Farrar brought up an issue about scriptaGulous that I thought was a good one (and one I've worried a bit about).

Should people start using the scriptaGulous library and Adobe decides to start naming functions after tags (i.e., cfQuery()), then a lot of code will break unless they start honoring your functions over theirs instead of throwing errors, as is currently the case.

He suggested using an underscore convention (_cfQuery(), and Andrew Powell proposed a tagFunctionName() style convention.

But what are the odds Adobe would start naming functions cfTagName()? Any idea from the guys over there would be appreciated, as well as anyone else with any input. Would tagFunctionName() as opposed to cfFunctionName() (or tagQuery() over cfQuery()) work better? I'm partial to the underscore method if it is needed, but obviously I prefer just simple tagName() the most.

What are your thoughts?

Hey! Why don't you make your life easier and subscribe to the full post or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!

Leave a comment

Don't do it... the odds are slim to none (but what do I know?)!

Posted by Aaron Roberson on Jun 07, 2007 at 02:57 PM UTC - 5 hrs

I doubt we would start creating functions with that sort of naming convention (it's not how they have done it in the past).

Think about <cfobject>, the cfscript equivalent is createObject() not cfObject().... not to be confused with the annual enterprise coldfusion conference. :)

There aren't too many instance where the CF team has created a function that has a tag equivalent. It's usually just one or the other. I can say, if we did come out with a <cfquery> function, I think it should be query() not cfquery().

Posted by Adrock on Jun 07, 2007 at 04:28 PM UTC - 5 hrs

Thanks for that. I didn't think there was a huge possibility, but I guess I just needed some validation.

tagName() it stays then.

Posted by Sam on Jun 08, 2007 at 10:05 AM UTC - 5 hrs


I'm just going to toss this in with Adam's comment (though it seems uneccesary, I'm addicted to making comments on blogs)...

If you look at functions implemented in CF 8, like fileRead(), as opposed cffile action="read" or imageResize() vs cfimage action="resize", it's pretty apparent that the functions are named appropriately by the action they take and the tags are named based on the kind of doodad you're working with (like cfimage, cffile, cfxml, etc.) with attributes that "explain" the action you're wanting to take.

So I think you're very, very safe using the name of the tag for your functions. No guarantees, obviously, but I think I'd even go so far as to say you're "very safe" going with the names of the tags instead of some arbitrary syntax.

Also, I recommend the tagCfTag() over the _cftag() syntax. It's much more semantically accurate and, frankly, it's easier to get in the habit of typing tag than it is hitting shift-dash to insert the _ character into the code.


Posted by Jared Rypka-Hauer on Jun 11, 2007 at 10:40 AM UTC - 5 hrs

Thanks for the support and suggestions Jared. That's what I was getting at when I mentioned "changing the function naming convention."

I agree, so I'll keep it as (e.g.) cfQuery() as opposed to tagcfQuery(), or tagQuery(), or _cfquery(), or _query(), or any variant I can think of =).

I also agree with using some other prefix like "tag" than "_" (if we had decided on using a prefix other than "cf").

I like the underscore because I use it in Java quite often as a prefix to private member variables (and use it in Ruby as well, but not as a prefix), so I'm used to it and it doesn't add much clutter. But on the other hand, I know that it would just be an annoyance to most CF developers, as it's not commonly used outside of the CGI scope/struct.

In any case, I like the suggestions and reassurances to just keep it looking like cfHttp(), since as I see, that is the best of all possible worlds.

Posted by Sam on Jun 11, 2007 at 12:48 PM UTC - 5 hrs

Good post and something worth thinking about. I've come unstuck in the pass as I use a bunch of form UDFs named Text(), Password(), Textarea() etc. Of course this causes a clash when I have variables of the same name, password for example.

Also worth mentioning, sometimes UDFs on or ones we create privately follow CF's naming convention. E.g. ListDoSomething(), ListDoSomethingElse(). There is more of a chance that Adobe will introduce new functions that clash with peoples' own UDFs if you use this naming convention.

Worth thinking about.

Posted by Adrian Lynch on Dec 25, 2007 at 01:07 PM UTC - 5 hrs

Leave a comment

Leave this field empty
Your Name
Email (not displayed, more info?)


Subcribe to this comment thread
Remember my details

Picture of me

.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and Cplusplus (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (76)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (8)
Windows (1)
With (1)
YAGNI (10)

Agile Manifesto & Principles
Principles Of OOD
Ruby on Rails

RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner