On Sat, 08 Mar 2008 19:31:47 +0000, Grant Edwards wrote:
I'm also a bit baffled by people who put a comment at the top of
every file that tells you what the filename is.
[snip rant]
You've never printed out a source file on pieces of dead tree to read
on the train on the way home, or in bed or the bath?
Yes, some editors will print a header or footer showing the file name,
but not all will, or are configured to do so.
The only times I can recall printing source were in college classes
where I was required to hand in a hardcopy with the assignment and code
samples for job interviews. In the real world the code base tends to be
too huge to contemplate printing...
You've never (say) printed out the source code to one of the modules in
the Python standard library to read and study?
Nope. It's a lot easier to read on the computer, with searching,
proper syntax highlighting, tags, etc and access to all the other
information I might want while reading the code, and the ability to
drift to other modules that might be imported/mentioned, find examples
using them, etc.
If your code base is so huge that you can't print out any meaningful
piece, then you desperately need more encapsulation.
Yeah, most of the code is encapsulated into smaller parts. The
problem is figuring out what meaningful piece(s) I might want. How
often do you really find yourself knowing ahead of time exactly what
you want to read? Even in code reviews it's common to look at other
files in the system, version control history, the issue/spec tracker,
or even wander off into Python documentation, algorithm papers, or
whatever. It just doesn't seem worth playing a guessing game about
exactly what code/versioning/docs/etc I might want to have on hand
when the net result even if I guess right will be a worse reading
experience without searching, tags, bookmarks, etc.
Sure, but really, adding ONE LINE to the start of a file is hardly
"cluttering up" anything.
It's not terrible, no, just vaguely pointless and a bit fragile in the
face of change.