Web Excursions 2021-06-18
The most copied StackOverflow snippet of all time is flawed
Key Takeaways
Stack Overflow snippets can be buggy, even if they have thousands of upvotes.
Test all edge cases, especially for code copied from Stack Overflow.
Floating-point arithmetic is hard.
Do include proper attribution when copying code. Someone might just call you out on it.
[In 2018, a] PhD student by the name Sebastian Baltes publishes a paper in the journal of Empirical Software Engineering.
The title is Usage and Attribution of Stack Overflow Code Snippets in GitHub Projects and
it basically tries to answer one question: Is Stack Overflow’s CC BY-SA 3.0 license respected?
As part of their analysis
they extracted code snippets from the Stack Overflow data dump and
matched them against code from public GitHub repos.
No, most people do not include proper attribution.
That answer at the top with id 3758880 happens to be the answer [the author] had posted eight years earlier.
At this point the answer had over a hundreds of thousands of views and over a thousand upvotes.
The most copied StackOverflow snippet of all time is flawed (2019)
ddlatham [the author of #6 on the said list]: 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.
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.
To measure the quality of an item, we should look at the number of votes, divided by the number of views.
jsmeaton: "The community" [should be able to] vote to override an accepted answer. It'd incentivise writing newer answers to older questions.
saganus: I can't sort answers [on SO] by newest first.
apnorton: There are three buttons that act as sorting directions at the top of the answers section: "Votes," "Oldest," and "Active." The "Active" option sorts by most recently modified, which is usually what you'd want instead of strictly newest.