Hacker News new | ask | show | jobs
by saas_co_de 3127 days ago
Right, it is not about whether or not the code is complex and difficult to understand.

That is the traditional (and bad) commenting advice: that you should add comments to code that is difficult to understand.

The point of commenting everything is to allow the program to be understood entirely from comments, so that when you are maintaining a code base you rarely have to read code, and instead are working with native language.

I would comment your example like this:

  // complete purchase process
  this.completePurchaseProcess(paymentInfo)
When you have "complete purchase process" written out as english words you can process that much more quickly than "this.completePurchaseProcess(paymentInfo)"
1 comments

How often do you actually read through the code, trying to understand what's happening and you need english language? Once you read an english description - do you still often have to look at the code to understand what is really happening? //complete purchase process - what does that mean? When you look at the method, I see exactly what's being called and with what parameters.