-
Notifications
You must be signed in to change notification settings - Fork 0
Coding Style
Randy Merrill edited this page Aug 13, 2010
·
2 revisions
- Comment frequently and well.
- Computers minimize, not people.
- Be valid.
- Be DRY.
- Concise names.
- Descriptive names.
- camelCased names.
- ex: someMultiWordComponent
- ex: functionName
- Fully scoped.
When scripting the opening braces ({) starts on the same line as the closing
parenthesis ()). Closing braces (}) should end on their own line and hold
the same indentation as the beginning.
Examples:
if( condition ) {
// Code inside
} else {
// More code inside
}
switch( variable ) {
case 1:
// Code inside
break;
case 2:
// Code inside
case 3:
// Code inside
}
All tags should be properly closed. Any tags on the same level should be separated by a blank line unless they are part of a group.
<cfset isThisCorrect = true />
<cfset isThisAlsoCorrect = true />
<cfset isThisGroupedCorrectly = true />
<cfif not isThisCorrect>
<!--- Do something here --->
<cfif isThisAlsoCorrect and not isThisGroupedCorrectly>
<!--- Do something else here --->
</cfif>
</cfif>