News for hackers. Stuff that matters.
Re:How to Write Unmaintainable Code (2003) by throwawaynothx on Monday August 31, 2020 @12:08AM (#24328419)
Personally, I don't write comments. I write self explanatory method names. Comments become unmaintainable
Re:How to Write Unmaintainable Code (2003) by IggleSniggle on Monday August 31, 2020 @02:11AM (#24328909)
Regarding the relative usefulness of a well-named method vs an explanatory comment, I think it depends on the culture of refactoring for the codebase. If a codebase sees its code very regularly refactored, then comments can be downright dangerous/misleading while methods are easily renamed throughout. On the other hand, a well placed comment can tell you a lot of “why” or “how-to” that a method name / signature cannot.
Re:How to Write Unmaintainable Code (2003) by arkitaip on Monday August 31, 2020 @02:36AM (#24329009)
Comments can get stale really fast but I probably write at least twice the amount of comments as code because that's how I reason about the function and intention of the code. Sometimes the code seems simple but the reason why it exists can be really complex.