Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 3
    If a developer I was working with simply wrote "evil floating point bit level hacking" to explain the fast square-root algorithm - they'd get a talking to by me. So long as they included a reference to somewhere more useful I'd be happy though. Commented Sep 1, 2014 at 3:56
  • 9
    I disagree in one way - a comment explaining how something bad works is a lot quicker. Given some code that is likely not to be touched again (most code I guess) then a comment is a better business solution than a big refactoring, that often introduces bugs (as a fix that kills relied-upon bug is still a bug). A perfect world of perfectly understandable code is not available to us. Commented Sep 1, 2014 at 7:42
  • 2
    @trysis haha, yes but in a world where the programmers are responsible and not businesspeople, they'll never ship as they're forever gold-plating a constantly refactored codebase in a vain quest for perfection. Commented Sep 1, 2014 at 14:26
  • 4
    @PatrickCollins nearly everything I read on the web is about doing it right first time. Almost nobody wants to write articles on fixing up messes! Physicists say "given a perfect sphere..." Comp.Scientists say "given a greenfield development..." Commented Sep 2, 2014 at 7:26
  • 2
    The best solution is to rewrite it given infinite time; but given someone else's code base, typical corporate deadlines, and reality; sometimes the best thing to do is comment, add a TODO: Refactor and get that refactor into the next release; and that fix that needed to be done yesterday done now. The thing about all of this idealistic talk about just refactoring is it doesn't account for how things really work in the work place; sometimes there are higher priorities and soon enough deadlines that will preempt fixing legacy poor-quality code. That's just how it is. Commented Sep 4, 2014 at 18:17