Live data from Hacker News

Please do not attempt to simplify this code

github.com

1–10 of 647 posts

Re: Please do not attempt to simplify this code

#3
The comment:code ratio is higher than anything I write or that I’ve seen.

However, it does give me some comfort. When it’s not gamed, do other HNers also feel that a high comment:code ratio probably indicates quality?

There are reasons why this may be the case. (More thought, more time and a large team etc)

I don’t advocate using this measure to reward anyone because it would be gamed immediately.

Re: Please do not attempt to simplify this code

#4
A code style with lots of verbose if statements? Go is the perfect language!

More seriously I’ve done this style unintentionally before in JavaScript for a similar situation with plenty of branching logic. Stuff that easily could have been have the lines but not as easy to verify by hand. I’m happy to see it being formalized for certain scenarios.

Re: Please do not attempt to simplify this code

#7

The comment:code ratio is higher than anything I write or that I’ve seen. However, it does give me some comfort. When it’s not gamed, do other HNers also feel that a high comment:code ratio probably indicates quality? There are reasons why this may be the case. (More thought, more time and a large team etc) I don’t advocate using this measure to reward anyone because it would be gamed immediately.

I think it's likely to indicate low quality. Comments are for where the code wasn't clear enough.

Re: Please do not attempt to simplify this code

#8

The comment:code ratio is higher than anything I write or that I’ve seen. However, it does give me some comfort. When it’s not gamed, do other HNers also feel that a high comment:code ratio probably indicates quality? There are reasons why this may be the case. (More thought, more time and a large team etc) I don’t advocate using this measure to reward anyone because it would be gamed immediately.

Maybe a loose correlation? Highly commented code was probably not written under tremendous time pressure; uncommented code can go either way. Wrongly commented code is painful, though.

And then there's something I recall running into, a decade ago:

    using namespace std; // using namespace standard

Re: Please do not attempt to simplify this code

#10

The comment:code ratio is higher than anything I write or that I’ve seen. However, it does give me some comfort. When it’s not gamed, do other HNers also feel that a high comment:code ratio probably indicates quality? There are reasons why this may be the case. (More thought, more time and a large team etc) I don’t advocate using this measure to reward anyone because it would be gamed immediately.

I actually would say it’s almost the opposite, if you’re writing clean, expressive code it shouldn’t need explaining.

And if your code is clean, you shouldn’t have a bunch of redundant comments explaining the obvious.

Post reply on HN