CodeIgniter Forums
Comments and explanations - how to do it better? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: Comments and explanations - how to do it better? (/showthread.php?tid=64066)

Pages: 1 2


RE: Comments and explanations - how to do it better? - ivantcholakov - 01-14-2016

My philosophy is this: Forget about that code will be executed by a computer. You write code so it to be read by another human being. Writing code is social communication first of all.

Too much comments, especially about obvious things is not good. A person could easily understand what code does, comments should answer to why. Express your motivation or rationale why are you doing this or that.


RE: Comments and explanations - how to do it better? - PaulD - 01-14-2016

(01-14-2016, 06:48 AM)ivantcholakov Wrote: Writing code is social communication first of all.

That is the best explanation I have read yet.

"Writing code is social communication first of all."

That is brilliant - thank you.

Paul


RE: Comments and explanations - how to do it better? - Narf - 01-14-2016

(01-14-2016, 08:11 AM)PaulD Wrote:
(01-14-2016, 06:48 AM)ivantcholakov Wrote: Writing code is social communication first of all.

That is the best explanation I have read yet.

"Writing code is social communication first of all."

That is brilliant - thank you.

Paul

That's a huge stretch, but the general idea is true indeed - if it was only intended to be read by a machine, it would be binary and not human-readable.