Coding in style in 60 seconds - Comments

Welcome to Coding in Style in 60 seconds. This is Dragos and you are watching a series of short videos about how we can improve our code.

This is the fifth episode when we start dealing with comments. The topic is extensive so we’ll spend few videos talking about it.

I bet you heard often something like the following:

“You should document your code.”

“The more comments the better.”

“Every variable, method and class should have a comment.”

Really?!? What if you went to a park and you found signs saying:

“This is a tree”, “That is a river”, “Up is the sky”, “Down is the grass”

Wouldn’t that be useless? Not only useless but pretty stupid? Of course, it would.

Here is the final truth about the comments: They are evil. You should never ever use them. Stay away from them as much as you can!

Except, of course, when you can’t. If you cannot in any way make your code clear without using a comment, then use it as a necessary evil.

So if you think your code needs some comments so a developer, or yourself for that matter, can understand it in 1 year from now, try first to improve the code so it does not need them.

We’ll continue this topic in the next videos.

Thank you for watching. This was the fifth episode of this series. To learn more about how to improve your code or to download for free the Coding in Style book, check our website adelante.ca.

To view or add a comment, sign in

More articles by Dragos Ionel

  • AIGeeks 2019 in review, plans for 2020

    As we’re wrapping 2019 up, we have high hopes for how AI will improve our lives in 2020. This year, we organized and…

    2 Comments
  • How can AIGeeks help you?

    As you know AIGeeks is a Non Profit trying to improve our world around us using AI. Other than organizing the meetup…

  • Be cautious with the ternary operator

    The operators in a programming language, in general, and in Swift, in particular, are of three types: Unary - that…

    2 Comments
  • Use long names when writting your code

    Unfortunately, we have been used to the fact that a name has nothing to do with the object it names. John, Mary, and…

  • Write tests

    Welcome to another post about how to improve our code. Today we are trying to prove that the quality of the code…

    4 Comments
  • How to name a function - Coding in Style - episode 11

    Welcome to Coding in style, a series of short videos about how to improve our code. This is Dragos and you are watching…

  • Reducing the cyclomatic complexity - Coding in style - Episode 9

    Welcome to Coding in style, a series of short videos about how to improve our coding. This is Dragos and you are…

  • To comment or not to comment

    Welcome to Coding in Style, a series of short videos about how we can improve our code. This is the episode 6 where we…

    2 Comments
  • Get smart by being stupid

    Do you know why programming is the best job ever? From the thousands and thousands of possible jobs out there…

  • Coding in style in 60 seconds - capitalization

    Welcome to “Coding in Style in 60 seconds”, a collection of short videos about how we can improve our code in simple…

Explore content categories