Ask Slashdot: When Do You Include ‘Unnecessary’ Code?

“For more than 20 years I’ve been putting semicolons at the end of programming statements in SAS, C/C++, and Java/Javascript,” writes Rick Wicklin, a researcher in computational statistics at SAS. “But lately I’ve been working in a computer language that does not require semicolons. Nevertheless… I catch myself typing unnecessary semicolons out of habit,” he writes, while at other times “I include optional statements in my programs for clarity, readability, or to practice defensive programming.” While Wicklin’s post is geared towards SAS programming, Slashdot reader theodp writes that the question is a language-agnostic one:
…when to include technically-unnecessary code — e.g., variable declarations, superfluous punctuation, block constructs for single statements, values for optional parameters that are the defaults, debugging/validation statements, non-critical error handling, explicitly destroying objects that would otherwise be deleted on exit, labeled NEXT statements, full qualification of objects/methods, unneeded code from templates…
He’s wondering if other Slashdot readers have trouble tolerating their co-workers’ unnecessary codes choices (which he demonstrates with a video clip from Silicon Valley).
So leave your answers in the comments. When do you do include ‘unnecessary’ code in your programs — and why?


Share on Google+

Read more of this story at Slashdot.

Clip to Evernote

Leave a Reply

Your email address will not be published. Required fields are marked *