Coffeehouse Post

Single Post Permalink

View Thread: TypeScript is JavaScript...
  • User profile image
    Sven Groot

    @Bass: So you have never had a situation where you've gone "this is a really clever but complex solution to a difficult problem, I'd better add a line of text to explain it"?

    Or even "this is a really ugly hack but it's necessary, better explain why I did it lest this code end up on thedailywtf"?

    Comments that explain what you are doing are bad, for reasons you say (except in documentation comments since as the consumer of a method I don't want to have to read the code). But comments that explain why you are doing something are absolutely indispensable. And if your algorithm is complex enough, I'd rather read a few lines of text (with the possibility that they might be stale or wrong) than weed through 1000s of lines of codes in the hopes of figuring it out.