News for hackers. Stuff that matters.
Re:Signs your code sucks by buugs on Friday October 23, 2009 @02:10PM (#899293)
> You need to use comments to explain the code – Code should be able to explain itself and should be in a format that is easily readable. If you find yourself needing to explain what your code is doing then you may want to look into rewriting that code. EDIT: This is not referring to using comments (e.g. javadoc) to explain the purpose of a method/class and its inputs and outputs.

-- What? --

Re:Signs your code sucks by groby_b on Friday October 23, 2009 @02:28PM (#899328)
Oh dear god, that nonsense again. That might be true when you write boring, straightforward business code. But when you implement a complex algorithm, that's just silly.

It's also silly if, for example, you need to do "clever" things for performance reasons. Any comment that explains the why behind your code is a good comment.

Re:Signs your code sucks by eru on Friday October 23, 2009 @03:59PM (#899509)
See the recently discussed square-root approximation algorithm as an example.
Re:Signs your code sucks by fnid on Friday October 23, 2009 @02:14PM (#899305)
This is only true of "unclever" code. You haven't written a lot of code if you haven't found a concise, optimized, abstract way to solve problems that aren't intuitive when first seen with the naked eye.

We aren't writing books, we're writing instructions for a computer and those two things can sometimes be very, very different.