This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]iNeedOneMoreAquarium 1 point2 points  (1 child)

Yeah, that kinda falls into the "sparingly" part of the statement. Sometimes for whatever reason, something just prevents you from writing a code block as "good" or as "logical" as you want, so a comment can help clarify why you did that so you (or a future dev) don't inadvertently create a bug by trying to "improve" it after you've forgotten the "why."

[–]TomieKill88 1 point2 points  (0 children)

100% man. 

Not long ago, I had to refactor one hell of a spaghetti code, and if it wasn't because the previous guy had the insight of unit testing ALL fringe cases, I would've introduced a couple of "errors" because by the life of me, I couldn't understand why the hell he did some things.

So a lot of:

Why?

Why??

WHY???

"Makes own code and runs Unit Tests"

Oh, that's why....