Should production code have comments?

Should production code have comments?

Production shouldn’t have comments in it, but only because some sort of preprocessor like Webpack should be used to remove them. Dev comments should be the same as prod comments, because the only other people seeing your comments will be developers.

What percent of code should be comments?

We have a ratio of 2-3%, which is too few. I think that 10% is good for large or long lived projects. Sorry, there is not rule of thumb. Frameworks and libraries, per instance, requires much more comments because programmers will be customers and haven’t time to read code every time they need to invoke a method.

What are various coding standards and guidelines?

What Are Coding Rules and Guidelines?

  • Safe: It can be used without causing harm.
  • Secure: It can’t be hacked.
  • Reliable: It functions as it should, every time.
  • Testable: It can be tested at the code level.
  • Maintainable: It can be maintained, even as your codebase grows.
  • Portable: It works the same in every environment.

What are the best practices for commenting your code?

5 Best Practices for Commenting Your Code 1 (1) Comments are not subtitles 2 (2) Comments are not an art project 3 (3) Header Blocks: Nuisance or Menace? 4 (4) Comments are not source control 5 (5) Comments are a code smell

Are there standard formats for comments within code?

Comments standards are most useful when the comment will be parsed by an external tool (usualy, a document generator, like javadoc). In this case, the external tool will state the standards. For other cases, see How do you like your comments? (Best Practices) If you are paranoid and don’t use or trust source control, you might do this

How to comment on a source code document?

Documents are typically referred to as “Source code style policy” or something. It is very important to adhere to one common style in commenting the code. Of course this commenting hype shouldn’t go too far as to comment every little piece of code, especially the obvious ones.

How to write comments in a Java program?

By then you will realize how silly it is to write comments like these: // Loop through all bananas in the bunch foreach(banana b in bunch) { monkey.eat(b);  //make the monkey eat one banana } You may have been taught to program by first writing  pseudo-code comments then writing the real code into that wire-frame.