by OtterCoder · 8y ago · 0 comments
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.
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.
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.