8

People be like: “We don’t use comments cause good code should explain itself”

Then proceed to use complicated app architectures with classes all over the place.

Fuck.

Comments
  • 4
    Self documenting code is such a bullshit meme, like sure code itself should also as much self-exploratory as it is possible, but, if needed why not explain it further in comments ? That's the fucking reason comments have been invented after all. If the comment add nothing but bloat, well that's a problem of that particulate comment content not the idea of commenting the code itself.
  • 1
    If you can't understand what the code is doing without comments, maybe you shouldn't touch it?

    Comments are supposed to bring clarity to moments in your code.

    If your methods or functions are longer than 200 lines, it should be broken up.

    There should never be a reason to give a line-by-line description of what your code is doing when it's 200 lines or less.
  • 7
    @sariel Code may self-document what it's doing, but not why.
  • 1
    @Fast-Nop that's when comments should be used.

    But I don't need a comment to tell me what a loop is looping over, the collection name should be named properly to deduce that.

    I also don't need a comment to tell me why we're looping over the collection because the method/function name should be descriptive enough to know that.

    This is what it means to write self-documenting-code.

    Have a complex majestical l mathematical formula that needs explaining? Go for it.

    Need to make a note about why this bit of code is important for another system? Brilliant!

    Need to explain why the method "displayUsers" is looping through users? Get wrecked.

    I cannot stand comments in code, they make it difficult to see what the code is doing. I didn't become a developer to read a fucking book, I became one to read and write code.
  • 2
    If the architecture is complicated, comments barely help. At that point you need documentation.

    Having classes everywhere doesn't itself create a complicated architecture but it sure is possible to create a complicated architecture with classes.
  • 0
    @electrineer the architecture needs a fucking book, not documentation. like jesus christ - this is hell.
  • 0
    @u-m-a if the documentation resembles prose, it's probably bad anyway
Add Comment