Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you have a bit of a bias coming from Javaland. Java code is incredibly verbose for the sake of allowing the developer a thousand places to write self documenting code. It's a slog to write, but easier to read, by far.

In functional languages, a single filter-map-fold can accomplish what might take half a dozen classes in Java. In those circumstances, a line or two of comments explaining the rough idea of what's happening is essential. You might argue that it's a regression to the bad-old-days of obtuse C, but the power of the paradigm more than makes up for the extra need of documentation.

Also, would you penalize a developer for commenting cleanly written code? No attempt to communicate clearly should ever be discouraged, especially in a discipline so rife with miscommunication as ours.



Yes, my son is currently writing a lot of functional code and complaining when I force him to do something in Java. It bothers me that we see the verbosity of Java as a detriment and then say we should add comments to functional languages.

Don't get me wrong, I strongly believe in the appropriate functional approach where it's beneficial, but I strongly believe that it needs to be as self explanatory as Java code, otherwise you get the same staleness problem with the comments that led to the elimination of them initially.

With regards to whether someone should be penalized for extraneous comments, if the comment is necessary then it indicates a code problem. If unnecessary it's subject to becoming out of date or erroneous. So, yes, I stand by my contention that if you add comments to code in the majority of cases you should be penalized.

It took me a long, long time to change my view on this so I understand where people are coming from. I also require my beginning students to comment just so I can try to understand what they are doing so my position is not absolute. But given the choice between a developer who communicates clearly in code and knows it and one who either needs or believes he needs comments I'll choose the first.


> But given the choice between a developer who communicates clearly in code and knows it and one who either needs or believes he needs comments I'll choose the first.

This really just reads to me like you're selecting for hubris over humility, which is not likely to get good results over the long term. Give me a coder who doubts his code any day, over someone overconfident.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: