C++核心準(zhǔn)則?A.1-A.4:架構(gòu)理念

A.1: Separate stable code from less stable code
A.1:將穩(wěn)定代碼與不穩(wěn)定代碼分開
Isolating less stable code facilitates its unit testing, interface improvement, refactoring, and eventual deprecation.
隔離不穩(wěn)定的代碼有助于其單元測(cè)試,接口改進(jìn),重構(gòu)乃至最終棄用。
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.
庫是放在一起維護(hù),記錄和發(fā)布的聲明和定義的集合。一個(gè)庫可以是一組頭文件(“僅頭文件的庫”)或一組頭文件外加一組目標(biāo)文件。您可以將庫靜態(tài)或動(dòng)態(tài)鏈接到程序,也可以#include僅包含文件的庫。
A.4: There should be no cycles among libraries
A.4:庫之間不應(yīng)存在引用循環(huán)
Reason(原因)
A cycle complicates the build process.
循環(huán)引用會(huì)使編譯過程復(fù)雜化。
Cycles are hard to understand and might introduce indeterminism (unspecified behavior).
循環(huán)很難理解,并且可能引入不確定性(未指定的行為)。
Note(注意)
A library can contain cyclic references in the definition of its components. For example:
庫在其組件的定義中可以包含循環(huán)引用。例如
???
However, a library should not depend on another that depends on it.
然而,一個(gè)庫不應(yīng)該依賴于另一個(gè)依賴它的庫。
原文鏈接
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#a-architectural-ideas
新書介紹
《實(shí)戰(zhàn)Python設(shè)計(jì)模式》是作者最近出版的新書,拜托多多關(guān)注!

本書利用Python 的標(biāo)準(zhǔn)GUI 工具包tkinter,通過可執(zhí)行的示例對(duì)23 個(gè)設(shè)計(jì)模式逐個(gè)進(jìn)行說明。這樣一方面可以使讀者了解真實(shí)的軟件開發(fā)工作中每個(gè)設(shè)計(jì)模式的運(yùn)用場(chǎng)景和想要解決的問題;另一方面通過對(duì)這些問題的解決過程進(jìn)行說明,讓讀者明白在編寫代碼時(shí)如何判斷使用設(shè)計(jì)模式的利弊,并合理運(yùn)用設(shè)計(jì)模式。
對(duì)設(shè)計(jì)模式感興趣而且希望隨學(xué)隨用的讀者通過本書可以快速跨越從理解到運(yùn)用的門檻;希望學(xué)習(xí)Python GUI 編程的讀者可以將本書中的示例作為設(shè)計(jì)和開發(fā)的參考;使用Python 語言進(jìn)行圖像分析、數(shù)據(jù)處理工作的讀者可以直接以本書中的示例為基礎(chǔ),迅速構(gòu)建自己的系統(tǒng)架構(gòu)。
覺得本文有幫助?請(qǐng)分享給更多人。
關(guān)注微信公眾號(hào)【面向?qū)ο笏伎肌枯p松學(xué)習(xí)每一天!
面向?qū)ο箝_發(fā),面向?qū)ο笏伎迹?/span>
