"For every 3 LOC, you should write a comment. It's a standard." - A professor

Is it? 🤔

  • 6
    It might be a standard in his/her class. And it would be a really shitty one.
  • 7
    A little common sense goes a long way.

    If you ever have the feeling that something you've written is slightly more complex, you should probably leave some comments.

    Basic "1 step" functions on the other hand get commented by themselves if you just name them properly.
  • 4
    Most definitely not unless you want to have comments telling people that a bridge is a bridge rather than telling people where said bridge goes to
  • 4
    // Express your disapproval.

    I don't agree with your professor.

    Commenting for the sake of commenting is silly.

    Only add comments when really needed.

    // Talk about Uncle Bob

    I like Robert Martin's take on comments.

    He feels that comments should be limited.

    If the code isn't clear, then that's code smell.

    // Continue talking about Uncle Bob

    If your code does not express it's intent,

    you should try rewriting it. If possible,

    code should be self documenting.

    // Finish strong

    // todo
  • 0
  • 2
    //this code has way too many fucking comments.

    //yeah I know.
  • 2
    Better than being asked to comment every line

    //This empty line serves as some visual spacing between different sections of code. Unfortunately this comment has now disrupted the spacing, rendering it useless.
  • 1
    //obligatory comment - initialize things
    Def __init__(a, b):
    Self.a = a
    Self.b = b

    Yea. Definitely helps a lot. I'd be lost without it.
Add Comment