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 686233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:00:13+00:00 2026-05-14T02:00:13+00:00

On my previous job, providing all methods with javadoc was mandatory, which resulted in

  • 0

On my previous job, providing all methods with javadoc was mandatory, which resulted in things like:

/**
 * Sets the Frobber.
 *
 * @param frobber The frobber
 */
public setFrobber(Frobber frobber) { ... }

As you can see, the documentation takes up space and work, but adds little to the code.

Should documenting all methods be mandatory or optional? Is there a rule for which methods to document? What are pros and cons of requiring every method to be documented?

  • 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. Editorial Team
    Editorial Team
    2026-05-14T02:00:13+00:00Added an answer on May 14, 2026 at 2:00 am

    “providing all methods with javadoc was mandatory”

    I strongly suspect that documenting all methods was mandatory, but providing javadoc comments was all that could be automatically enforced and hence all that was uniformly done.

    Personally I think it’s better to have no javadoc than completely useless javadoc – at least you can see from a glance at the HTML which methods are undocumented, because there are no descriptions of the parameters etc.

    Documentation is frequently underrated, because it always seems less important and urgent when you’re writing the code, than it does when you’re using it later. But the style and form of documentation is often overrated – auto-generated XML nonsense is still nonsense. Given the choice, I’d rather have the code comment // Sets this object to use the specified frobber for all future frobbing, than your zero-information javadoc.

    For all I know from your docs, the function doesn’t actually modify this object at all, it might call the set() function on frobber, or it might be while(!frobber.isset()) { refrigerator.add(frobber); sleep(3600); refrigerator.remove(frobber); } Hence it “sets the frobber”. I’m sure I read somewhere that “set” is the word with the most distinct definitions in the OED. Brief descriptions are ambiguous and hence misleading, and the purpose of documentation is to stop people relying on your source, and hence on details of your current implementation. My comment doesn’t really take any longer to write than it took to add “Sets the frobber” and “the frobber” to the IDE-generated javadoc stub. It doesn’t explain what frobbing is or when this object does it (hopefully that’s elsewhere in the class docs) but at least it tries to tell you what the function does.

    As for when to mandate documentation – I think every interface must be documented. If you’re not defining Java interface s, the “interface” is every public and protected method, and every package-protected method unless the package is tiny. Implementation doesn’t have to be documented, although it should be commented if the way it works is non-obvious. Documentation might be as simple as the sentence in my comment above – you don’t necessarily need a separate sentence for each parameter if the method description already says what they are.

    If you have code review, then IMO the answer is to review comments and documentation at the same time. If you don’t have code review, then you need a cone of shame for whichever developer most recently forced someone else to come over and ask what the code actually does.

    The same applies to anyone who relied on undocumented behaviour of a function, with a result that an implementation change that didn’t change the interface, breaks their code. The way you enforce that code be documented, is to complain that you can’t call it until you know what it guarantees to do. Arbitrary rules like, “javadoc comments must exist” become less important, at least for functions that other developers need to call.

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

Sidebar

Related Questions

I seem to remember at a previous job, when tracking down a certain bug
I have recently started a new job and noticed that all the SQL tables
i remember in my previous job, i needed to do data migration. in that
In a previous job, my manager suggested use of a Translator pattern for converting
Greetings all. I'm setting up a cron job to execute a bash script, and
I've inherited an old system after starting a new job, none of the previous
I have a time-triggered job which needs to retrieve certain values stored in a
I would like to make a nightly cron job that fetches my stackoverflow page
I need to run job after another job with whatever status the previous job
In a previous job we had an extensive SQLServer database that constantly had new

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.