Поделиться через


Code Hurts

I use email a lot. I seem to be sending questions or replies to my co-workers constantly throughout the day, so you’d think I’d be very good at it. Yet even with all my years of experience communicating through this high-tech medium I still find it difficult to get an idea across without inadvertently sending the wrong message. You’ve seen it yourself, of course. Probably more so on online forums or chats where it’s easy to be misunderstood; people flaming each other over imagined slights, reading innuendos and insults into even the most innocuous comments. I used to chalk it up to problems with the medium itself, plain text. After all, it doesn’t convey the subtleties of how we normally express ourselves, it lacks gestures and inflections and so forth. Now I’m starting to see that answer as a bit too simplistic. Because I know it’s not true.

Words alone can be as expressive as any other form of communication. How else can you explain the works of great authors? Surely, you’ve been exposed to passages of prose that evoked deep emotion, or described so richly and accurately something that made you feel as if you’ve been there. Surely, you’ve read something that for you just rang true, where the author got it just right; it made perfect sense. All that understood through just words. Well chosen words can evoke a range of responses from the reader; sadness, glee even anger. Sure, most of us are not great authors, but our words do leave lasting impressions. This might explain why so much that is read is reacted to with hostility, because we aren’t great authors and don’t do a good job of it.

So if we are not great writers of words, why do we think we can be great writers of code? Programs are written in languages, as plain text. Why do they not suffer from the same malady as the rest of our daily writing? Elegant code often evokes a sense of rightness; it instills confidence in us that overall programs are correct. Inelegant code does just the opposite; it deflates us with confusion and despair. Yet it’s likely that these emotions are unintended side effects of the writing. The code needed to be elegant because it was the right/best solution; or was inelegant because the problem was mired in complexity or was accumulated over time.

It’s obvious that what we write and what we read have a real effect on us, as we are emotional beasts and are wired to respond. Code with unwieldy structure, unnecessary complexity or simply with poorly chosen names can have negative mental influences on the programmers that must read and interpret all the work that has come before. Yet this is exactly the kind of source code found in large projects that have either accumulated over time or been designed by committee. This is the real cost of maintainability of source code, the undue consequence of shepherding large bodies of antiquated text. It explains why morale suffers on legacy projects. Reading old code is just depressing.

It also explains why the open source movement is so popular with the self-deprecating crowd. Some people are just drawn to that stuff.

Or is that just insulting? I can never tell.

Comments

  • Anonymous
    May 08, 2007
    Most authors i know can't program.. Since programming means writing code, and writing code is writing words, they must be bad writer?

  • Anonymous
    May 08, 2007
    The comment has been removed

  • Anonymous
    May 12, 2007
    The comment has been removed

  • Anonymous
    May 13, 2007
    Welcome to the 27th Community Convergence. I use this column to keep you informed of events in the C#

  • Anonymous
    May 22, 2007
    When you started to see that answer as simplistic, then you thought you knew. Maybe. But, consider that you just thought you knew because you just started to see and just couldn't resist the urge to jump into your point which had just been rendered worthless. Everything which follows this asinine statement is unreadable. I see your point.

  • Anonymous
    June 01, 2007
    ROFL!!