A.1:将稳定代码与不稳定代码分开
Isolating less stable code facilitates its unit testing, interface improvement, refactoring, and eventual deprecation.
隔离不稳定的代码有助于其单元测试,接口改进,重构乃至最终弃用。
A.2: Express potentially reusable parts as a library
A.2:将潜在可重用的部件表示为库
Reason(原因)
Note(注意)
A library is a collection of declarations and definitions maintained, documented, and shipped together. A library could be a set of headers (a "header-only library") or a set of headers plus a set of object files. You can statically or dynamically link a library into a program, or you can #include a header-only library.
库是放在一起维护,记录和发布的声明和定义的集合。一个库可以是一组头文件(“仅头文件的库”)或一组头文件外加一组目标文件。您可以将库静态或动态链接到程序,也可以#include仅包含文件的库。
A.4: There should be no cycles among libraries
A.4:库之间不应存在引用循环
Reason(原因)
Note(注意)
A library can contain cyclic references in the definition of its components. For example:
库在其组件的定义中可以包含循环引用。例如
???
However, a library should not depend on another that depends on it.
然而,一个库不应该依赖于另一个依赖它的库。
原文链接
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#a-architectural-ideas