Appendix: Ready-Made Code
Stack Overflow is structured as a Q&A website. Users ask questions, and people respond with answers. The website officially discourage 'discussions', where people talk about the proper way of solving a problem endlessly. Instead, you should get your answer quickly to a real problem.
Therefore, on Stack Overflow, it is hard to stumble upon ready-made programs ready for you to copy and paste blindly. On Stack Overflow, code is designed to solve unique and specialized problems, not just vomit out a complete, working program.
This is not the case if you go to other Q&A websites located on the broader Stack Exchange platform (which is where 'Stack Overflow' is hosted at). Q&A sites such as "Code Review" or "Code Golf" serve as repositories of "ready-made code".
- "Code Golf" is a website where users accept challenges to produce working programs that meets certain criteria (e.g., size). (Example: Naïve Markov Chain Word Generation)
All code located on "Code Review" or "Code Golf" is licensed under the CC-BY-SA 3.0 (just like the code on "Stack Overflow"). Most of them are not code snippets...after all, they are usually fully-fledged working programs, not one or two lines of code.
Translating the code in question into another language would also count as a derivative work (after all, you were inspired by somebody's code to write your own version of it), so you would still have to comply with the terms of the CC-BY-SA 3.0 license.
If you are running a copyleft codebase, there's no legal problem involved in using code on "Code Review" or "Code Golf". If you are working on a proprietary or permissive codebase though, then you may have consider performing the pseudo-"Clean Room" implementation that I discussed back in the Code Licensing chapter.
It is not a good idea to use Code Review and Code Golf to find "ready-made code". "Ready-made code" already exists on code hosting websites such as SourceForge, BitBucket and GitHub, in the form of open-source software with proper software licenses. It is easier to find "ready-made code" on those sites that matches your own unique needs.
Using code from Code Review and Code Golf may also be rather unethical, since you are just taking advantage of the fact that everything is automatically licensed on Stack Exchange under CC-BY-SA 3.0 with no exception. The people posting their FizzBuzz code on "Code Review" want to have their own code reviewed, not to have it be reused by you.
However, you can copy and paste code from Code Review and Code Golf legally. The answers and comments on the provided code in question can be incredibly helpful as well and could theoretically improve your own coding ability.