Use Code From Stack Overflow? You Must Provide Attribution (stackexchange.com) 303
An anonymous reader writes: Have you ever used Stack Overflow to answer a question about some code you're working on? Most people who write code on a regular basis have done so, and this sometimes involves copying code snippets. Well, starting on March 1, copying code from Stack Overflow will require you to attribute that code. Code published by contributors to SO will be covered by the MIT license. Users copying that code don't have to include the full license in their code, as it usually requires, but they do have to provide a URL as a comment in their code, or some similar level of attribution. This change applies to other sites in the Stack Exchange network, as well.
The SO community is widely criticizing the change, citing problems with the decision-making process that led to it and complications that may arise from mandating attribution. Why did SO make the change in the first place? They say "it's always been a little ambiguous how CC-BY-SA covers code. This has led to uncertainty among conscientious developers as they've struggled to understand what (if anything) the license requires of them when grabbing a few lines of code from a post on Stack Exchange. Uncertainty is a drag on productivity, for you and for us, and we feel obligated to make code use more clear."
The SO community is widely criticizing the change, citing problems with the decision-making process that led to it and complications that may arise from mandating attribution. Why did SO make the change in the first place? They say "it's always been a little ambiguous how CC-BY-SA covers code. This has led to uncertainty among conscientious developers as they've struggled to understand what (if anything) the license requires of them when grabbing a few lines of code from a post on Stack Exchange. Uncertainty is a drag on productivity, for you and for us, and we feel obligated to make code use more clear."
No. (Score:5, Insightful)
If I offer you some code in an answer, that's for you. I'm not going to require you credit me or some site for the few fucking lines that would come through on stackoverflow.
So instead of dealing with that bullshit, I just won't use stackoverflow again.
Fuck them. Fuck their CoC. Fuck their SJW bullshit, too.
Re: No. (Score:5, Insightful)
Anyone intelligent enough to provide useful solutions already knows anything they post on something like stackexchange is public domain. If contributors wanted money and or attribution, they wouldn't have posted a solution to begin with.
This is idiotic and overly complicated. I want to meet the "developers" concerned about the 'foggy' licensing terms for code/solution approaches posted on stack exchange.
Goodbye stack exchange. You've shot yourself in the foot.
Re: (Score:2)
Re: No. (Score:4, Interesting)
I typically put
#taken from http://stackoverfl......
in my code anyway, just as a reminder of where it came from, but only if it's particularly complex. I don't always of course. This change is kinda retarded though. I don't want to be forced to do that every time.
Seems to me... (Score:4, Insightful)
...that if they require this, it is edging towards some kind of implicit acceptance of responsibility for that code.
If I use code from a forum, offered freely, and burn down my stuff, it's on me.
If I use code from a paid source and it burns down my stuff, it's on them.
If I use code from a forum, but I have to attribute that code in mine, then ???
I would dismiss that conclusion right off the bat. But you give some lawyers even the slightest rationale, it's off to the courts you go.
Re:Seems to me... (Score:5, Informative)
From the MIT license (similar wordings can be found in other licenses)
the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
I'm pretty sure no damn lawyer can get around this. No sane lawyer anyway.
Re: (Score:2)
I have a feeling that sometime in the future, language like his will be found to be invalid.
It's about the same as selling a car and claiming that you can't be held liable if there is something wrong with it. If you are paid money for code your wrote to perform a function, and it fucks up and wipes out something else, it should be on you. sure, it's a bit more complicated than a car, but the principle should be the same.
Re: (Score:2)
I agree to a certain degree, but you're not paying for anything on StackOverflow, at least not that I've seen.
Re: (Score:2)
Non-dealership personal sales of cars, unless explicitly stated in a contract, are sold caveat emptor.
This is the exact same thing as using code from some random area on the 'net. The car may look like it should last, but if you didn't either check out the engine yourself or take it to someone who can check it for you, you can't complain about how the transmission fell out and the engine stopped working by the time you got halfway home... you bought it "buyer beware". It is on the buyer / recipient to mak
Re: (Score:2)
So...Microsoft is the same as a sleazy used car dealer? :-)
Re: (Score:2)
So...Microsoft is the same as a sleazy used car dealer? :-)
after reviewing the evidence
https://youtu.be/sforhbLiwLA [youtu.be]
https://www.youtube.com/watch?... [youtube.com]
yes they are
Re: (Score:2)
Non-dealership personal sales of cars, unless explicitly stated in a contract, are sold caveat emptor.
They're sold with basic protections in place, and sellers are required to:
Not intentionally misrepresent the car - no rolling back the odometer, no claiming it's got features it doesn't have, no falsely claiming you put in a new transmission last month, etc.
Disclose anything they know of that is a safety issue - no selling a car with no brakes without disclosing that.
Even when you throw in "as-is" on a ad / contract / bill of sale, the seller is still forbidden from committing outright fraud and can still b
Re: (Score:2)
Wow, someone's got an axe to grind. Use my whetstone, my good man.
Re: (Score:2)
Social Justice Warrior
He is not asking what the acronym means. He is asking what it has to do with Stackoverflow. I have no idea. I use SO regularly, and have never seen race, gender, or sexual pref mentioned.
Re: (Score:3, Insightful)
There seem to be a fair number of anonymous Slashdotters who see the shadow of the Social Justice Warrior Boogieman behind every rock and shrub.
Or perhaps it's just one guy who's on the site 24/7.
Re: (Score:2)
"GGers" are not the only ones that use the SJW term, etc.
You should be anyways (Score:5, Insightful)
You should be anyways, but not for the reasons that you might think.
I always include a link in comments to the source of the borrowed code (or approach), because the relevant discussion will illuminate the how and why far better than a large block comment.
Re:You should be anyways (Score:5, Insightful)
I always include a link in comments to the source of the borrowed code (or approach), because the relevant discussion will illuminate the how and why far better than a large block comment.
5, 10, or 15 years from now a 404 error illuminates nothing.
If the snippet really needs/benefits from the explanation/discussion, I usually save the page / article to PDF, with url in the header, and include that in the project, and then reference that file in the comments.
I've run into enough 404 errors over the years, where the site I originally referenced is gone, or reorganized (Microsoft for example) or have gone to a paywall model, or even cases where the article has been edited or altered; or taken down by the author so he could posted an updated one or any other reason.
I don't object to the concept of linking to the live article, but I'm not willing to take the chance that it won't be there if i ever need it.
I've never really considered whether the practice raises its own copyright issues. It probably does... so I guess it won't work where the source is being redistributed. Which is unfortunate really.
Re: (Score:2)
I agree. In fact, when I read the summary I was dumbfounded by the idea that someone would grab code off the Internet without adding a comment along with it explaining what it does and its origin. What happens when you look at the code again in 6 weeks, 6 months or another developer comes along after you and has to maintain/modify it?
I find this also very helpful in the case where the borrowed approach is not otherwise consistent with the style and architecture of the project.
Re:You should be anyways (Score:5, Insightful)
I think the problem is less with attribution -- as so many people are pointing out including a link is a basic part of code documentation -- and more with pretending to have authority to license the code that is posted.
Consider a few situations:
If someone posts public domain code, then SO is claiming that they can take the code out of the public domain. While a government can pass a law to do something that idiotic, SO lacks the authority.
If someone posts proprietary code without permission, then SO is claiming the code is free to use as long as you provide attribution -- even though they have no authority to do so.
The right thing for SO to do is encourage the obvious -- link because it is a basic form of documentation, but don't pretend to provide a license.
They should take pains to point out they are not responsible for the posts of its users and provide a "take down" mechanism so that if code is misappropriated then the answer providing it can be marked as such. By using the link as documentation, someone maintaining code would have a chance to discover that proprietary code had been misappropriated and take appropriate action.
Re: (Score:2)
If someone posts proprietary code without permission, then SO is claiming the code is free to use as long as you provide attribution -- even though they have no authority to do so.
Erm, they have authority to do so.
First of all: regardless if the code is proprietary or not: it is still just a "quote",
secondly: the one who made the error is the one who posted it on SO,
thirdly: "free to use" as in respect to to SO, most certainly!!
So to resolve it, SO only has to remove it, on request of the original author/co
Re: (Score:2)
You're also conflating "ownership of the code" with "enforcement of terms of service" and "standardization of licensing" for contributed code. Basically all they're saying is if you contribute code it will be licensed to the community under the MIT license. If you use that code you're required to abide by the MIT license - except that they're giving you an exception if your use of the code is somewhere near the border of "fair use". In that case, you can just attribute the code in the comments rather than
What's the big fuss? (Score:5, Insightful)
Re: (Score:3)
Re: (Score:2)
Re: (Score:2)
If only the Germans had thought of fuzzing their text instead of building that silly Enigma machine ...
While I can't quite prove you're not a math major from that one post alone, it strikes me that in this instance proof is unnecessary.
Corollary of Sturgeon's law: 99% of everything is judged by smell. It takes more than a teaspoon of Tide to wash the shit off a turd.
Re: (Score:2)
Re: (Score:2)
Of course, this works well as long as the site is going to still be online in 5 (10? or 20?) years time and still have the same URL structure.
You can say that pretty much about everything. Documentation will become stale in much less than 5 years, and it requires revisiting (which includes pruning of things that are no longer applicable.)
You document what you know/need NOW, making references to exist NOW to the best of your knowledge, with an expectation that code AAAAAND documentation will evolved and be maintained/pruned/decomissioned.
We are not writing documents to be cast in stone for eons to come man.
Re: (Score:3)
Practically speaking this amounts to guidelines (Score:5, Insightful)
People and companies that have a policy of sticking to the spirit of a licence agreement as well as the letter will appreciate having some rules to know that what they're doing is acceptable.
Re: (Score:2)
In many (most?) cases, the only reason the code could even be on Stackoverflow is that the snippet would fall under fair use.
And, in the cases where the ownership can be traced to somewhere else, why couldn't someone attribute it to the original source rather than Stackoverflow?
Re: (Score:3)
I doubt it'll impact me in the slightest. I use it to find workarounds to consuming complicated APIs and even the stuff I paste gets refactored beyond recognition from the original. To me, how to integrate with Oauth is a statement of fact with hundreds of examples, and by the time I've customized it for my needs good luck finding anything that might be its source.
Re:Practically speaking this amounts to guidelines (Score:5, Insightful)
It's going to be a problem, because of all the code that's already there. Merely republishing it under MIT will not negate the fact that tons of solutions were already available in the public domain, and cannot be removed from PD no matter what you do. Once PD, always PD.
And what if I add to my submission "//This code is released into the public domain"? Does that invalidate the requirement? Are they going to delete my submission because of it?
SO's own answer says "CC"...or not... (Score:5, Informative)
Here's an actual debate on this topic on SO:
http://meta.stackexchange.com/... [stackexchange.com]
Accepted answer: Anything that you post to Stack Overflow will be under the terms of the Creative Commons license
Top comments seems to be about using "Unlicense" (instead of "Public Domain") and to just avoid cut-paste (good luck with that if you're dealing with an offshore team). I pretty much use #2, renaming everything and usually swapping some of the decision logic to create something that looks original enough to pass a smell test when I cut/paste. It's work, but it's still significantly less work than writing it from scratch.
Re: (Score:3)
Yeah, I almost always change variable names to match my conventions and will add some extra validation usually.
I am not sure why SO needs to specify this at all though. I mean, people are putting code out into public space with the intention that others will copy it... that's the whole point...
That said, I usually do keep any comments that were in the code snippet to begin with.
Re: (Score:2)
Re: (Score:2)
Anything that you post to Stack Overflow will be under the terms of the Creative Commons license
But which Creative Commons license? They range from CC0 (effectively Public Domain) all the way down to CC-BY-NC-ND, which is one step short of "all rights reserved" and not really a contribution to the commons in any meaningful sense. The one thing they all share is that you can distribute the work non-commercially with attribution in its original form—which is rarely a useful set of terms when applied to incomplete snippets of source code.
Re: (Score:2)
Here's an actual debate on this topic on SO: http://meta.stackexchange.com/... [stackexchange.com]
Accepted answer: Anything that you post to Stack Overflow will be under the terms of the Creative Commons license
Top comments seems to be about using "Unlicense" (instead of "Public Domain") and to just avoid cut-paste (good luck with that if you're dealing with an offshore team). I pretty much use #2, renaming everything and usually swapping some of the decision logic to create something that looks original enough to pass a smell test when I cut/paste. It's work, but it's still significantly less work than writing it from scratch.
There's a quote from Jeff Atwood in that debate that I think is very relevant - "I would hope that people are not posting giant blocks of code at SO, making it more of a quote / fair use type situation.".
That's the way I view anything I post on SO; they are just code fragments to illustrate a concept or a language quirk and not something I feel the need to claim ownership over. And that's also how I read SO; I'm looking to learn, not copy/paste big chunks of code. If folks are really posting blocks of code
Re:SO's own answer says "CC"...or not... (Score:4, Informative)
What the Slashdot summary doesn't say (and a lot of commenters on meta.stackexchange.com also didn't really take into account) is that this licensing change affects not only StackOverflow but the whole StackExchange network, including sites like Code Review [stackexchange.com] and Programming Puzzles and Code Golf [stackexchange.com] where people do post substantial blocks of code over which they wish to assert their moral rights.
Re: (Score:2)
>> I'd have second thoughts about employing a programmer who passes off other people's work as his own.
Then you probably don't know what programmers DO. What I think you are looking for instead are "artists." :)
For westlake and others new to the industry, please understand that all programmers do, all programmers EVER do, is take other people's work in the form of hardware, operating systems, libraries, other programs, and pass it off as our own through...da da dum...programs! Programmers who consta
Re:The smell test. (Score:5, Funny)
have you tried hand-coding a web app from scratch these days?
That was my hobby project for last weekend. I had trouble getting the strong nuclear force to condense from electroweak, then I divided by zero and the whole thing gravitationally collapsed! It took me a few hours to get the dark matter out of the carpet. I'll give it another try this weekend. I'm not certain if I should keep going with 11 dimensions or try with 9, but my problem is probably a set of fundamental operations in the number theory I'm using that gives division by zero a logically consistent value. I'll try again with infinity as an asymptote instead of a value and let you know how it goes!
"In order to make an apple pie from scratch, you must first invent the universe." --oblig
This is about money. (Score:3, Insightful)
This is about money and maybe ego. A combination of what some shortsighted idiot thinks of as free advertising and maybe some ego-hungry folk involved in the decision-making who feel the need to be cited.
And it will start moving every major company away from stackoverflow. You can't be putting snippets of other people's code in your product with attribution because you're going to be making lawsuits and licensing that much more complicated. People who worry about those things will use stackoverflow less and less.
Stackoverflow has a great network effect from all the users. But stuff like this will make anyone who brings another game to town look a lot more attractive.
What kind of code? (Score:3)
For me it always came down to what kind of code it was. If it was "I know what I want to do, what's the right/best way to express that in $LANGUAGE / using $FRAMEWORK?", we're talking about just mechanics. If I was looking for how to do something, where I needed the actual algorithm or data structure rather than just "What's the syntax?" or "Which operator's best?", that's getting into the creative side where you need to at a minimum do attribution. Almost all of what I get off of SO falls into the first category.
Citation is a form of professional respect (Score:5, Insightful)
Perhaps it's because I'm an academic and my use of Stack Exchange relates to my research projects, but I'm having a hard time understanding why people would object to citing the source of a snippet of code. I have always cited and linked to the profiles people who were kind enough to help me with my code on Stack Exchange, not out of license obligation, but out of professional respect.
In academia, citing the work of others is commonplace. It's super easy to insert a comment in your code with a link. Putting the licensing and legal interpretations aside for a moment, why wouldn't you just want to do this out of respect for another professional?
Reply to This Share Flag as Inappropriate
Re: (Score:2)
The objection is not to citing others when you use their code: the objection is to the way Stack Exchange is requiring you to license your code. The most repeated theme of the criticism is "If you're going to change licence, change to a proper one rather than a kludgy homebrew variant which allows people to just copy the code, add a URL, and call it attribution".
Re:Citation is a form of professional respect (Score:4, Interesting)
Perhaps it's because I'm an academic and my use of Stack Exchange relates to my research projects, but I'm having a hard time understanding why people would object to citing the source of a snippet of code.
I take the opposite position - I wonder why people even bother with attributions for little scraps of paper, half-formed ideas, and answers to questions.
For one thing, if it's on StackExchange it's common knowledge. Do you cite Newton or Euler when you solve an integral in your paper?
Secondy, StackExchange doesn't cite *their* scraps of code. That 6 lines of code that connect to the SQL server - it's just information from the manual that the reader could have gotten for themselves. Does StackExchange cite the manual?
Thirdly, it generates fear and doubt in the minds of pointy-haired bosses, thinking that an external license reference will dilute the software value. Possibly require the company to publish the code for anyone else to copy. (Whether this is true is irrelevant - it's the perception of many people.)
Fourthly, the attribution is extra administrivia and work that adds nothing to the code. It has to be ignored and skipped over by everyone who reads or maintains the code in the future, it goes into backups and changelogs. It's litter for programs.
Fifthly, there's no possible way that value or esteem can attach to the writer. Having some sort of value or utility is the reason that rational beings do things, so why should anyone bother doing something that could not possibly reward the writer?
Perhaps it's because I've read too many papers that are a thicket of cryptic citations referencing everyone else's work, but with very little to add. For example, see Crumbum and Whoodle (1985), but Finnaster and Welsch (1992) take a counter position that might throw more light on the subject.
For a relatively complete overview of the theory and reasoning behind citations, see Finbum.
Re: (Score:2)
Do you cite Newton or Euler when you solve an integral in your paper?
Actually you are required to do that for every single math task in a math test in university.
So I really wonder where you have studied that you think otherwise.
Apropos of nothing, when you took your test, who did you attribute when you used integration by parts?
You might mention "step 3 follows from Jenson's inequality" or other reference, but in general one doesn't attribute the step as much as explain the step.
You're confused. Identifying the reason behind each step is distinctly different from attribution.
Re: (Score:2)
The short version is that the company doesn't care who wrote the code, they care who owns the code. All work for hire is copyrighted by the company, having who wrote it in source control is just to aid the development process or place blame. That means everybody can grab any piece of source and do whatever, very rarely do you see inside sources mentioned. Once you have code that is not yours and not distinctly separated in a third party library as being someone else's you have to keep track of it. What if a
Re: (Score:2)
Re: (Score:2)
I'm having a hard time understanding why people would object to citing the source of a snippet of code.
They are embarrassed that they had to look up the answer on Stack Exchange and don't want other people seeing the code to know. Personally I don't care, it shows I saved time by no re-inventing the wheel, and provides a helpful reference back to discussion and notes that might be useful later.
Re: (Score:3)
Citing the original source of snippets in the source code is fine, and is actually pretty useful, because when somebody goes and reads the source later, it helps explain why somebody did something. It also gives the creator credit in front of people who would actually appreciate and understand why their snippet is cool.
Citing the original source of snippets in a closed-source app is more problematic, because it tells the end user absolutely nothing other than that a tiny snippet of code exists somewhere i
Re: (Score:3)
How do you govern the copying of pseudocode? (Score:3)
Licensing someone elses code without permission (Score:5, Insightful)
99.999999% of the code posted to StackOverflow didn't originate with the person who's posting it.
Most of it is just someone spitting out what they learned from someone else, and in most of the situations, the most upvoted answer is the common sense and only real solution to the problem presented, thats why it gets voted to the highest/accepted as the answer.
SO doesn't really have the right to force a license on the code posted there, they are pretending to worry about people using the code, but ignoring the broken part of the people posting the code.
It's not for legal reasons (Score:2)
ownership (Score:2)
Attribution is needed in source only, not license (Score:4, Informative)
This sounds perfectly fine to me--in general, I and my team already does this because it's helpful to know WHY we chose a course of action, especially when it was complicated enough to require SO's help.
http://meta.stackexchange.com/... [stackexchange.com]
What is reasonable attribution?
A URL as a comment in your code is reasonable attribution.
There are certainly other forms of reasonable attribution, depending on use, and you are welcome to go above and beyond what’s required and include username, date, and anything else if you like.
You are also welcome to use the MIT License as it is traditionally interpreted: by preserving the full license with relevant fields (copyright year and copyright holder) completed.
Depends on whether the answer is trivial or not (Score:2)
SO has required attribution for 8 years (Score:5, Informative)
Guess what: it requires attribution.
It's not totally clear how that's supposed to work when applied to code, but it's crystal clear about the requirement itself. The proposed MIT change is aimed at making this more obvious, but... If you aren't already giving credit where it's due, then that's on you - the license has always demanded that.
You might wanna read up on the "share alike" bit too...
P.S. I work for Stack Overflow.
Re: (Score:2)
I, for one, welcome our Stack Overflords.
PS: I, too, work for the beast^H^H^H^H^H Stack Overflow
This isn't about attribution... (Score:2)
It's about SO trying to more eyes on the site and raise their ad revenue further.
"Hmm, where did the dev get this code? Oh, I see, from SO. Let me go to the link and see what else was said..."
Anyone who buys that "we're only thinking of the code submitters' rights" crap is just fooling themselves.
Attributions (Score:2)
@attributions
- The C Programming Language 2nd Edition
by Brian W. Kernighan and Dennis M. Ritchie
for help on the printf statement.
- Linux man-pages project for parameters to the
strftime function.
- Professor Steve Sherman for the first class using C.
- Professor John Wirth for general programming
skills being taught.
- Bill Joy for developing the vi editor in which this
code was produced.
*/
Re: (Score:2)
You forgot to thank your Mom.
It doesn't work that way, Stack Overflow... (Score:2)
And when I write up a
That's just common decency (Score:2)
And professionalism. Then again, most programmers aren't professionals so the whining is not unexpected.
I already do (Score:2)
When I copy code from StackOverflow, if it's more than one or two lines, I include a reference to the source page. If only so the programmers who work on my code after me know where it comes from and why it is the way it is.
Re: (Score:2)
A few lines of code isn't likely to qualify (Score:2)
Wow, an uprise about: law and moral ... (Score:2)
So,
you "copy/paste" code from the internet and never did attribute/mention the original author?
And now a web site makes it a requirement in the "terms of usage" that you do so?
And: you never figured before hand that this is
a) the polite thing to do
b) the fucking law
c) in every damn book where people "quote" something "under fair" use for "science" or "educational purpose" the author is mentioned (otherwise it would be no fair use anymore), but if you copy/paste from SO or similar you don't think it would b
Now if there was only some guarantee of quality (Score:2)
I don't know how many times I've seen piss poor code upvoted as the correct answer. Sure, most of the time it works but will have obvious errors, poor coding, men leaks, etc. In almost all cases I end up rewriting the code anyway.
Attribute to the Individual, but why SO? (Score:2)
SO is implicitly claiming rights in the code posted by its users. I'd check their terms of use.
Author Workaround (Score:3)
Authors of the code snippets who understand that (regardless of ideology) this is not practical for most people who code for a living... can just re-post a link to their code as a gist, pastebin etc with an MIT / BSD / WTFPL license.
For those wondering about derivative license compatibility issues: remember that as the sole author you have the right to use as many licenses as you like unless exclusivity is part of your job/contract. I don't think Stack Overflow can force this requirement on a user without breaking their rights in most countries.
My practice anyways... (Score:2)
... if I pull code or a solution from an Internet source, I always include the attribution. I don't do it for the author's benefit. I do it because it can be helpful to someone else reading my code in the future.
That's pretty much what I do already (Score:2)
Has been Postponed (Score:3)
Update: January 15, 2016 Thank you for your candidness, patience and feedback. We're going to delay the implementation for now - we'll be back soon to open some more discussions.
So it's not been taken off the table, but it probably won't happen anytime soon.
Re: Fuck 'em (Score:5, Funny)
This. I'm moving all my queries to expertsexchange.
Re: (Score:3, Funny)
Hell no. You'd have to cut off my balls before I would do that.
Re: Fuck 'em (Score:5, Funny)
Hell no. You'd have to cut off my balls before I would do that.
That would be amateursexchange.com.
Re: Fuck 'em (Score:5, Funny)
This. I'm moving all my queries to expertsexchange.
Is this the site where you post all your gender identity issues?
Re: Fuck 'em (Score:5, Funny)
Re: (Score:3, Insightful)
This. I'm moving all my queries to expertsexchange.
Why? What will happen if you don't? Are the source code attribution police going to come by and arrest you? You know what I'm going to do in response to this? Nothing. Absolutely nothing. We Americans have become far too accustomed to doing what we're told like good little boys and girls. Whatever happened to ignoring or getting around stupid rules and laws? Our grandparents and their parents did it, why don't we? In America anyone can sue you or your company at any time for any reason. Being a perfect boot
This is the least of the problems with SO. (Score:5, Insightful)
Of all of the problems plaguing SO, this attribution crap is the least important of them.
The awful moderation is by far the biggest problem. It's so frustrating to ask a perfectly good question, get some good answers to it, and then later on some micropenised moderator comes along and starts muddling with the questions and answers just to make himself feel like his micropenis isn't as small as it is.
Moderation online just makes things worse. Doesn't matter if it's SO or Slashdot or Wikipedia. Most of the time it's just an outlet for people with microscopically small genitalia to try to feel bigger and more important than they really are. In reality, they're just freaks with shrunken genitalia who have no value at all.
Re: (Score:3)
Most of the code there is obvious. No need for copyright or licensing. The answer to "how do I do a rotate an unsigned integer?" isn't a work of art. Even the longer snippets of code are just that: snippets. They're composed of techniques that are widely known and widely used, and most certainly these snippets were copied from somewhere else in the first place!! There's almost never anything original in stackexchange. Having to put attributions on this is like having to use attributions with tweets.
Re: (Score:2)
I was having a debate with several high ranking programmers on SO about needing to mark an INT volatile or having to use Interlocked atomic writes to make sure the class variable gets flushed to memory after the method call finishes.
Indeed, there is no need for that. You need to sync only if something must get visible to another thread.
My argument is that unless the method discards the data or inlines the method call, the method has to eventually flush the data from registers back to memory before returning control.
As written, this statement seems indeed either insane or tautological. I am not surprised SO people were baffled.
Now that .Net code is on GitHub, it turns out Microsoft's own code for stuff like semaphores are written exactly the way I proposed.
A semaphore is a totally different thing than an ordinary user-defined class object.
Re:This is the least of the problems with SO. (Score:5, Insightful)
With so little detail, it's hard to say for sure, but it sounds like you were likely wrong.
First, the fact that something is flushed from a register is NO guarantee that it will be visible to other processors at any particular time in the future. Sure, most architectures and implementations with most workloads will move it "fairly quickly" from caches to 'main' memory shared by all processors. But "fairly quickly" is undefined - one instruction? Two? 20? Seven clock cycles? Six?. Worse, once the register is actually flushed to main memory by the processor doing the write, there's no guarantee that other processors will see the updated value when accessing the physical address at any particular time in the future -- the 'stale' version of the data may be sitting in L1 or L2 cache for an arbitrary period of time (and this is usually even longer and more unpredictable and, in my experience, the more common source of concurrency problems in code written by amateurs who have never carefully read even the memory model section of even one hardware architecture spec).
Second, C makes no guarantees about when a register (or even what a 'register' is - esp. on a particular architecture) is flushed to to the L1/L2/L? cache/memory. Particular implementations on particular architectures at particular optimization levels may do so when you expect -- but they also may do something quite different.
When you're programming in a high level language, you should adhere to the rules of the high level language and not make assumptions about how the compiler, runtime, and underlying architecture work as you have no idea when a new version of compiler, a new version of runtime, or a new revision of hardware etc will be used with your code and invalidate your assumptions -- and that's not even considering porting to an alternative architecture in the future.
The fact that an OS vendor coded something a particular way does not mean that it's a good idea for you to do it. They know what hardware their OS targets (including multiple architectures, each of which will likely have different implementations of key concurrency control primitives) and will patch their code if needed. As well, in the case of Microsoft, both the microprocessor vendors and (to a lesser extent) system builders test their implementations on Windows before alpha release so if there's a discrepancy, either the hardware will likely be changed or Microsoft will issue a bug fix for that hardware. Note that the underlying OS even almost certainly has all sorts of "hacks" in it to get around errata in specific steppings of Intel microprocessors. Depending on the OS, just stepping through the assembly code for a library or system call may be especially misleading unless you have verified that that's really the code that runs on EVERY implementation of the hardware/OS etc.
Of course, if you know that your code would never need to run on another compiler, run-time, architecture, implementation of the architecture (including clock rates, memory speeds), or even stepping of a microprocessor and you understand all the layers well (perhaps implemented them yourself) have at it -- but, please, do us all a favor and just write your code in assembly so it's clearer to those who may follow you what you did rather than leave others trying to guess what you assumed about the underlying infrastructure.
For the rest of us that know things change, when writing in a high level language, be professional and follow the specs and use available OS libraries for synchronization needs where available. I've had to implement my own in the long distant past (including to replace a horrible implementation of CriticalSections back in the early days of Windows NT), but those days are mostly in the distant rearview mirror now that most everything has been multicore for at least 15 years.
If you're even thinking about 'registers' when considering correctness of concurrency when programming in a high level language, you are almost certainly doing something wrong.
Re: (Score:3)
I get really frustrated when searching for an answer and about 15 or 20 of the results are from sites that have just screen scraped Stack Overflow and republished the content in a "forum" style post. So yeah, even Stack Overflow doesn't have any control over the content.
I'm not opposed to including links to some of the more obscure answers, but for more common code that could have been found in numerous other sources, I don't see the point.
Re:Unenforceable and stupid (Score:4, Interesting)
Re: (Score:2)
I don't like gotcha arguments and I see what you're saying, but hate crime is not thought crime. It requires an element of thought but is inextricably linked to an act which in itself constitutes crime. It's akin to, if not the same as the different degrees of murder, which depend largely on the thought element bound to the act. Also akin to but further from than the former, the difference between murder and manslaughter where the differentiator is intent or lack thereof.
A thought crime in common parlance i
Re: (Score:2)
How about the people being fired from jobs or getting jail time for twitter posts? There's an actual Canadian who disagreed with a feminist on Twitter, and do to cyber violence harassment law (or whatever they call it in Canada) the guy was tried, convicted, and had jail time.
Re: (Score:2)
I agree with you 100% that there are social thought crimes. I though we were talking about legal crimes.
Re: (Score:2)
It's akin to, if not the same as the different degrees of murder...
Except with hate crimes, there are usually two charges: one for the the actual crime and a second for the thought (hate).
Re: (Score:2)
have to know the detail of that charge. when I was on grand jury i noted that there can be multiple charges for the same act. I strongly doubt that even in that second charge there is no mention of the act. that very distant from a pure thought crime, no?
Re: (Score:2)
Hate crimes are thoughts put into action. It's no different from first degree murder vs. manslaughter. To convict for First degree murder you need to prove intent and planning which are both "thought crimes" the way you define it. The only difference is that a hate crime is an interpretation of motive and intent.
Re: (Score:2)
Re: (Score:3)
I can't believe all of the hate for this. It's not a big deal and it's something I've always been doing anyway.
Sure, it's probably not a big deal to you. But it is very much a big deal to people who write commercial software, which is a fair percentage of the people who use StackOverflow. I'm not a lawyer myself, but I can say from experience that, when a lawyer finds a comment somewhere in the codebase that says "//these next two lines of code are MIT-licensed", steam shoots out of their ears and every developer in the company has to attend an all-day meeting about it.
Re: (Score:3, Interesting)
I'm not a lawyer myself, but I can say from experience that, when a lawyer finds a comment somewhere in the codebase that says "//these next two lines of code are MIT-licensed", steam shoots out of their ears and every developer in the company has to attend an all-day meeting about it.
This is absolutely common for many large commercial companies. I have several such companies as clients and getting any FOSS approved is a major process. In fact, one client preferred to send a check to one open-source project for a license even though legally it grants them no benefit. The project's website even says that the project "is in the public domain and does not require a license." Companies with large bankrolls will glady shell out thousands of dollars for some peace of mind.
http://www.hwaci.com/ [hwaci.com]
Re: (Score:2)
... I can say from experience that, when a lawyer finds a comment somewhere in the codebase that says "//these next two lines of code are MIT-licensed", steam shoots out of their ears and every developer in the company has to attend an all-day meeting about it.
And if they later find out that the same code from the same source was included without any such comment, do you think they would take that any better?
The MIT license, at least, doesn't require anything beyond attribution in the code. Up to this point the default license for anything copied from Stack Overflow was CC-BY-SA, which is "viral" much like the GPL: any derivative works must be offered under the same terms.
Of course, there is still the question of whether S.O. has the right to apply this license t
Re: (Score:2)
The irony - someone complaining about "dumb" "dickheads" and screwing it up in the process. Good jerrrrrb!
Re: (Score:3)
P.s.what happens if I post GPL code?
I don't think that this is just a P.S. This highlights the crux of the (legal) issue. SO is saying that code posted on their web site is under a particular license, which implies that they have the right to do so.
If I get code off SO and it later turns out to be GPL or proprietary, and I get sued, it means that I get to point to SO and say 'sue them, they gave me a license'.
Re: (Score:3)
Actually, unless I'm misreading, the plan is to be MIT with the attribution requirement removed, unless the poster explicitly asks for attribution. IMO, this makes sense for short code snippets, because they're arguably too short to enjoy copyright protection anyway (there's often exactly one way to do it), and this eliminates ambiguity on the subject. For longer code, if you want to