News for hackers. Stuff that matters.
Re:My takeaways from "Clean Code" by mion on Tuesday May 28, 2013 @08:14PM (#5783747)
And also this:

- Comments are fails

Sometimes you rewrite code for performance, making it fast but awful to understand. Comments are very useful in this case.

Re:My takeaways from "Clean Code" by bguthrie on Tuesday May 28, 2013 @08:21PM (#5783779)
Unless your performance optimizations specifically avoid method invocation, you can always extract the nasty bits to a well-named method. This is what is meant by comment avoidance: it is better to isolate the dirty stuff and pick good, specific names for what they do than to write an explanatory comment wherever possible.
Re:My takeaways from "Clean Code" by mion on Tuesday May 28, 2013 @08:45PM (#5783881)
Hmm, true. But a lot of performance optimizations (and the example I had in mind) avoid method invocation. Inside a critical loop, for instance, stacking function calls can make a big difference on a dynamic language. Macros could solve this problem though.
Re:My takeaways from "Clean Code" by mercurial on Wednesday May 29, 2013 @02:06AM (#5784869)
It's good practice to comment when necessary. Sometimes, even a "well named" method will not be expressive enough. Other times, you need to do something non-obvious (eg, work around a bug in another system). Comment when necessary.

I've also found that comment tend to be both easier to maintain (due to the smaller amount of code) and more necessary (due to the higher density of information) when using more powerful languages (eg, Haskell).

Re:My takeaways from "Clean Code" by spc476 on Wednesday May 29, 2013 @12:48AM (#5784648)
I tend to comment working around bugs in third party code.
Re:My takeaways from "Clean Code" by joshka on Wednesday May 29, 2013 @09:19AM (#5786080)
Another way would be to instead wrap the third party code (and hence isolate yourself against such bugs) and use the language of choice to highlight the design decision.
Re:My takeaways from "Clean Code" by spc476 on Wednesday May 29, 2013 @08:18PM (#5790170)
But you still need to comment about why you wrapped the code in the first place.