HOME | FERGUSON Digital Blog

CamelCase

ColdFusion Add comments

I like standardization, in naming conventions, file organization, and especially in variable and record set usage.ᅠ My prefefred method of programming is to use "CamelCase" which is just typing compound words with the first letter of each word capitalized.ᅠ What I find in ColdFusion is slightly lazy.ᅠ For example "isDefined" should be "IsDefined" to be camel case.ᅠ The built-in functions in ColdFusion skip capitalizing the first letter in the compound word.

I don't like wasting time when a customer needs immediate results, with trying to scan through several hundred lines of code and discern the difference between thiscompoundword, thisCompoundWord, ThisCompoundWord, and this_compound_word while intermingled with other functions and variables that don't adhere to a standard.

These variations do not affect the ability of ColdFusion, they merely reflect the broken thought processes behind the author who types the mish-mash.ᅠ The first three in the example above will work exactly the same in ColdFusion.ᅠ When I teach ColdFusion to new programmers, I stress the importance of case sensitivity in file names.ᅠ The file "index.cfm" and "Index.cfm" are the same files in Microsoft, but are two different files in Linux.ᅠ The lesson continues with not stopping with the naming convention of the files, other than if you are going to capitalize the first letter of the file name then do the same for every file in the project.

Then there is the underscore.ᅠ Actually, I hate the underscore in programming.ᅠ First, it's an extra character in the compound word, which is clutter, which is contradictory to efficiency.ᅠ Second, I can't double-click on it with the mouse while editing with SQL Server Management Studio and select the entire entry!ᅠ To prevent accidently typing the right word incorrectly, there is a lot of double-clicking, copying, and pasting during the creation process for me.ᅠ The underscore causes each word of a compound name to be treated as an individual element in word processors and SQL Studio.ᅠ Dreamweaver (my IDE of choice) doesn't seem to care.

To prevent having to divide their attention between the two processes (CamelCase with Dreamweaver and under_score with SQL Studio), my students are encouraged to stay within one standard that fits into all aspects of ColdFusion programming.ᅠ This practice doesn't just stop with CFM and SQL, but extends to include JS and CSS as well.ᅠ Camel Case works perfectly throughout the project as a clean, efficient standard.

If you find this post useful please leave a comment and let me know how you used the information.

2 responses to “CamelCase”

  1. XP1 on You are talking about UpperCamelCase or PascalCase, to be specific.
  2. Michael Ferguson on Absolutely. Thanks.

Leave a Reply



© Copyright 1997-2024, All Rights Reserved Coldfusion and MS SQL2008
Powered by Mango Blog.   Design by FERGUSON Digital
o:Event name="beforeHtmlBodyEnd" />