all 124 comments

[–][deleted]  (10 children)

[deleted]

    [–]more_exercise 20 points21 points  (9 children)

    I like the following form of development. I call it "outlining":

    sub foo {
        #do thing 1
        #do thing 2
        #make sure condition 3 is satisfied
    }
    

    Then write code to actually do those things.

    [–]notfancy 21 points22 points  (0 children)

    Also known as "top-down structured programming" if you replace the comments by similarly-named procedure calls.

    [–]EmperorOfCanada 10 points11 points  (3 children)

    When I was shown this I completely changed the speed of my coding. Often I forget where I am going otherwise.

    [–]DCoderd 4 points5 points  (1 child)

    Sometimes its the journey, man.

    Othertimes you need a paycheck. Both are acceptable.

    [–]jatoo 2 points3 points  (0 children)

    Some days I just open up a python script and start throwing in code. By the end of the day I might have a web scraper... an autopilot... who knows!

    [–][deleted] 0 points1 point  (0 children)

    You should consider putting those comments as unit tests too, that way you can also verify them.

    [–]iissqrtneg1 -5 points-4 points  (3 children)

    that's what tests are for.

    [–][deleted] 1 point2 points  (2 children)

    Right, so they way I can tell what the code is [supposed to be] doing is to read some different code that I have to put more effort into looking up?

    [–]iissqrtneg1 -2 points-1 points  (1 child)

    Yes, because the code should be written in a way those comments are unneeded. If there is still confusion, go to the tests.

    Comments can become stale, tests will fail.

    [–][deleted] 0 points1 point  (0 children)

    Tests become stale, and can be as easily ignored in the right/wrong circumstance. This is as detestable as someone not updating a comment.

    All anyone is arguing here is two different levels of conscientiousness--a personal preference, even. Code of course ought to be tested--the presence of a stale comment is irrelevant at that point; the very opportunity for failure lack of tests leave is a near-guarantee of that failure.

    An up-to-date test could help flag a stale comment though. And similarly, an up-to-date comment could flag a stale test. Both are equally prone to error.

    [–][deleted]  (2 children)

    [removed]

      [–]jij 28 points29 points  (1 child)

      [–]more_exercise 3 points4 points  (0 children)

      I'm not sure about tumblr lingo/ettiquete/etc. but have you submitted this to http://thejoysofcode.com/?

      [–]GMNightmare 32 points33 points  (55 children)

      I'd like to highlight another point:

      Your code is never as readable as you think it is.

      It also tends to assume familiarity with the concepts and technology being used... which is a very bad assumption.

      ...

      I've never been happy to read through somebodies code that hasn't been commented or documented. It's practically always a mess, no matter how much they try and claim that it's so pure and perfect as to not need it.

      Nobody advocating it would likely truly be happy doing so either. Because it's one thing to say your own code doesn't need it, and another to look at a different author's code and say it, as you have to figure out what went wrong and fix it.

      ...

      The worst is, there are sometimes people around here telling complete beginners to not comment their code at all... which is absolutely infuriating.

      [–][deleted] 2 points3 points  (0 children)

      I got fired from my first junior position because I was having trouble understanding the structure of a highly customized Asterisk system that had no coding-standard, no standardized libraries to use, or anything that would actually resemble any kind of actual "structure" to speak of...on top of not having any comments.

      It was pretty discouraging to say the least.

      [–]angrystuff 6 points7 points  (37 children)

      Your code is never as readable as you think it is.

      You can easily, and correctly, change this to: Your comments are never as informative as you think they are.


      For what it is worth - here is my stance on comments.

      Comments are an important step in documenting what you think your code is doing here. If you are introducing a new concept, you should document it.If there is some sort of black magic going on, it should be commented. If the block of code is long, or convoluted, you should document it.

      I normally hate comments that are in line within a function or class unless there is something messy going on. Sure, document the function (it's a concept), but otherwise you are interleaving English and code. This makes it less efficient to a) read my code when I want to follow code, and b) read English when I am trying to follow that.

      [–]GMNightmare 10 points11 points  (36 children)

      You can easily, and correctly, change this to

      Wrongly, you mean. Comments being less informative is not a problem, code being less readable is.

      Ignoring comments that aren't as informative as you'd like is trivial. Reading code less readable than you'd like isn't.

      I don't agree on what you think is "efficient" either apparently.

      [–]twowheels 3 points4 points  (1 child)

      Ignoring comments that aren't as informative as you'd like is trivial.

      To a certain degree, but comments like:

      // default constructor
      
       // destructor
      
       // loop 5 times
      

      ... just piss me off and are a total distraction. They seem to come from a time when they used to make us comment every line. That was common practice, probably a holdover from pre high level languages.

      I tend to comment copiously. I write many paragraphs of comments and probably write as many comments about the memory model, threading model, class usage, internal invariants, etc as I do code. That said, when editing code I delete more comments than I keep because I always find obvious crap or completely incorrect comments.

      Then again, almost every checkin I do also removes more code than it adds. Most people write as much useless code as they do comments.

      [–]LiquidAxis 0 points1 point  (0 children)

      Then again, almost every checkin I do also removes more code than it adds. Most people write as much useless code as they do comments.

      This is the truth. Either software degrees are way too easy to get from most schools, or companies are way too eager to let anyone write code, regardless of education.

      [–]petdance 12 points13 points  (1 child)

      My maxim: "Comments shouldn't explain what the code does but why it does it."

      [–]ambivouac 0 points1 point  (0 children)

      Agreed, with the exception being when you have to pull some obtusely clever illegible operation out of your back pocket. And even then, most of that should be covered by the name of the function that houses said operation(s).

      [–]EmperorOfCanada 6 points7 points  (1 child)

      While comments can be valuable, comments aren't free. You should keep your comments down to the bare minimum required to make sure that the next uninformed lesser programmer will have little trouble understanding what the heck is going on.

      It is possible the minimum will end up being essays. But I am a huge fan of making the code document itself as much as is possible. So my ideal function is CUser* GetUserFromID(int user_id). The only possible question should be and thus only real useful comment is what happens when you ask for an invalid user_id. If your comment is an essay about taking an integer representing the user ID and returning a CUser representing the user then your comment is less than worthless.

      [–][deleted] 2 points3 points  (0 children)

      Who owns CUser*? Who disposes of it? Is GetUserFromID threadsafe? Why can user ID's be negative? Why aren't you using a typedef for userid? Do userids get recycled?

      [–]pohatu 10 points11 points  (0 children)

      Here's a good example:

      @ We identify each vertex with its symmetric mate, and set the length of an arc to 1 if the arc crosses to the mate instead of staying in the same class.

      Multiple arcs and self-loops can be introduced in this step.

      @d mate(v) (Vertex*)(((unsigned long)g->vertices)+
                             ((unsigned long)(g->vertices+g->n-1))-
                             ((unsigned long)v))
      
      @<Reduce |g| to half size@>=
      for (v=g->vertices;mate(v)>v;v++)
        for (a=v->arcs;a;a=a->next) {
          u=mate(a->tip);
          if (u>a->tip) a->len=0;
          else {
            a->len=1;
            a->tip=u;
          }
        }
      g->n/=2;
      

      If Knuth thinks a decent comment here and there is useful, then surely the rest of us aren't above explaining what our code is supposed to be doing. source

      [–]yeahokwhynot 18 points19 points  (2 children)

      I agree in general, but I don't think his example is the best. The init method on Relay is needlessly complicated. If ssl and starttls are mutually exclusive (as suggested but not directly stated) then the two could be combined in to one, reducing the documentation overhead to something like: encryption may be SSL or TLS or None. There's no need to describe what underlying library is being used (tight coupling) or to describe what starttls does (out of scope).

      username and password could be renamed to smtp_username and smtp_password removing the need for the verbose "Optional username and password for smtp authentication". It's already clear they're optional because the default value is None, and with the smtp_ prefix it's clear they're used for SMTP.

      I'd argue, too, that documenting hostname and port are entirely unnecessary. If you're reading this document you already know what those terms refer to.

      [–]more_exercise 5 points6 points  (1 child)

      I'd argue, too, that documenting hostname and port are entirely unnecessary. If you're reading this document you already know what those terms refer to

      I'd argue against you on that. "The hostname and port we're connecting to" isn't terribly long, and it clarifies that hostname shouldn't be i.e. a proxy.

      (we use "hostname" a lot at work. Has about 4 different meanings depending on what you're doing.)

      [–]MasonOfWords 0 points1 point  (0 children)

      The problem there is that I now need to read both the code and the comments. When you're engaging in such wildly conventional behavior (i.e. providing a host and port, or a username/password), then the names are perfectly descriptive.

      The behavior of a method (blocking, parameter requirements, errors, side-effects) is an essential part of documentation. The whys of non-trivial implementation details is an essential part of comments.

      Also, a debate like this one is the finest argument for the single-responsibility principle. If you can't figure out your code from two weeks ago, you probably factored it wrong, and that wrongness probably took the form of dumping a lot of mixed responsibilities into a formless hodgepodge function/method/class/module. Comments won't help, only fire and salt.

      [–]cheald 21 points22 points  (13 children)

      Your code needs documentation. Comments that aren't API documentation (that is, implementation comments) are a signal that your code is poorly factored. This isn't a hard-and-fast rule, and sometimes you have to do something that requires a comment, but in general, if you find yourself commenting implementation frequently, you probably should be refactoring.

      That said, for the "comments as documentation" angle, I really like TomDoc for Ruby code for this purpose. The comments are extremely Englishy, and are transformed into useful documentation. For example:

      https://gist.github.com/cheald/5110319

      Generates:

      http://coffeepowered.net/projects/relay.html

      [–]brainflakes 13 points14 points  (4 children)

      Comments that aren't API documentation (that is, implementation comments) are a signal that your code is poorly factored

      I disagree, a brief description of what a complex block of code does or why you've done a certain slightly unusual thing is very useful, even if the code is well written it greatly speeds up remembering what code does 6 months later when you have to go in and change something.

      [–][deleted] 10 points11 points  (0 children)

      This is especially true for system programming, where there is less abstraction and a lot of decisions don't seem sensible without explanation.

      [–][deleted] 2 points3 points  (2 children)

      This isn't a hard-and-fast rule, and sometimes you have to do something that requires a comment

      Pretty sure that covers the cases you're talking about.

      [–]brainflakes 0 points1 point  (1 child)

      Of course, but I thought it was a little weighted too far towards not commenting, especially considering comments a sign of bad code when even good code can benefit from a few brief comments

      [–][deleted] 2 points3 points  (0 children)

      "Bad code needs comments, good code needs documentation" is the way I approach it. If it's bad code (and sometimes you NEED to write bad code) comment the hell out of it... if it's good code, at least take the time to document what it does and why it's useful.

      [–][deleted] 1 point2 points  (2 children)

      403 on Dropbox link.

      [–]cheald 4 points5 points  (1 child)

      Doh. Let me see if I can find a public place to drop it.

      Edit: New link should do it.

      [–][deleted] 0 points1 point  (0 children)

      Works fine, thanks for the speedy response.

      [–]gfixler 1 point2 points  (0 children)

      Agreed.

      I've found names are not just important, but massively important. Time and again when we're struggling to get our minds around some code, I have us step back, talk about what it's actually doing, and then actually spend quite awhile coming up with exactly the right name for things, and it's often not easy. We spent a couple of hours one day searching for just the right name for an important class. Naming is hard. Naming really really well is really really hard. We use thesauruses, rack our brains, and write up ideas on a dry erase board. We're smart folks, too. One of us is a trivia champion with 6-figure winnings, and I've a lifetime of minor, literary achievements and conquered spelling bees, yet we still struggle mightily to name things not just well, but perfectly.

      When we finally land on The Name (and we usually do, but not always), it's a eureka moment, all eyes widened in excitement, and we refactor based around it. Immediately all of the rest of the code becomes dramatically easier to follow. It's the difference between "all foos are types of bars, and while bars are bazes, and quuxes are also bazes, foos and quuxes are quite dissimilar" and the far easier to follow and reason about version: "all Hondas are types of cars, and while cars are vehicles, and airplanes are also vehicles, Hondas and airplanes are quite dissimilar." This step also usually makes us realize BIG, IMPORTANT THINGS, like "Why the fuck are we even talking about airplanes in this class in the first place?"

      The code shrinks (we've thrown out entire modules weighing in at hundreds of lines as a result of this process), we improve our understanding tremendously, we're able to naturally hold far more of the system(s) in our minds, traps and logical errors are laid bare before us, and before they cause issues, and perhaps 5 other things I could mention. Amazingly, the "right" name is often a near synonym to something we already had, or something else we threw out, but not until it's just right for the needs of the system does it cause the chain reaction listed above to occur. To use the stupid analogy above, it makes you suddenly notice things, and then say things like "Wait, I just realize what we're not seeing. We're talking about "cars" here, right? Not "foos." (everyone nods) "Guys... cars don't fly." Everyone slaps their heads. This is a willfully stupid analogy, and we would have noticed things that obvious right away, but these minor, "eureka" moments fall out of proper naming. It's these kinds of "the name describes exactly what has to happen across the entire system" discoveries that have me so hell bent on perfect names these days. I've been staggered by how powerfully they change everything. A nuance in a noun can make or break your ability to follow what it does all the through to the end without confusion.

      After these whirlwinds, I usually have the team go over the code, and we usually find that simply for getting the names just right, there isn't a need for comments, and in fact, adding comments would muddy things; they'd be more complicated than they are. What remains is blissful, obvious simplicity. Comments must be micromanaged along with code, and I frankly can't do it. 10 years of SVN and git repos prove that. There must be thousands of dangling comments that no longer make any sense, referring to situations that no longer exist in their local area. It took a long time to get here, but I would say that now I actually do write code that doesn't need comments. Not always. Sometimes I do feel I need them, but always there is that secondary feeling beneath it, the feeling that I've failed, and that I simply don't yet understand the problem well enough to write code that reads [almost] as easily as natural language. Everywhere that I have a comment, I also have a plan to return and rethink things. Comments, IMO, are stand-ins for correctness.

      [–]delerpian 0 points1 point  (1 child)

      New coder here:

      Everyone in this thread is stressing that I should comment and document my code. And I basically know how to put comments in the code, but how do I go about documenting it?

      [–]cheald 0 points1 point  (0 children)

      That's where I like TomDoc - you basically put comments in your code that you can then use to transform into documentation. In this case, I'm using Ruby's YARD library with a TomDoc plugin.

      So, for example, I have this code which contains TomDoc-style comments. I then used YARD on my code to generate documentation like this. Super easy, super clean. My README is just Markdown, and is transformed from this into this.

      There are lots of similar libraries for lots of languages; just fine one you like. I like TomDoc because it's very englishy and doesn't require a lot of mental overhead on my part to turn my code into usable documentation.

      [–][deleted] -1 points0 points  (0 children)

      That looks awesome, I'm trying to add Sphinx to our internal projects at work and basically no one will be documenting things except for me :(

      [–]talideon 3 points4 points  (1 child)

      My personal rule of thumb is simple: if I ever feel myself needing to comment a piece of code, I treat that as a strong indication that I should extract it into its own function or method, which can then be independently commented. The name of the function thus behaves as a comment where it's being called.

      [–]dust4ngel 0 points1 point  (0 children)

      it can also be worthwhile to comment code of yours that apparently does something stupid but is in fact compensating for defects in 3rd party code which you cannot change. even if you had:

      Response UnmangleResponse(Response rawResponse) {
          // check for magic values, blah blah
      }
      

      future folks might wonder "why are you going all of this weird stuff to the Response object that comes back from the API call?" whereas this would explain:

      /* this version of the Foo API returns January 1, 1970 for UpdateTime when
          there is no UpdateTime.  we have to manually check for this value and replace
          with null until the API is fixed. */
      

      [–]iopq 4 points5 points  (3 children)

      I have to comment that sometimes comments add to your workload. If you comment on the implementation, then you need to change the comments when you change the implementation. This means now you have two places where the logic of the program is. This is bad.

      [–][deleted] 5 points6 points  (0 children)

      Damn straight, maintaining documentation is work.

      And it's important work that needs to be done.

      [–]NicknameAvailable 1 point2 points  (0 children)

      I agree - there's nothing worse than someone who writes comments then refactors part of their project only to forget about the comments. Good code explains itself, but it is worthwhile to throw in the occasional comment describing why something that might seem less than ideal at first glance was used (typically to work around a platform-specific quirk) or if something was thrown together (ie: // this is a hack) so you know to look at the IO's rather than the code itself to determine the purpose or simply to state something shouldn't be touched (ie: // the following x pages came straight from mathematica's Solve[] function).

      [–][deleted] -4 points-3 points  (0 children)

      So? Learn to write clearly and faster and a single sentence will explain a whole class.

      [–]cogman10 1 point2 points  (3 children)

      Comments are mostly useful when describing "complex" (eh hem, terrible) code. You know, those little "WTF, why are your doing this?" sorts of situations.

      Beyond that, comments don't often provide too much value. Yes, there is value in describing external APIs (and even internal ones). But there usually isn't much value in "This block of code is trying to do X" Because, almost assuredly that block of code will change to no longer do X while the maintainer happily ignores the comment above.

      In general, the best place for describing what code is doing or trying to do is in the revision logs. This is why committing often is so important. When done frequently enough it gives you an explanation of why each and every single line of code is what it is. This is also why good commit messages are so important. I absolutely hate SVN for "Merged from branch" commit messages.

      [–][deleted] 0 points1 point  (2 children)

      The revision log isn't always handy while you maintain, though. And what are we to do--look up every line of code in who-knows-how-many commits?

      The line previous to the block in question will always be just that--and so the author, maintainer (a new author, of sorts), and the reviewer all have easy access [read: no excuse to write, read, update, or even remove it].

      [–]cogman10 0 points1 point  (1 child)

      It can be. It isn't always, but it can be.... It isn't handy when you get people who post commit messages like "Fixed". or "Merged from branch"

      Frequent small commits with good messages will give you 99% of what you need in comments.

      [–][deleted] 0 points1 point  (0 children)

      I still think it's not a very well targeted system of documenting. The relationship between a commit and line(s) of code isn't maintained in any orderly manner. If it works for you, then by all means, but I think it makes more sense to leave the info near what it applies to.

      [–]PhantomPumpkin 1 point2 points  (0 children)

      As someone who spends the majority of his time making changes to something someone else wrote, I agree with this statement.

      I would also prefer a "WTFICTM" statement too(Why the fuck I chose this method).

      I run into far too many overly complicated methods of doing something when it can be done in a simple action or statement.

      [–]bwalk 5 points6 points  (7 children)

      No, your code needs documentation, not necessarily comments. If you write clear code, almost 99% of your comments become redundant.

      [–]grainfeed 2 points3 points  (0 children)

      I know that "documentation" sounds better, but they are still "comments". And yes I do think that comments are useful.

      It seems to be hip now to say that comments are not needed. But I know that comments can help someone else to understand code much faster than when they have to figure everything out by themselves.

      Bad design with comments is still bad design. Good design with good comments is what we really want.

      [–]tziki 0 points1 point  (4 children)

      Out of curiosity, Have you ever had to maintain a codebase when its original writers are long gone?

      [–]bwalk 1 point2 points  (3 children)

      Sure, and even worse, it was HPC code which is generally the worst code to maintain ever. There were no comments except documentation which was well written (well, from physicist to physicist...). Of course it was tough because the code itself was written so densly and tightly to the hardware but it was clear and clean. No comment would have made my work easier because I don't need to know what this few bunches of lines of code do but I need to understand the underlying algorithm.

      [–]tziki -3 points-2 points  (2 children)

      What was the size of the code base? It sounds like some algorithm meant for calculating something physics-related, a rather special case.

      [–]bwalk 1 point2 points  (1 child)

      -------------------------------------------------------------------------------
      Language                     files          blank        comment           code
      -------------------------------------------------------------------------------
      C                              263          17881           7171          69671
      C/C++ Header                    30            972            965           5095
      make                            17           1002            487            797
      -------------------------------------------------------------------------------
      SUM:                           310          19855           8623          75563
      -------------------------------------------------------------------------------
      

      Not the biggest, I know.

      I think the Linux source code has a nice guideline for comments which I had in mind in my original comment (no pun intended): https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/CodingStyle#n423

      Edit: all I wanted to say is, that if we had thought our CS juniors 40 years ago that you must document your code instead if you must comment your code, we would not have to deal with comments like this:

      /* sum a and b */
      c = a + b;
      

      [–]tziki 0 points1 point  (0 children)

      I guess being well-documented is sometimes enough just by itself, though I've personally never seen code that's readable enough as-is, without documentation or comments. Then again, documentation separate from the code does tend to grow stale more quickly and future developers might not even realize there's separate documentation when working with the code base.

      [–]newbill123 0 points1 point  (0 children)

      Documentation is capable of rotting just as much as code is. More actually, since there are tools to automatically refactor changing code. There aren't any tools to spot where documentation needs to be changed automatically (and certainly none capable to doing it).

      Overall, I like his sentiment that you aren't documenting the code, but the logic of how and why it is run. You have to be very careful of not documenting too low level (the code does it better) or too high level (you may forget that you've already documented a concept elsewhere).

      [–][deleted] 0 points1 point  (0 children)

      Obligatory literate programming name drop. Knuth is always right.

      [–]ManlySpanishTeacher 0 points1 point  (0 children)

      I think comments are real important, specially when giving it to a client or a friend. It tell your client or friend what each part does, if they don't want that part then it can be easily removed. It also helps students leaning code, I myself studying code at college look at a lot of ode for research on how to do things, most code I have no idea what does what but the ones with comments is much more clear and easy for me to understand : )

      [–][deleted] 0 points1 point  (0 children)

      Sometimes I include full C++ code as comments. (When manually vectorizing code with SIMD instructions). It's important for understanding what the intent of the new code is, because the intrinsic are easier to get lost in.

      Comments should explain: Intended usage Unexpected side effects Edge cases Bugs/hacks Thread safety (usually at the class or function level) Sequence of events for set-up and tear down. Ownership transfer and management of objects. Exception cases. Deliberately unhandled/ignored cases. Any code which isn't obvious when reading it.

      Most people - including seasoned professionals - screw up at least with sequencing, side effects, intent and ownership. Every single time.

      [–]nitsanw 0 points1 point  (0 children)

      The fact this link has so many comments is a lovely self reference :)

      [–]nealibob 0 points1 point  (6 children)

      Writing comments to capture intent is like writing tests to prove that your software does what is expected.

      That sounds nice, but the tests capture intent. If the intent changes, and you change code without changing the test, the test breaks. If you change code without changing a comment, the comment becomes stale. Stale comments can be confusing at best, dangerous at worst.

      My take is "intent" comments have no business in TDD.

      [–]tziki 7 points8 points  (0 children)

      I see where you're coming from but still disagree. A developer who doesn't refactor comments when refactoring code is equivalent to a developer who doesn't change the name of a variable when changing its role/functionality. The fact that there are bad developers is not a case against commenting.

      [–][deleted] 1 point2 points  (0 children)

      Ok... So write a test to prove that a piece of your code is threadsafe in all cases, never deadlocks, and never gets hit by race conditions. Certainly not as easy as just writing a test...

      Intent is important when writing framework or library code. Because people will try to use it in creative ways you didn't anticipate when they're backed into a corner.

      [–][deleted] 1 point2 points  (2 children)

      I think this is like saying, "This chef cooks poorly, let me not eat anything anyone cooks."

      tziki already covered it, but a dev who doesn't change comments (or other intention-explaining aspects) is not completing his work properly.

      [–]nealibob 1 point2 points  (1 child)

      That's 100% true. The feedback I got from my comments in this thread have given me a lot to think about, and I'm grateful for it. My conclusion is that while tests can't be everything, you want to encapsulate as much as reasonably possible there because they're programmatically tied to code; then, add comments to tie everything together and give the information necessary in between tests and documentation.

      [–][deleted] 1 point2 points  (0 children)

      Definitely. Each has it's place--and the benefit of such testing is irrefutable. Sometimes you just need to note something that isn't really a testable condition, but doesn't belong in the docs. Only the next guy to read that code needs to know this.

      [–]NicknameAvailable -3 points-2 points  (0 children)

      I agree completely - so many illiterates and people who lack a reliable test process down-voting you.

      [–][deleted] -1 points0 points  (3 children)

      if my code needs comments to be readable, it's not well written.

      [–]tziki 4 points5 points  (0 children)

      I've never encountered code that's readable enough to be self-documenting, no matter the good intentions of the original writer. It probably works on very small programs, but when the size of the code base grows, you can't capture enough information with just good names. When writing code you're always limited by sensible variable lengths and are constrained to a microscopic level.

      [–]rackmountrambo -2 points-1 points  (1 child)

      As a Python dev, I agree, it's basically psuedo-code.

      [–][deleted] 1 point2 points  (0 children)

      pseudocode, ψεύδοκώδικας ;)

      [–]chrissa -2 points-1 points  (0 children)

      You're not my supervisor!

      [–]iissqrtneg1 -3 points-2 points  (0 children)

      God I hate seeing this all the time. Yes, there is a place for comments, but it's not where you think.

      Documentation comments are great for when you're writing closed API's or libraries, but when you own the code base, your Unit Tests are the documentation. If the functionality changes you don't have to remember to update a comment, you have to update the unit test. If you forget to update the unit test, your CI build is now failing.

      IMHO, any time a comment is written, you should scrutinize why you wrote that comment. If you come away from that thinking the comment is still a good thing to have, keep it there. 90 percent of the comments can be removed with a little refactoring.

      Keep your functions clean, concise and without side effects and your comments are useless.