The most copied StackOverflow snippet of all time is flawed (2019)
I'm the author of #6 on the same list.  It's definitely interesting to see it has been used thousands of times on GitHub, and who knows how many more in proprietary code.  I don't think it's buggy, but I now think it could definitely be improved.I think this shows an example of a big problem with StackOverflow compared to its initial vision.  I remember listening to Jeff and Joel's podcast, and hearing the vision of applying the Wikipedia model to tech Q&A.  The idea was that answers would continue to improve over time.For the most part, they don't.  I'm not quite sure if it's an issue of incentives or culture.  Probably some of both.  I think that having a person's name attached to their answer, along with a visible score really gives a sense of ownership.  As a result, other people don't feel enabled to come along and tweak the answer to improve it.Then, once an answer is listed at the top, it is given more opportunity for upvotes, so other improved answers don't seem to bubble up.  This is a larger issue with most websites that sort by ratings.  Generally they sort items based on the total number of votes, including hacker news itself.  Instead, to measure the quality of an item, we should look at the number of votes, divided by the number of views.  It may be tough to measure the number of views of an item, but we should be able to get a rough estimate based on the position on a page, for example.If the top comment on a HN discussion is getting 100 views in a minute and 10 upvotes, but the 10th comment down gets 20 views and 5 upvotes, the 10th comment is likely a better quality comment.  It should be sorted above the top ranked comment!  There would still need to be some smoothing and promotion of new comments to get them enough views to measure their quality as well.Such a policy on StackOverflow would also help newer, but better answers sort to the top.