essential-copying and pasting from Stack Overflow原文和翻译

Introduction
Inspired by this cover. The book is written in a deadpan manner.

根据封面的启发,这本书是在面无表情的方式下编写


cutting corners to meet arbitrary management deadlines. 投机取巧 来满足任意管理期限
Code Licensing Issues[编码许可问题]
    Before you can copy and paste code, you have to make sure you have the legal right[合法权利] to copy and paste that code. Without that legal right, you would just be stealing[偷盗、抄袭] other people's intellectual property[知识产权]. That would just be lazy.

    Most code on Stack Overflow are 'snippets'[片断]. They do not meet standards of originality[标准的创意] and as a result have no copyright protection[版权保护]. You are free to copy and paste them without any worry about losing a lawsuit[诉讼].

    Some code on Stack Overflow are much longer than 'snippets'. They therefore qualify for copyright protection[因此他们有资格获得版权保护]. By default[默认情况下], all content on Stack Overflow (including code) is licensed under the CC-BY-SA 3.0 license[署名-相同方式共享creative commons说明见:https://creativecommons.org/licenses/by-sa/3.0/deed.zh].

    This license[CC-BY-SA 3.0 license] is not recommended[推荐] for use in software at all, and so is currently looking to replace this license for future code posted on its website[所以目前在其网站上发布的未来代码是用于取代此授权]. For now, though, the CC-BY-SA 3.0 is law. Even if so does change its future licensing policies, all previous[以前的]code will still remain[保持,归于] under CC-BY-SA 3.0.

    CC-BY-SA 3.0 is a copyleft license just like[正如] GPL 3.0. Essentially[本质上], you can use all code licensed under CC-BY-SA 3.0 so long as[只要]:
      ● You give attribution[说明来源] to the website where you got the code.
      ● You license your codebase under the same terms[条款] as the CC-BY-SA 3.0. Again[此外], the CC-BY-SA 3.0 is not recommended for use in software, so licensing your software under CC-BY-SA 3.0 is pretty much[几乎] a non-starter[不值的考虑的方案].

    However, there is some legal wizardy[法律向导] you can do to relicense[再次授权] your Stack Overflow code from ugly CC-BY-SA 3.0 to a proper Open Source license[适当
的开放源码许可] that is suitable for[适用于] software. Here how it works.
     1. Any creative work licensed under CC-BY-SA 3.0 can be upgraded to[提高至] CC-BY-SA 4.0, automatically.
     2. According to the Creative Commons website, CC-BY-SA 4.0 is compatible[兼容] with both GPL 3.0 and the Artistic License. Both the GPL 3.0 and the Artistic License are copy-left licenses[反版权许可].

    There is no real way to distinguish[区分] between a 'code snippet' with no copyright protection and a much larger block of code that does contain copyright protection (and thus is licensed under CC-BY-SA 3.0). You could use common sense[常识] to decide whether some code qualifies as[作为] a "snippet" or not, but if the courts[法院] share a different definition of a "snippet" than you, you are out of luck.
    If you are working on a permissive or proprietary codebase[许可或专有代码库], you have four options[选择].
      ● Change the codebase to GPL 3.0 or the Artistic License and start copying and pasting code with ease[熟练].
      ● Hire an expensive lawyer to defend your right to use code snippets from Stack Overflow...
      ● Hope that the person you're copying and pasting from doesn't care enough about your violation[违反] of the CC-BY-SA 3.0 license to sue[起诉] you.
         ○ I recommend this approach[推荐这种方式] because the odds[机会] of the other user stumbling[发现] upon your codebase and complaining[投诉] about you not adhering to[坚持] the terms of the CC-BY-SA 3.0 is lower than the odds of this book actually being published by O'Reilly. If you are very unlucky (and that can happen), then you can simply apologize and then rewrite the offending[不愉快] code.
      ● ...or write your own pseudo-Clean Room implementation of the Stack Overflow code.

    Here is a step-by-step guide:
      1. Write down some notes about the code from Stack Overflow, specifically how it works, how you should implement it, etc.
      2. Close the web browser.
      3. Wait a few minutes so that you forget the code.
      4. Use the information in your notes to re-implement the Stack Overflow code in question.
      5. You now own the copyright to your code in question...even if the final code is exactly the same as the original Stack Overflow answer. Since you now own the copyright to this code, you may integrate[成为一体] it into your permissive or proprietary codebase.

    This approach is slower than the traditional "CTRL-C, CTRL-V" approach to copying and pasting. However, it does have the benefit[益处] of giving you a deeper understanding of the Stack Overflow code. This could be helpful as you will likely[很可能、或许] need to maintain this code in the future.

There is one last point to conclude[最后] in this chapter. Some users may add a permissive license to their code submissions to[提交] Stack Overflow. In that case, you can elect to[选择] adhere to[坚持] the terms of this permissive license instead of worrying about the copyleft CC-BY-SA 3.0. Check the profile[简况] of the user who posted the "code" to see whether the code is available[可供使用] under a different license.

Code Attribution[编码归属]
    When you copy and paste code from Stack Overflow, it is best practice to provide a link to the place where you got that code. This is for two reasons:
      1. The person has helped you greatly by giving you some valuable[有价值的] code. You should reward[奖励] them by giving the programmer a comment[意见] in a codebase that they are never ever going to see.
      2. It's useful to look back[回顾] at the answer in case you need to debug the code later. This is very useful if the author of the code in question also wrote a detailed explanation of his code.
    Sometimes, during the course of[在...期间] a project, the original[最初的] so code will be heavily modified[大量的修改] by you. In that case, it makes no sense[豪无意义] to keep the attribution, since you have thoroughly mutilated[彻底破坏] the work of the original author. There is no reason to praise[赞赏] the author anymore, and the author's detailed explanations may prove[证明是] useless thanks to[由于] your own modifications. Remove the comment from your code ASAP.

    Use your professional judgment when deciding[决定] when to give attribution and when you should remove it.
Note while that attribution is generally not required for 'code snippets', they are usually required if you are complying with[遵守] the terms of a license (either the default CC-BY-SA 3.0 or a permissive license).

Code Selection[选码]
    Generally, when you search for a question on Stack Overflow, you can usually find a answer to your problem. This is not always a good thing.
      ● Some of the answers on Stack Overflow may be plain wrong. Anyone can answer a question on Stack Overflow, so just because[只是因为] it is online does not mean it is true. While obviously wrong answers can be downvoted, not so obvious answers may be highly voted[投票]. In addition, you usually cannot be certain at all[完全确信] that the code in question actually compiles or work until you try it out yourself.
      ● Some of the answers may devoid[缺乏] of explanation and be composed of[由...组成] nothing more than[仅仅,只不过] code. While this may seem like a good idea for the eager[热切地] copy-and-paster, it really isn't. You need to know what the code is actually doing. After all[毕竟], you will have to maintain that code in the future.
      ● Some of the answers are legacy[遗留] answers. They worked in the past, but are now no longer best practice. Stack Overflow suffers from the "fastest gun in the west" synd more[综合比较] where whoever answers the question first usually gets the most votes, and thus is seen first. The more "modern" answers usually don't get as much votes and tend to[趋向于] languish[变衰弱] on the bottom of the page.


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 Review" is a website where coders review other people's working programs and make suggestions on how to improve them. (Example: Working Tic-Tac-Toe Game using Python, JavaScript, PHP and HTML)
      ● "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.


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/35291.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

初创软件除了做开源,难道就别无选择了吗?

别无选择 酒香不怕巷子深,就请问酒香怕不怕无人岛?初创软件需要打开市场,除了产品自身,市场可能更为重要。 知名度或称为流量,流量在信息时代对于初创软件的重要性,不排第一至少也能排第二。 再好的东西…

使用python爬取携程网旅游信息(包含景点、酒店、美食)

其中本次爬虫的主要思想是:首先是找到携程网url的编写规律,然后根据规律使用beautifulsoup4对所需的html语言中的信息提取,最后就是封装处理。爬取的信息只是用来本次毕设的研究非商业用途。对于毕设的相关总结在:旅游推荐系统毕业…

基于PHP的旅游资讯管理系统

有需要请私信或看评论链接哦 可远程调试 基于PHP的旅游资讯管理系统 一 介绍 此旅游资讯系统基于原生PHP开发,数据库mysql,前端bootstrap,前后端分离。系统角色分为用户和管理员,用户可注册登录,预订旅行行程&#x…

旅游网站、旅游系统

旅游网站 摘要:在社会快速发展的影响下,旅游网站继续发展,大大增加了旅游的数量、多样性、质量等等的要求,使旅游网站的管理和运营比过去十年更加简单化。依照这一现实为基础,设计一个快捷而又方便的网上旅游网站是一项…

麒麟水乡,IU酒店进驻云南旅游咽喉之地曲靖

曲靖位于云南省东北部,是云南连接内地的重要陆路通道,素有“滇黔锁钥”、“入滇门户”、“云南咽喉”之称,是仅次于昆明的云南第二大城市。曾入选“中国十佳宜居城市”榜单10次的城市,拥有3000多年的文明史,早在三国魏…

Python抓取全国旅游景点以及小吃数据,想做旅游攻略?Python助你事半功倍。

前言 疫情自从来了之后已经很久没有出去旅游过了,蹭着这段疫情好转,那肯定是要出去走一走的,这一篇其实是全国旅游中的一站,因为每个城市能玩的地方太多了,一篇文章下来肯定是写不了的,所以今天就抓取一下—…

对去哪儿旅行(功略库)的数据分析

选题背景 去哪儿旅行网站上有丰富的图片,旅行数据以及评论数据,用这些大量的数据来学习数据采集及可视化分析是一个不错的选择 网页分析 可以获取的数据 通过翻阅这些攻略我们可以观察到网站上展示了以下共有的数据:文章标题,…

基于Python的云南旅游景点分析

作为一名云南人,作为一名数据分析人员,我将在本次用Python来给大家介绍云南的相关景点! 欢迎大家来云南旅游哦!资料含各地景点的数据,希望大家学习之后进行相关的练习,学有所成! 所需的资料我…

Android程序员面试5分钟自我介绍法

有简历,为何还要自我介绍? 要回答这个问题,首先搞清楚为什么面试官要请你做自我介绍?面试官通过自我介绍想考察被面试者什么?只有了解面试官的目的,被面试者才能做好自我介绍。 面试官通过被面试者自我介绍…

刷完这份2023年Android中高级最全面试真题答案解析,拿到offer几率提升50%

前言 今年以来,经济回暖,但行业岗位缺口紧缩的趋势恢复还需一段时间。尤其对于Android开发而言,想要跳槽到一个高薪岗位更是难上加难。 因此,想要杀出重围,必然要有万全的准备。除了一份美观的简历,刷一刷…

靠这份35w字Java面试题,终于收到字节Java开发岗满意Offer了!

靠这份35w字Java面试题,终于收到字节Java开发岗满意Offer了! 前天面Java PDD一面挂 美团一面挂 寄 美团全程Java八股文 字节40分钟八股文10分钟算法题,算法题是个普通的middle,没啥问题。 但是,八股跨度大且精细,寄。…

7个实用的Python自动化代码

关于Python有一句名言:不要重复造轮子 但是问题有三个: 1、你不知道已经有哪些轮子已经造好了,哪个适合你用。有名有姓的的著名轮子就400多个,更别说没名没姓自己在制造中的轮子 2、确实没重复造轮子,但是在重复制造…

创建用户账户

这一节内容我们来一起学习Linux中有关于用户身份及文件权限的内容。在windows中,我们可以通过图形化界面去创建及管理用户,但在Linux系统中,我们习惯用命令的方式去创建以及管理用户。 以上两图是windows系统中,如何创建用户以及管…

跨境电商卖家应该知道的3个社交媒体营销策略

关键词:跨境电商卖家、社交媒体营销 社交媒体是获取、吸引和留住客户的强大营销渠道。普通人拥有超过八个社交媒体帐户,使用每个平台参与社区,发现新产品并与朋友和家人保持联系。 社交媒体最强大的方面是,您的目标受众只需点击几…

人工智能时代,职场中的你是否真不可替代?用Python玩转ChatGPT

最近一段时间,ChatGPT在网络上很火。小伙伴们在感叹这款神奇的聊天机器人强大功能的同时。不知不觉会发现,我们已经被莫名其妙地带入到一个人工智能时代。 不管你愿不愿意承认,实事就是如此。相信很多小伙伴都很想体验一把这个智能应用&#…

2023年,总要干点不一样的事情

2020年——不寻常的一年,但我还是启动了两个新项目: 开设 “高效敏捷测试49讲” 专栏 (文字语音),后来形成了图书《敏捷测试:以持续测试促进持续交付》。 发起并成功举办了 全球软件质量效能大会&#xff0…

AIGC最近很火,给大家推荐一个已经有1000位开发者使用的中文aigc开源模型,包括ai画图、ai聊天

AIGC最近火得一塌糊涂! 12月16日,Science发布2022年度科学十大突破,其中AIGC作为人工智能领域的重要突破也赫然在列。 作为2022年以来AI圈最大的趋势,AIGC意味着,AI进军到了此前被视为“人类独占”的领域,如…

笔记本就能运行的ChatGPT平替来了,附完整版技术报告(附github代码)

关注并星标 从此不迷路 计算机视觉研究院 公众号ID|ComputerVisionGzq 学习群|扫码在主页获取加入方式 计算机视觉研究院专栏 作者:Edison_G GPT4All 是基于大量干净的助手数据(包括代码、故事和对话)训练而成的聊天机…

开源的短视频生成和编辑工具 Open Chat Video Editor

GitHub - SCUTlihaoyu/open-chat-video-editor: Open source short video automatic generation tool

Android 实现图文混排

Android 实现图文混排 需求: 在文字中间添加图片或者在文字后面添加图片;文字换行后,图片在第二行的后面;图片加点击事件,文字没有点击事件。 实现方案: 使用TextView Imageview实现,第1点…