DEV Community


Discussion on: The Importance of Quality Comments

donut87 profile image
Christian Baer

Comments should not try to tell you WHAT you are doing (checking if we have an app token). This can easily be done by creating a short method 'hasSessionAppToken'. The amount of information stays the same. This can be done with all comments in the example starting with 'Create'. Why isn't that method called 'CreateSessionFromAPIDate'?
This kind of commenting leaves to things like
// returns name of person
public String getName(){return}

So please... Do not write comments that explain me WHAT you are doing, except it cannot be done in an obvious way. Do write comments on WHY you did things this or that way.

Forem Open with the Forem app