复制粘贴与参考

发布于 2024-09-01 11:38:12 字数 1431 浏览 10 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉城 2024-09-08 11:38:12

对于您问题的某些方面,这可能相关: http://en.wikipedia.org/ wiki/DLL_hell#Running_Conflicting_DLLs_Simultaneously

此问题的另一个常见解决方案是在所需功能之上编写一个封装层,这至少可以保护您的代码在升级到新版本的支持库时免受剧烈更改。

至于开源项目的生命周期,应该清楚哪些项目是健康的,哪些是不健康的。例如,属于 Apache 或 Eclipse 基金会的项目可能是健康的,而 sourceforge 上的一些随机项目可能不是。一般来说,您可以通过避免看起来不活跃的项目来完全避免这个问题。

对于将代码复制到项目中的负面影响:

  1. 我知道您想将许可证放在一边,但实际上不能。我不是一名律师,如果您的项目可能出现问题,您应该咨询律师,但如果您正在开发一个专有系统,它可能会意外地成为 GPL。
  2. 它使您的开发环境更加混乱。您必须担心确保复制的代码正确编译,使用正确的版本进行编译,并且具有正确的构建脚本。您的 IDE 中还有所有这些占用空间的额外代码。
  3. 正如您所指出的,这使得更新代码变得非常困难。
  4. 如果您必须向开源项目提交错误,那就变得更加困难。
  5. 如果您不小心,不太了解的初级开发人员可能会进入代码并开始乱搞它。

可能还有更多不这样​​做的理由,但这只是少数。希望有帮助。

For some aspects of your problem, this might be relevant: http://en.wikipedia.org/wiki/DLL_hell#Running_Conflicting_DLLs_Simultaneously.

Another common solution to this problem is to write an encapsulation layer on top of the functionality needed, which at least protects your code from wild changes when upgrading to new versions of supporting libraries.

As to open source project lifetime, it should be clear which projects are healthy and which are not. For example, a project that is part of the Apache or Eclipse foundations are probably healthy, whereas some random thing on sourceforge is probably not. Generally, you can avoid this problem altogether by avoiding projects that do not seem active.

For the negatives to copying code into your project:

  1. I know you wanted to put license aside, but you cannot in reality. I am not a lawyer and you should consult with one for your project if there may be issues, but if you are developing a proprietary system it could become GPL'ed accidentally.
  2. It makes your development environment more cluttered. You have to worry about making sure the copied-in code ompiles properly, is being compiled with the right version, and has the right build scripts. You also have all this extra code in your IDE that takes up space.
  3. As you pointed out, it makes updating code very difficult.
  4. If you have to file bugs with the Open Source project, it becomes more difficult to do.
  5. If you're not careful, a junior developer who doesn't know any better could go into the code and start mucking around with it.

There's probably more reasons not to do it, but that's a few. Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文