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. The Lounge
  3. Documentation via Code Comments

Documentation via Code Comments

Scheduled Pinned Locked Moved The Lounge
questioncomtoolsxmlhelp
17 Posts 12 Posters 1 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.
  • R Rama Krishna Vavilala

    Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

    /// <summary>
    /// Initializes a new instance of ImpactCalculation
    /// </summary>
    public ImpactCalculation()
    {
    this.Lines = new ImpactCalculationLineCollection(this);
    }

    Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

    You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

    K Offline
    K Offline
    keyboard warrior
    wrote on last edited by
    #2

    I generally just include a text document that is basically the history of the app, why things are the way they are and in that document take some space to note complicated or areas of code that will probably be in need of documentation. I think that helps people because knowing why something is handled a certain way is generally a lot more important than knowing how they do it.

    1 Reply Last reply
    0
    • R Rama Krishna Vavilala

      Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

      /// <summary>
      /// Initializes a new instance of ImpactCalculation
      /// </summary>
      public ImpactCalculation()
      {
      this.Lines = new ImpactCalculationLineCollection(this);
      }

      Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

      You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

      F Offline
      F Offline
      f3rland
      wrote on last edited by
      #3

      We use NDocGui to generate chm help file. That's the one we got to work. :-D

      1 Reply Last reply
      0
      • R Rama Krishna Vavilala

        Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

        /// <summary>
        /// Initializes a new instance of ImpactCalculation
        /// </summary>
        public ImpactCalculation()
        {
        this.Lines = new ImpactCalculationLineCollection(this);
        }

        Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

        You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #4

        I hate code comments. I use them, but I hate them. I'd rather be able to attach the documenation, effectively, as a layer. I've often thought of writing an add-in for Visual Studio that would put the documentation onto a layer of its own in the same way that you can layer things in Photoshop. It would be great if you could have a method (we'll call it InitializeFactory, and have the documentation associated with it as a property. I'm not sure I'm explaining it properly, but I could see you clicking on the method header and the property would appear in the property grid - I'll try blocking it out here:

        public static void InitializeFactory(int value)
        |------------------------------------------------------------|
        | General |
        |------------------------------------------------------------|
        | Name | InitializeFactory |
        | Summary | This method is used to initialize the class |
        | | factory to a particular value |
        | Returns | None |
        |------------------------------------------------------------|
        | Parameters |
        |------------------------------------------------------------|
        | value | The initial value to set the factory to. |
        |------------------------------------------------------------|

        Well, you get the general idea. No more documentation cluttering code, and documentation managed in a neat and easy manner. BTW - the name value in the summary links to the relevant item in the parameters section.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        S V 2 Replies Last reply
        0
        • R Rama Krishna Vavilala

          Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

          /// <summary>
          /// Initializes a new instance of ImpactCalculation
          /// </summary>
          public ImpactCalculation()
          {
          this.Lines = new ImpactCalculationLineCollection(this);
          }

          Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

          You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

          E Offline
          E Offline
          El Corazon
          wrote on last edited by
          #5

          Rama Krishna Vavilala wrote:

          /// /// Initializes a new instance of ImpactCalculation///

          I guess it partly matters what else is there. If that is all there is in the code not much more can be said, but you better say a lot more in the class description. /// <summary> /// The Impact calculation class handles the 3d probalistic calculation of a moving /// body to a possible impact location on the surface of the earth. Calculations are /// employed using ... and ... with filter model ... and prediction model ... /// reference papers, algorithms, authors, speed of algorithm, choices of models, etc. /// </summary> public class ImpactCalculation { /// <summary> /// Initializes a new instance of ImpactCalculation using default data to ... conditions /// </summary> public ImpactCalculation() { this.Lines = new ImpactCalculationLineCollection(this); } /// <summary> /// Initializes a new instance of ImpactCalculation using ... by calculating ... using ... algorithm /// </summary> public ImpactCalculation(params...) { this.Lines = new ImpactCalculationLineCollection(this); }

          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

          1 Reply Last reply
          0
          • R Rama Krishna Vavilala

            Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

            /// <summary>
            /// Initializes a new instance of ImpactCalculation
            /// </summary>
            public ImpactCalculation()
            {
            this.Lines = new ImpactCalculationLineCollection(this);
            }

            Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

            You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

            E Offline
            E Offline
            Ennis Ray Lynch Jr
            wrote on last edited by
            #6

            In the agile methodology the properly written code should be enough to infer the comments. If the comments can be inferred then there is no point in writing them. Comments should describe things that cannot be inferred from the code. Like, what was the author thinking, why this using a for loop instead of foreach. Pre conditions, post conditions, known side effects. Potential errors. Generated documentation inferred from source is one of the stupidest ideas in modern software engineering. End rant

            Need a C# Consultant? I'm available.
            Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

            P 1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              In the agile methodology the properly written code should be enough to infer the comments. If the comments can be inferred then there is no point in writing them. Comments should describe things that cannot be inferred from the code. Like, what was the author thinking, why this using a for loop instead of foreach. Pre conditions, post conditions, known side effects. Potential errors. Generated documentation inferred from source is one of the stupidest ideas in modern software engineering. End rant

              Need a C# Consultant? I'm available.
              Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #7

              But there's a difference between comments and documentation. Code Comments tend to blur this - you're either generating documentation or you're commenting. They aren't the same thing - so don't try to make them the same.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              E K 2 Replies Last reply
              0
              • P Pete OHanlon

                But there's a difference between comments and documentation. Code Comments tend to blur this - you're either generating documentation or you're commenting. They aren't the same thing - so don't try to make them the same.

                Deja View - the feeling that you've seen this post before.

                My blog | My articles

                E Offline
                E Offline
                Ennis Ray Lynch Jr
                wrote on last edited by
                #8

                XML Commenting does try to blur the distinction. As such look at the poor quality of MSDN these days. Embarrassing really.

                Need a C# Consultant? I'm available.
                Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

                1 Reply Last reply
                0
                • P Pete OHanlon

                  But there's a difference between comments and documentation. Code Comments tend to blur this - you're either generating documentation or you're commenting. They aren't the same thing - so don't try to make them the same.

                  Deja View - the feeling that you've seen this post before.

                  My blog | My articles

                  K Offline
                  K Offline
                  keyboard warrior
                  wrote on last edited by
                  #9

                  what if my outside the app text document has code snippets with comments... :->

                  1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

                    /// <summary>
                    /// Initializes a new instance of ImpactCalculation
                    /// </summary>
                    public ImpactCalculation()
                    {
                    this.Lines = new ImpactCalculationLineCollection(this);
                    }

                    Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

                    You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

                    P Offline
                    P Offline
                    peterchen
                    wrote on last edited by
                    #10

                    "Documentation from Comments" will not improve your documentation, it will just couple the location, so it makes keeping them in sync somewhat easier. I think XML comments are a flawed idea - XML is redundant and ugly to read. Using "code from comments" you have to balance readability in source code vs. elegance of the generated docs a bit, and all that XML crap makes this harder. Suggestion: Use a wiki, and link your code to it using Linkify[^].

                    We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                    blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                    modified on Friday, February 01, 2008 2:57:49 AM

                    R 1 Reply Last reply
                    0
                    • P peterchen

                      "Documentation from Comments" will not improve your documentation, it will just couple the location, so it makes keeping them in sync somewhat easier. I think XML comments are a flawed idea - XML is redundant and ugly to read. Using "code from comments" you have to balance readability in source code vs. elegance of the generated docs a bit, and all that XML crap makes this harder. Suggestion: Use a wiki, and link your code to it using Linkify[^].

                      We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                      blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                      modified on Friday, February 01, 2008 2:57:49 AM

                      R Offline
                      R Offline
                      Ray Cassick
                      wrote on last edited by
                      #11

                      Oddly enough the link to Linkify is broken :) I guess that makes it an ify link :)


                      My Blog[^]
                      FFRF[^]


                      P 1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

                        /// <summary>
                        /// Initializes a new instance of ImpactCalculation
                        /// </summary>
                        public ImpactCalculation()
                        {
                        this.Lines = new ImpactCalculationLineCollection(this);
                        }

                        Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

                        You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

                        M Offline
                        M Offline
                        Member 96
                        wrote on last edited by
                        #12

                        What makes you think that the person that wrote that comment wouldn't write the same thing in a separate documentation? Comment documentation can be excellent but it all depends upon the writer as with anything else. I prefer comment documentation generated directly off the library because it's easy to generate and therefore usually always up to date, I think it's an excellent idea and I think it's absurd to think the idea itself is bad because someone somewhere badly implemented it.


                        When everyone is a hero no one is a hero.

                        1 Reply Last reply
                        0
                        • P Pete OHanlon

                          I hate code comments. I use them, but I hate them. I'd rather be able to attach the documenation, effectively, as a layer. I've often thought of writing an add-in for Visual Studio that would put the documentation onto a layer of its own in the same way that you can layer things in Photoshop. It would be great if you could have a method (we'll call it InitializeFactory, and have the documentation associated with it as a property. I'm not sure I'm explaining it properly, but I could see you clicking on the method header and the property would appear in the property grid - I'll try blocking it out here:

                          public static void InitializeFactory(int value)
                          |------------------------------------------------------------|
                          | General |
                          |------------------------------------------------------------|
                          | Name | InitializeFactory |
                          | Summary | This method is used to initialize the class |
                          | | factory to a particular value |
                          | Returns | None |
                          |------------------------------------------------------------|
                          | Parameters |
                          |------------------------------------------------------------|
                          | value | The initial value to set the factory to. |
                          |------------------------------------------------------------|

                          Well, you get the general idea. No more documentation cluttering code, and documentation managed in a neat and easy manner. BTW - the name value in the summary links to the relevant item in the parameters section.

                          Deja View - the feeling that you've seen this post before.

                          My blog | My articles

                          S Offline
                          S Offline
                          Stuart Dootson
                          wrote on last edited by
                          #13

                          Pete O'Hanlon wrote:

                          I've often thought of writing an add-in for Visual Studio that would put the documentation onto a layer of its own in the same way that you can layer things in Photoshop.

                          I've often thought it'd be nice to use something like that...so if you wrote it, you'd be guaranteed at least one user :-)

                          P 1 Reply Last reply
                          0
                          • P Pete OHanlon

                            I hate code comments. I use them, but I hate them. I'd rather be able to attach the documenation, effectively, as a layer. I've often thought of writing an add-in for Visual Studio that would put the documentation onto a layer of its own in the same way that you can layer things in Photoshop. It would be great if you could have a method (we'll call it InitializeFactory, and have the documentation associated with it as a property. I'm not sure I'm explaining it properly, but I could see you clicking on the method header and the property would appear in the property grid - I'll try blocking it out here:

                            public static void InitializeFactory(int value)
                            |------------------------------------------------------------|
                            | General |
                            |------------------------------------------------------------|
                            | Name | InitializeFactory |
                            | Summary | This method is used to initialize the class |
                            | | factory to a particular value |
                            | Returns | None |
                            |------------------------------------------------------------|
                            | Parameters |
                            |------------------------------------------------------------|
                            | value | The initial value to set the factory to. |
                            |------------------------------------------------------------|

                            Well, you get the general idea. No more documentation cluttering code, and documentation managed in a neat and easy manner. BTW - the name value in the summary links to the relevant item in the parameters section.

                            Deja View - the feeling that you've seen this post before.

                            My blog | My articles

                            V Offline
                            V Offline
                            Vivek Rajan
                            wrote on last edited by
                            #14

                            I want this bad ! Would this be stored separately from the source file ?

                            1 Reply Last reply
                            0
                            • R Ray Cassick

                              Oddly enough the link to Linkify is broken :) I guess that makes it an ify link :)


                              My Blog[^]
                              FFRF[^]


                              P Offline
                              P Offline
                              peterchen
                              wrote on last edited by
                              #15

                              Fixored! :-O

                              We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
                              blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist

                              1 Reply Last reply
                              0
                              • R Rama Krishna Vavilala

                                Sadly no! I am looking at some third party component/control documentation which seem to have been generated by Sandcastle or NDoc. Though the layout looks good, navigation is easy but the documentation itself sucks. So I looked at the XML documentation I was writing. Same issues!

                                /// <summary>
                                /// Initializes a new instance of ImpactCalculation
                                /// </summary>
                                public ImpactCalculation()
                                {
                                this.Lines = new ImpactCalculationLineCollection(this);
                                }

                                Is documentation via code comments a flawed idea? I think so more and more. The most useful documentation I have seen or have written has never been generated from code comments. So what is your solution to the documentation problem? Or what is the most useful documentation you have seen/created and how did you create it?

                                You have, what I would term, a very formal turn of phrase not seen in these isles since the old King passed from this world to the next. martin_hughes on VDK

                                B Offline
                                B Offline
                                Brady Kelly
                                wrote on last edited by
                                #16

                                I find this a question of consistency. Sometimes 'Initializes a new instance' is all you can say, because it's all the constructor does, but I'd rather do that than have 'missing' constructor documentation.

                                1 Reply Last reply
                                0
                                • S Stuart Dootson

                                  Pete O'Hanlon wrote:

                                  I've often thought of writing an add-in for Visual Studio that would put the documentation onto a layer of its own in the same way that you can layer things in Photoshop.

                                  I've often thought it'd be nice to use something like that...so if you wrote it, you'd be guaranteed at least one user :-)

                                  P Offline
                                  P Offline
                                  Pete OHanlon
                                  wrote on last edited by
                                  #17

                                  Hmmmm. I feel there's a niche market here.

                                  Deja View - the feeling that you've seen this post before.

                                  My blog | My articles

                                  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