Gyrus asked:
> Every instance of code documentation [..] I've seen has 'filename'
included.
> Any reason? Surely it's spurious [..]

Is it?

I put the filename and virtual path of the file at the top of every CFM
file I write (or edit).  [Ex: /Admin/People.cfm]  Why?  Because my job
is mainly writing intranets, extranets, and web site for clients.  The
vast majority of the code is pretty much the same old thing:
add/edit/delete information from tables, or get info out of tables to
display.  With a good common methodology and structure, any one of my
coworkers can open a file and quickly find the portion that they are
looking for.  It's all too easy to write CF spaghetti code that is nigh
impossible to understand.  A common structure is the only thing that
saves you from insanity.

The down side to this is that many of the files look the same at first
glance.  That is, they all have pretty much the same structure: local
variables being initialized at the top, logic to check those variables
after that, logic to act on those variables after that, and finally a
big switch statement at the end to display the appropriate content.  If
you even have a common variable naming convention (good for you!) then
that's another bit of abstraction that makes one page even more
indistinguishable from the next.

This is made even trickier by picky clients.  Client A wants Column B
from Table C included in their results, but Client D wants Column E from
Table F.  This changes query and display logic, and even occasionally
business logic.  But, the code is still just similar enough such that
only a few lines will be different here or there.  If I'm working on
several of these files at the same time, Ctrl-Tab-ing back and forth
between then, opening and closing other files, and I don't have a
filename at the top ... well, it gets very easy to forget which is
which.  Especially after The Boss comes in and distracts me for 5
minutes with his idea of what the Next Big Thing is.  It's easy enough
to Ctrl-Home to the top of the document to make sure that I come back to
the same document I think I've come back to.

So that's why I put the filename (and path) at the top of every
document.

-R

P.S. - A non-programming coworker brought up an excellent point about CF
Studio the other day: Wouldn't it be nice if each file had an associated
context for the file/directory tree?  That is, when you switched between
open files the file and directory browsers would atomagically switch
back to the last place they had been *for that file*.  It's so simple
it's positively brilliant, and yet I've never heard another programmer
say it.  From the mouths of babes ...

--R


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to