15

My internship company does not believe in the concept of 'commenting'. They just tell me: "Ahh just write readable code!
Yeah that's cool until I need to read out thousands of lines of javascript without a single comment!

Comments
  • 4
    If you are reading a thousand lines of code, you're doing it wrong.

    It sounds like you use comments as an abstraction, I.E you write a comment for 5 lines of complex code to describe what it's doing.

    Make a method instead.

    It can seem hard at first, but this is actually a good thing. People use comments in place of making readable code and that's a problem.

    I've never seen a chunk of code with a comment and not been able to remove the comments and replace it with some kind of abstraction.
  • 0
    If you want, you can show me an example of code that you think cannot be abstracted without a comment and I'll refute it, but worst case scenario you can literally just make a method name based off the comment (usually you can do a lot better, but it can be harder)
  • 1
    @Nevoic well that's not my point. I believe in readable code but this company gave me some bugs to fix in an application with pure spaghetti code. It had neither readable code nor comments so that kinda made me a little pissed.
  • 1
    @AlbertSkye yeah I totally feel that. I've been in scenarios with poorly written code and I've relied upon comments to get me through this.

    But this is a double edged sword, people feel less of a need to update comments (because they don't have any impact on the code), so I've actually used out of date comments before as a guideline and had unexpected results.

    I've pretty much learned that if it's spaghetti code with comments, it's probably buggy AF, so I can't really use the comments except to gauge what the original intent of the code was.
  • 1
    @AlbertSkye my main point was when writing code. If you're writing new code I would lean towards making it readable without comments.

    A general code smell for me is if I feel the need to write a comment to clear something up, it's probably not clear enough in the code.
Add Comment