科学计算准则与协议¶
准则¶
Best Practices for Scientific Computing, Greg Wilson, et al.
-
Write programs for people, not computers: Emphasizes writing readable and understandable code, considering human cognitive limitations.
-
Let the computer do the work: Advocates for automation of repetitive tasks to save time and reduce errors.
-
Make incremental changes: Recommends frequent feedback and course corrections, and the use of version control systems to manage changes efficiently.
-
Don't repeat yourself (or others): Stresses the importance of avoiding duplication in code and data to ease maintenance and ensure consistency.
-
Plan for mistakes: Highlights defensive programming, testing, and debugging as crucial for catching and fixing errors effectively.
-
Optimize software only after it works correctly: Advises on optimizing code for performance only after ensuring it functions correctly, and encourages the use of high-level languages for productivity.
-
Document design and purpose, not mechanics: Suggests documenting the rationale behind code and design decisions rather than the code itself to facilitate understanding and maintenance.
-
Collaborate: Encourages code reviews, pair programming, and issue tracking to improve code quality and facilitate knowledge sharing within teams.
协议¶
1. MIT 许可证¶
- 简介:MIT 是一种非常宽松的许可证,允许几乎任何形式的使用、修改和重新分发,只要保留版权声明和许可声明。
- 商用:非常友好。允许商用。
- 要求:保留版权和许可声明。
当我们说到在使用 MIT 许可证的软件时需要“保留版权和许可声明”,实际上意味着在你的软件或者任何使用了MIT许可证软件的分发包中,需要包含原软件所附带的版权声明和许可证文本。
- 版权声明:通常是一个简短的文本,指出软件的版权归属(例如,“Copyright 2021, John Doe”)。
- 许可声明:就是 MIT 许可证的全文,即那个定义了你可以如何使用该软件的法律文本。
保留的方法通常是在软件的源代码文件顶部注释中包含这些声明,或者在软件的文档和/或发行版本中包含一个 LICENSE 或 COPYRIGHT 文件,里面包含了这些必要的法律信息。
2. BSD 许可证(原始BSD许可证、2条款BSD许可证和3条款BSD许可证)¶
- 简介:BSD 许可证是一组允许软件包被自由使用和分发的许可证,只要满足最少的条件,如不去掉原作者的版权声明。2条款(FreeBSD)和3条款(New BSD)是最常用的变体。
- 商用:非常友好。允许商用。
- 要求:保留版权声明。3条款BSD还要求在宣传材料中提及使用了该软件。
3. Apache 2.0 许可证¶
- 简介:Apache 许可证提供了对版权的保护,同时允许被授权人自由地使用、修改和分发软件。
- 商用:非常友好。允许商用。
- 要求:需要保留版权声明、许可声明和修改说明。还提供了专利授权。
4. GNU 通用公共许可证(GPL)¶
- 简介:GPL 是一种“传染性”的许可证,要求所有修改过的和基于 GPL 软件的分发版也必须是开源并且同样在 GPL 许可证下。
- 商用:有限制。虽然允许商用,但必须开源修改后的代码,且同样遵循 GPL。
- 要求:如果分发或修改后的版本,必须也在 GPL 下分发。
5. GNU 较宽松公共许可证(LGPL)¶
- 简介:LGPL 是对 GPL 的一种宽松形式,允许将 LGPL 软件作为库文件与非开源软件一起使用,而不需要后者也开源。
- 商用:相对友好。允许商用,但如果修改了 LGPL 代码,或者以某种方式静态链接了 LGPL 库,则需要开源。
- 要求:开源使用 LGPL 许可的部分,但允许闭源的软件使用 LGPL 库。
6. Mozilla 公共许可证(MPL)¶
- 简介:MPL 是一种中等宽松的许可证,允许在同一项目中混合使用 MPL 许可的代码和其他许可的代码。
- 商用:友好。允许商用。
- 要求:修改后的文件必须在 MPL 下开源,但可以与其他许可证的文件一起分发。
排序标准:允许商用的程度¶
- 最宽松:MIT、BSD、Apache 2.0
- 中等宽松:MPL
- 较宽松:LGPL
- 有限制:GPL