Source Code as a Honey Do List

I’ll confess, when I’m writing new code I copy and paste like a bandit.  Make files, ant build scripts, JUnit tests, Boost unit tests, C++ for-loops with iterators… I can read the stuff, I can fix it, but I’m not so good at generating it ex nihilo.

I suspect a lot of coders are in the same boat.  Which may be the reason that so many of them would rather comment out changed or tentative code instead of just deleting it.  Or, much, much worse, many coders will leave partially implemented code in place as a reminder of how they might approach an as-yet unimplemented feature.

This is evil, or at least a nasty anti-pattern.  The major problem is that, to an uncoached reader, it may not be immediately obvious to that the code is not real.  And even after that is understood, there is still the problem of clutter, which always makes code harder to understand.

Finally, source code is a really bad place to saved your “to-do” list.  When are you going to look there, other than when you are tracking down a bug or adding a new feature? Why would you think that radar-scan.c++ is where you are saving design notes? That rare time you have time to breathe, does the thought cross your mind “I ought to look at all our source code to see if there are any loose ends to clean up”?

If you commit a line of code, it should be real, not a feeble wish.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s