Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Commenting code...

Commenting code...

Scheduled Pinned Locked Moved The Weird and The Wonderful
visual-studiocomdebuggingquestion
24 Posts 16 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Phan7om

    there should be minimum comments in the code, as they are not maintained properly and often lead to confusions. comments should be put unless some very convoluted things are going on

    No matter how fast light travels, it finds the darkness has always got there first, and is waiting for it

    A Offline
    A Offline
    annathor
    wrote on last edited by
    #21

    And not to mention, in most cases comments a) states the obvious or b) lie to you, and only function as code-clutter. comments are the most misused feature of any programming language.

    1 Reply Last reply
    0
    • Sander RosselS Sander Rossel

      We have programmed with .NET WinForms for 7 years now, my boss too (and probably more than any of us). Documenting methods that are already documented just seems like such a waste of space. Our code is full of such obvious comments...

      ' Set the caption of the label.
      Label1.Test = "Saved successfully"

      ' Saves the Product.
      customer.Save

      Do you see the problem? Everyone can see that the TEXT of a label is set, even though comments say caption (all throughout the software, copy/paste mentality). Even worse for the product/customer. People copy and edit code, they don't edit comments. If I had to comment each and every .NET Framework method like that the development time gets quite a bit longer... I have learned to not read comments, because they do not currently add any value to our code, just clutter. Every comment needs to be maintained, just like any other piece of code. For some reason it never happens. And everytime my boss asks me to comment the obvious once again I die a little inside. I'm not sure what is worse, uncommented code or overcommented code. At least uncommented code says what it does (right there in the code), if comments do the same is always a question.

      It's an OO world.

      T Offline
      T Offline
      tobep
      wrote on last edited by
      #22

      Terrible comments. The first "Set the caption of the label." What does the label pertain to? Better yet, change the name of the label to "lblSaveStatus" or something like that. GREAT code is mostly self-documenting. The second comment looks just plain wrong. From the code, it looks like you are saving a "Customer", but the comment says "Saves the Product." The comment is inconsistant with the code.

      Sander RosselS 1 Reply Last reply
      0
      • T tobep

        Terrible comments. The first "Set the caption of the label." What does the label pertain to? Better yet, change the name of the label to "lblSaveStatus" or something like that. GREAT code is mostly self-documenting. The second comment looks just plain wrong. From the code, it looks like you are saving a "Customer", but the comment says "Saves the Product." The comment is inconsistant with the code.

        Sander RosselS Offline
        Sander RosselS Offline
        Sander Rossel
        wrote on last edited by
        #23

        tobep wrote:

        GREAT code is mostly self-documenting.

        My boss just doesn't want it... Nothing beats commenting the hell out of your code :(

        It's an OO world.

        public class Naerling : Lazy<Person>{}

        1 Reply Last reply
        0
        • R Rob Grainger

          Naerling wrote:

          I prefer seperate technical documents

          The 1970's called, they want their developer back ;-) If people rarely keep comments in sync with the code, the chance of them keeping separate technical documents is almost nil. Almost every project I've worked on with large amounts of technical documentation has been government contracts - badly run, badly designed, over budget and frequently failing, but I've not seen a single example of useful technical documentation on any project I've been lucky enough to work on. At least a comment stands some chance of being updated.

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #24

          Rob Grainger wrote:

          The 1970's called, they want their developer back ;-)
           
          If people rarely keep comments in sync with the code, the chance of them keeping separate technical documents is almost nil.

          Actually that is exactly what our company did in the 80s to get ISO certification. Our entire software development process was defined around keeping everything in sync. And it worked!

          Rob Grainger wrote:

          Almost every project I've worked on with large amounts of technical documentation has been government contracts - badly run, badly designed, over budget and frequently failing, but I've not seen a single example of useful technical documentation on any project I've been lucky enough to work on.

          Funny you are saying this, because before we introduced extensive documentation and the process around it, we did have issues with budget and time overruns, but rarely after. I've learned - by example - that a well organized process put into action by a disciplined team can produce incredibly high quality output with predictable results. And the documentation was crucial to that! Before we had that extensive documentation, we lost too much time reimplementing stuff that wasn't specified in sufficient detail. Of course, back then the process we had was a modified waterfall model. Nowadays, with agile development, you need a lot less documentation - it's bound to change anyways. In the end, what it all comes down to is that you need a good process. if that process requires a lot of documentation, then you need that. If the process can do without, then you don't. OTOH, if the process is bad, then no amount of documentation can save you.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups