Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 87465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:24:26+00:00 2026-05-10T22:24:26+00:00

How much code documentation in your .NET source is too much? Some background: I

  • 0

How much code documentation in your .NET source is too much?

Some background: I inherited a large codebase that I’ve talked about in some of the other questions I’ve posted here on SO. One of the ‘features’ of this codebase is a God Class, a single static class with >3000 lines of code encompassing several dozen static methods. It’s everything from Utilities.CalculateFYBasedOnMonth() to Utilities.GetSharePointUserInfo() to Utilities.IsUserIE6(). It’s all good code that doesn’t need to be rewritten, just refactored into an appropriate set of libraries. I have that planned out.

Since these methods are moving into a new business layer, and my role on this project is to prepare the system for maintenance by other developers, I’m thinking about solid code documentation. While these methods all have good inline comments, they don’t all have good (or any) code doco in the form of XML comments. Using a combo of GhostDoc and Sandcastle (or Document X), I can create some pretty nice HTML documentation and post it to SharePoint, which would let developers understand more about what the code does without navigating through the code itself.

As the amount of documentation in the code increases, the more difficult it becomes to navigate the code. I’m beginning to wonder if the XML comments will make the code more difficult to maintain than, say, a simpler //comment would on each method.

These examples are from the Document X sample:

        /// <summary>         /// Adds a new %Customer:CustomersLibrary.Customer% to the collection.         /// </summary>         /// <returns>A new Customer instance that represents the new customer.</returns>         /// <example>         ///     The following example demonstrates adding a new customer to the customers         ///     collection.          ///     <code lang='CS' title='Example'>         /// CustomersLibrary.Customer newCustomer = myCustomers.Add(CustomersLibrary.Title.Mr, 'John', 'J', 'Smith');         ///     </code>         ///     <code lang='VB' title='Example'>         /// Dim newCustomer As CustomersLibrary.Customer = myCustomers.Add(CustomersLibrary.Title.Mr, 'John', 'J', 'Smith')         ///     </code>         /// </example>         /// <seealso cref='Remove'>Remove Method</seealso>         /// <param name='Title'>The customers title.</param>         /// <param name='FirstName'>The customers first name.</param>         /// <param name='MiddleInitial'>The customers middle initial.</param>         /// <param name='LastName'>The customers last name.</param>         public Customer Add(Title Title, string FirstName, string MiddleInitial, string LastName)         {             // create new customer instance             Customer newCust = new Customer(Title, FirstName, MiddleInitial, LastName);              // add to internal collection             mItems.Add(newCust);              // return ref to new customer instance             return newCust;         } 

And:

    /// <summary>     /// Returns the number of %Customer:CustomersLibrary.Customer% instances in the collection.     /// </summary>     /// <value>     /// An Int value that specifies the number of Customer instances within the     /// collection.     /// </value>     public int Count     {         get          {             return mItems.Count;         }     } 

So I was wondering from you: do you document all of your code with XML comments with the goal of using something like NDoc (RIP) or Sandcastle? If not, how do you decide what gets documentation and what doesn’t? Something like an API would obviously have doco, but what about a codebase that you’re going to hand off to another team to maintain?

What do you think I should do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:24:26+00:00Added an answer on May 10, 2026 at 10:24 pm

    I think a good part of the problem here is the verbose and crufty XML documentation syntax MS has foisted on us (JavaDoc wasn’t much better either). The question of how to format it is, to a large degree, independent of how much is appropriate.

    Using the XML format for comments is optional. You can use DOxygen or other tools that recognize different formats. Or write your own document extractor — it isn’t as hard as you might think to do a reasonable job and is a good learning experience.

    The question of how much is more difficult. I think the idea of self-documenting code is fine, if you are digging in to maintain some code. If you are just a client, you shouldn’t need to read the code to understand how a given function works. Lots of information is implicit in the data types and names, of course, but there is a great deal that is not. For instance, passing in a reference to an object tells you what is expected, but not how a null reference will be handled. Or in the OP’s code, how any whitespace at the beginning or the end of the arguments are handled. I believe there is far more of this type of information that ought to be documented than is usually recognized.

    To me it requires natural language documentation to describe the purpose of the function as well as any pre- and post-conditions for the function, its arguments, and return values which cannot be expressed through the programming language syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 191k
  • Answers 191k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer if your value is a pure text (like 'test') you… May 12, 2026 at 6:07 pm
  • Editorial Team
    Editorial Team added an answer I am "mocking" the graphics device by actually creating a… May 12, 2026 at 6:07 pm
  • Editorial Team
    Editorial Team added an answer Here's what I did. CString FormatQuery(LPCTSTR pszFormat, ...) { CString… May 12, 2026 at 6:07 pm

Related Questions

I need to develop a part of a business application in a flashy eye
Is there an easy method of accessing custom System.Configuration-based configuration data through a thread-safe
Greetings. I have been looking at Literate Programming a bit now, and I do
This question stems from this question Code documentation how much is too much? One

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.