One of the challenges we face as developers is maintaining code written by other people. Yes, the ever present "they" who just cannot seem to live up to your own expectations and standards of how code should be written. I'm always struck by how hard it is to read other people's code, even if it well commented, contains properly scoped variables, and is written in a language I know.

So, what makes it so difficult to read code written by another developer? Setting aside the sense of familiarity and ownership I have with my own code, I believe my biggest mental hurdle concerns how the other developer structured their code - their use of white space, their choice of tags, and, most importantly, how they named their variables, functions, and even their files.

Every developer has a coding accent. I've noticed that a developer's first language often influences their coding in other languages. Now I'm not talking spoken language, though that does play a role, but programming languages.

For instance, take a programmer who first worked in Visual Basic or ASP using VBScript. VB, and Visual Studio in particular, promotes a style that becomes habit. Initial capitals abound in variable names:

view plain print about
1Public Function MyRoutine
2    Dim StartTime As Date
3    Dim EndTime As Date
4    Dim TotalTime As Long
6    StartTime = Now
8    Do
9    ' Do stuff
10    Loop
12    EndTime = Now
14    TotalTime = DateDiff("s", StartTime, EndTime)
16    MyRoutine = TotalTime
17End Sub

Developers with a background in a language that uses C-style syntax inherit the style adopted by that community. For example, Java developers like lower case and camel case.

view plain print about
1public static int myRoutine() {
2    private long startTime;
3    private long endTime;
4    private long totalTime;
6    startTime = System.currentTimeMillis();
8    for (...) {
9    /* Do stuff */
10    }
12    endTime = System.currentTimeMillis();
14    totalTime = (endTime - startTime) / 1000;
16    return totalTime;

So what about ColdFusion developers? Where do we fall in this mix? ColdFusion as a community does not have an established style. Generally new CF programmers transfer their existing coding accent to ColdFusion, so we end up seeing templates written with a Java accent, or a VB accent, or a C# accent, or even a COBOL accent (I've seen it!). How many times have you seen code that you feel you must reformat in order to read it? The reformatting nerve screams for attention when I see code that looks like:

view plain print about
1<cfset str_FirstName = "John">
2<cfset str_LastName = "Deer">
3<cfset str_Name = "#str_FirstName# #str_LastName#">
4<cfloop from="1" to="5" index="i">
5    <cfoutput>#i#. #str_Name#</cfoutput><br>

Why? Because I do not like pseudo-Hungarian notation, the str prefix, and everything is crammed together. The code cries out for breathing room!

view plain print about
1<cfset firstName = "John">
2<cfset lastName = "Deere">
4<cfloop from="1" to="5" index="counter">
5    <cfoutput>#counter#. #firstName# #lastName#<br /></cfoutput>

The very first language I learned was BASIC, but it was so long ago it's syntactical quirks did not influence my ColdFusion writing. Instead, I am heavily influenced by Java, introduced in school, and HTML, learned on my own. I like to see code that waves due to its indentation style, and with plenty of white space. I like to see camel-cased variable names. To me, those are elements that increase the readability of the code.

At the end of the day, all developers have to make a decision: do I write for myself or do I write for others. Since the ColdFusion community does not have as defined a style as other languages, ColdFusion developers have to also decide: will my accent make this code more difficult to maintain in six months?