NewsStyleTechnology

Writing code to a style guide transfers that information into the code itself.

You’re able to acclimate quickly, sidestepping the tedious process of relearning what the code does before you can start investigating the real issue. Any good style guide prescribes when and how to leave comments in code. Most developers have an aversion to comments because it seems a lot like writing documentation — and developers tend to hate writing documentation.

This is usually because writing documentation is seen as time not writing code. However, it’s the documentation that allows you to come back to code you wrote in the past and quickly get back up to speed. Another common argument against using comments is that code should be self-documenting.

In reality, there is no such thing as self-documenting code. Self-documenting code is a myth perpetuated by people who hate to write documentation. A common argument against writing comments is, “if you can’t understand my code, then you’re not smart enough.” In reality, understanding code has nothing to do with how smart a developer is, but rather providing enough context so the code make sense.

Read more about:  webeduportal

Lastly comment

Without comments, or a direct discussion with the code author, it’s very hard to get enough context. The best-understood code is littered with comments explaining key sections. You certainly don’t want a comment for every line of code, and comments must provide additional context and information that cannot otherwise be gleaned from reading the code. Here’s an example of a bad comment:

Visit this site: 9xmovies to download all kinds of latest movies.

Tags

Related Articles

Back to top button
Close