News for hackers. Stuff that matters.
Re:Does anyone use comments any more? by dagw on Friday July 06, 2012 @05:09AM (#4206973)
Some stuff, especially stuff connected to performance or memory usage, is very tricky to write tests for. Doubly so if it is only a problem on certain hardware.
Re:Does anyone use comments any more? by kenbot on Friday July 06, 2012 @05:18AM (#4206999)
That's certainly true. I'd argue though, that most code is in a position where good naming and tests provide sufficient clarity, without requiring free-text comments.
Re:Does anyone use comments any more? by dagw on Friday July 06, 2012 @05:35AM (#4207037)
Tests can only tell you what some piece code is supposed to do, not why its doing it the way its doing. Why do you choose to define this particular constant to this particular value, why are you using that particular data structure, why are you rolling your own version of a certain function rather than using the one supplied in the library you are using, why are you using that seemingly round about way to get to that particular result?

There are lots and lots of ways to write a function that passes a test, I want to know if there is a reason why you chose the approach you used.