Hacker News new | ask | show | jobs
by wfunction 4367 days ago
I think you might've misunderstood what I'm saying. It's perfectly fine to have complex functions commented as much as necessary; heck, it's totally fine to have your comments be 100x as long your function when the function is actually hard to understand.

What's not OK is commenting ALL of your code, especially not to such an extent where the comments are actually longer than the code size on average. (!) Some stuff just has to be self-explanatory, period -- that's a fact, not a meme. If you can't make the simplest code self-explanatory, then I'm sorry but you simply can't code as well as someone who can. And if you're going to comment everything, then you're also wasting valuable time that someone who didn't need to do so would've spent writing actual code and getting more done.

1 comments

I understand what you are saying perfectly, but you typed "you are putting in too many comments" as a possibility, full stop. All of that context you just painted for me is not in your comment. That's how "never rewrite because rewriting is bad because reasons" gets started.

And absolutely I think commenting all your code is okay. I honestly wish literate programming had caught on.

Well, quantity can be measured in different ways. I didn't say "your (individual) comments are too long"; I said "you have too many comments" (aka the total length of your comments is comparable to the total length of your code... i.e., your source files are on average more comments than code). Too many comments (even short ones) is generally bad; they make the code harder to read, not easier. A few long comments are generally good. I feel like you were addressing a different point than I was making.
> Too many comments (even short ones) is generally bad;

That's exactly what I'm refuting, so I'm not sure why you keep talking past me. I am speaking to the crazy notion that there is a par for the comment golf course, and we all have to be Goldilocks as we write software. I don't know where that started, but I'd love it if people stopped judging software based upon the non-executable portions.

A line before every line? Maybe. Are they comments of quality? I've put a comment on every line of assembly before as a postfix. There is no hard and fast rule on this, and I wish people would stop trying to make one.

Again, literate programming. I feel like you're missing how serious I am about this by overlooking my repeated love for it.

Well in that case, there's nothing crazy about it. If I can hire someone whose code is reasonably self-explanatory vs. someone who puts comments all over their code (whether or not it's self-explanatory), I'm certainly not going to choose the second one over the first one, not sure about you.
You just said if I took the same self-explanatory code and added comments to it that you deem unnecessary you'd no-hire me as a result. And yes, that is absolutely crazy, and has been my point throughout this entire thread.

Please do me the respect of researching literate programming before attempting to extend this thread, because I can tell you're unfamiliar, just based on how many ways you're trying to slice and dice a chink in my opinion on this.

Notice I never even mentioned the phrase "literate programming" when responding to you? It's because I'm not trying to debate programming philosophy here, I'm trying to address a practical/immediate concern of the OP. I can debate with you day and night about what programming methodology is best, but that's not what the question here has been about, and I'm doing my best not to divert the discussion into a different direction.

The debate has been about why the OP's code was considered poor by the employer, and I think putting too many comments might have been such a reason. Whether or not you think putting too many comments is good or bad is orthogonal to whether or not it might have been a reason for rejecting the OP as a candidate. I think it's a reason for avoiding hiring the OP (see my previous discussion about productivity and wasting time writing comments), and whether you feel it's actually justified by some "good" coding methodology is orthogonal to whether or not the employer might have used the same rationale as me, and that's all I'm trying to address here. If you feel the employer's rationale was unjustified or crazy, then so be it; that doesn't mean the employer couldn't have had this thought process anyway.