Like you, I live in the borderlands, hunted by both comment style purists and descriptive code zealots.
There are code comments that cannot be explained by variable or method names, like the reason why something was done (or changed).
Compare these two versions and tell me which you find more useful:
// X and Y should not be enhanced (PBI 12345) if (/^(X|Y)/.test(item)) { return; }
and (where the PBI for this should be searched in source control history)
if (shouldNotBeEnhanced(item)) { return; } ... function shouldNotBeEnhanced(item) { return isItemAnXOrAnY(item)); } function isItemAndXOrAnY(item) { return /^(X|Y)/.test(item); }
Perhaps this example (simplification of code I wrote today) is just proof of my laziness, but I prefer version 1 both as a writer and as a reader.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Like you, I live in the borderlands, hunted by both comment style purists and descriptive code zealots.
There are code comments that cannot be explained by variable or method names, like the reason why something was done (or changed).
Compare these two versions and tell me which you find more useful:
and (where the PBI for this should be searched in source control history)
Perhaps this example (simplification of code I wrote today) is just proof of my laziness, but I prefer version 1 both as a writer and as a reader.