Large-Scale C++ Software Design, best C++ programming book, best C++ software architecture design book.ContentsFigure ListrefaceXXVChapter 0: Introduction0.1 From c to c++自●●申吾·导;·吾非单血;自0.2 Using C++ to Develop Large Projects0.2.1 Cyclic Dependencies0.2.2 Excessive Link-Time Dependencies223570.2.3 Excessive Compile-Time Dependencies.........0. 2. 4 The Global Name space...100.2.5 Logical vs Physical Design120.3 Reuse140.4 Quality4血“啬山曹b血150.4.1 Quality assurance0.4.2 Quality Ensurance.......170.5 Software Development ToolsI70.6 Summary甲鲁甲自壑自44自自兽自·。··●》●早中自中罪自血自自18PART I: BASICS19Chapter l: Preliminaries211 Multi-File C++ programs1. 1. 1 Declaration versus definition221.1.2 Internal versus Extermal Linkage ..i ...................................................8...23vi Contents1.1.3 Header( h) Files271.1.4 Implementation(c)Files .1.2 typedef declarations…301.3 Assert Statements1321. 4 A Few Matters of style1.4.1 Identifier names341.4.1.I Type Names◆·344.1.2 Multi-Word identifier Names自自“音自音命·日中。叶非自血自自▲…51. 413 Data member names142 Class Member Layout……自·根385 Iterators401. 6 Logical Design Notation….471.6.1 The isa relation481.6.2 The Uses-In-The-Interface Relation ..........................................................501.6.3 The Uses-In-The-Implementation Relation521.6.3.1Uses5516.3.2 Hasa and holds卡晋甲看●曾冒看曹,…561.6.3.3WasA17 Inheritance versus Layering……………581. 8 Minimality ...........................,............591.9 SummaryChapter 2: Ground rules632.1OverⅤew‘.4品44·4"品▲4今““2B‘4··2品点当导导山自自632.2 Member data access………652.3 The global Name space…,........……….692.3. 1 Global data6592.3.2 Free Functions罩··a古············4·····。·4···B·······…722.3.3 Enumerations, Typedefs, and Constant Data…732.3.4 Preprocessor Macros752.3.5 Names in Header Files .2.4 Include Guards.802.5 Redundant Include guard822.6 Documentation。··吾号·D······『香··········号·4吾·合吾·自吾b·b晋目吾··◆自·自4自自吾吾自吾音。山b·P吾···.··目·882.7 Identifier-Naming conventions9128 Summary…..............…..93Contents viiPART I: PHYSICAL DESIGN CONCEPTS97Chapter 3: Components993.1 Components versus Classes...,....3.2 Physical Design Rules........1083.3 The DependsOn Relation ...,............................................................................1203.4 Implied Dependency…………1273.5 Extracting Actual Dependencies .36 Friendship…·甲◆4·····中··中日·‘中·=.罩…1363.6.1 Long-Distance Friendship and Implied Dependency1413.6.2 Friendship and fraud ..3.7 Summary147Chapter 4: Physical Hierarchy14941 A Metaphor for Software Testing……鲁··自即血鲁自命自●鲁自身幽看自看鲁p·鲁D目·自1494.2 A Complex Subsystem1514. 3 The Difficulty in Testing"Good""Interfaces154.4 Design for" Testability……1574.5 Testing in Isolation...,.,...,.,…,…4.6 Acyclic Physical Dependencies1644.7 Level numbers∴1664.7.1 The Origin of Level Numbers……………1674.7.2 Using Level Numbers in Software鲁●鲁●晋鲁.1694.8 Hierarchical and Incremental Testing,1744.9 Testing a Complex subsystem1814.10 Testability versus Testing1834. 11 Cyclic Physical Dependencies曹曾1844.12 Cumulative Component Dependency……1874.13 Physical Design Quality1934.14 Summary…■鲁。幽自●b。啬會■曹■小·●b咖自由音。··4201Chapter 5: Levelization2035.1 Some Causes of Cyclic Physical Dependencies西曲当曲·自非非中看要甲看节要母节即甲罪自命西当自自自命自普自自自自备曾身2045.1.1 Enhancement………………………2045.1.2ConⅤ enience.2085.1.3 Intrinsic Interdependency ..d··4…213viii Contents5.2 Escalation2155.3 Demotion聊·血·●自4·如申电即罪自自命●·即命··山d非即山申咖●即.日鲁b甲●22954 Opaque pointers………2475.5 Dumb data……2575.6 Redundancy2695.7 Callbacks2755.8 Manager Class..,...…2885.9 Factoring....,.,.,.……2945.10 Escalating Encapsulation .5.11 Summary·甲·●·甲争是平·q··.q伊■吾自324Chapter 6: Insulation3276. 1 From Encapsulation to Insulation●··;·号中普·●3286.1.1 The Cost of Compile-Time Coupling3336.2 C++ Constructs and Compile-Time Coupling ............33562 I Inheritance(IA) and Compile-Time Coupling………136.2.2 Layering(HasA/HoldsA)and Compile-Time Coupling........ 3376.2.3 Inline Functions and Compile-Time Coupling...396.2. 4 Private Members and Compile-Time Coupling13416.2.5 Protected Members and Compile- Time Coupling..m...........3426.2.6 Compiler-Generated Member Functions and Compile-Time Coupling.... 3426.2.7 Include directives and Compile-Time Coupling.......... 3446.2.8 Default Arguments and Compile-Time Coupling13466.2.9 Enumerations and Compile-Time Coupling……13476.3 Partial Insulation Techniques ....................................................................3496.3.1 Removing Private Inheritance .....................................................4...3496.3.2 Removing Embedded Data Members3526.3.3 Removing Private Member Functions....................3536.3. 4 Removing protected Membersn13636.3.5 Removing Private Member Data…3756.3.6 Removing Compiler-Generated Functions3786. 3. 7 Removing Include directives3796.3.8 Removing Default Arguments.........m...........3816.3.9 Removing Enumerations......................3826.4 Total Insulation Techniques3856.4.1 The protocol class6.4.2 The Fully Insulating Concrete Class3986.4.3 The Insulating Wrapper4056.4.3. 1 Single-Component Wrappers406.4.3.2 Multi-Component Wrappers415Contents ix6.5 The Procedural interface4256.5.1 The Procedural Interface Architecture4266.5.2 Creating and Destroying Opaque Objects…………………………….4.286.5.3 Handles鲁音音·要,自看p◆吾4296.5.4 Accessing and Manipulating Opaque Objects…4356.5.5 Inheritance and opaque objectsp·.●卡甲自。●·甲.口·.即用·●··●。聊着·●。··D●4416.6 To Insulate or not to insulate4456.6. 1 The Cost of insulation4456.6.2 When not to Insulate∴…4486.6.3 How to Insulate非·申晶4536.6.4 How Much to insulate4606.7 Summary…............168Chapter 7: Packages4737. 1 From Components to Packages…4747.2 Registered Package Prefixes4837. 2. 1 The Need for prefixes4837.2.2 Namespaces甲曾b善●看警鲁·导■导鲁b吾自·备·导看导甲阝中哥q◆晋自西备看辛晋鲁番吾中《卓4867.2.3 Preserving Prefix Integr4917.3 Package Levelization自自·电非昔·4937.3.1 The Importance of Levelizing Packages甲甲·4947.3.2 Package Levelization Techinques4967.3.3 Partitioning a System7.3.4 Multi- Site Development…5007. 4 Package Insulation曲非音看。看。●鲁日看导●。@自qp看.5037.5 Package Groups▲凸■击看D5067 6 The Release process.5127.6.1 The Release structure中自·血自普鲁5147.6.2 Patches5207.7 The main Program ..................5237.8 Start-Up5317.8.1 Initialization Strategies35347.8. 1.1 The Wake-Up Initialized Technique5347.8.1.2 The Explicit in i t Function Technique.5357.8. 1.3 The Nifty Counter Technique击。鲁●量山●音·鲁鲁曲看●量···卧5377.8.1.4 The Check-Every-Time Technique5437.8.2 Clean-Up5457.8.3 Review…….-…..-…....…5467.9 Summary..........546X ContentsPART III LOGICAL DESIGN ISSUES551Chapter 8: Architecting a Component5538. 1 Abstractions and Components...,.......,.....5548.2 Component Interface Design………5558. 3 Degrees of Encapsulation甲日。··西山;·■垂5608.4 Auxiliary Implementation Classes ................5728.5 Summary579Chapter 9: Designing a Function5839.1 Function Interface Specification……自各昏·甲日·●晋·日。·命·……35849. 1.1 Operator or Non-Operator Function15849.1.2 Free or Member Operator身晋争D自鲁看非即5919.1.3 Virtual or non-virtual function5979.14 Pure or non-PureⅤ irtual member Function………6039.1.5 Static or Non-Static Member Function6049.1.6 const member or Non-const member function6059.1.7 Public, Protected or Private Member Function.......6129.1.8 Return by value, Reference, or Pointer6149.19 Retum const or non-const ..m.m,m.m..m.m.. 6189. 1. 10 Argument Optional or required甲·◆··■命·P.着●D·b县即p春e,身pvP甲·非自甲自4即6199.1.1 Pass Argument by Value, Reference, or Pointer6219. 1. 12 Pass Argument as const or Non-const .......... 6299.1.13 Friend or Non-Friend Function6309.1.14 Inline or non-Inline function6319.2 Fundamental Types Used in the Interface ..........m8....4......6339.2.1 Using short in the Interface6339.2.2 Using uni gned in the Interface....…..…………….…..6379.23 Using long in the Interface………………………6429.2.4 Using float, double, and l ong double in the Interface9.3 Special- Case functions.....,……………….6459.3.1 Conversion Operators….,….…,6469.3.2 Compiler-Generated Value semantics65093. 3 The Destructor6519. 4 Summary .............655Chapter 10: Implementing an Object66110.1 Member Data .10.1.1 Natural Alignment……,.,,,.….…,…,…,…,…,…,……662Contents xi10.1.2 Fundamental Types Used in the Implementation66510.1.3 Using typedef in the Implementation66710.2 Function Definitions ......................................... 66910.2.1 Assert Yourself?6610.2.2 Avoid Special Casing.67010.2 3 Factor Instead of Duplicate67310.2.4 Don't Be Too clever68010.3 Memory Management●·●看音。单节。甲·自也非。。非萨卓司导甲自·着要。号司D■b·普·。·即非b看。q日●_自自●看。望甲■P中自自非辛甲·自自自自68110.3.1 Logical versus Physical State values…,…,.,…..…,…,.68110.3.2 Physical Parameters68510.3.3 Memory Allocators…,,,…69110.3.4 Class-Specific Memory Management69810.34.1 Adding Custom Memory Management………70210.3.4.2 Hogging Memory···自D自自鲁鲁自白自“m··自鲁170510.3.5 Object-Specific Memory Management .10.4 Using C++ Templates in Large Projects……10.4.1 Compiler Implementations ..............71810.4.2 Managing Memory in Templates10.4.3 Patterns versus Templates73010.5 Summary…………,…..…….………………733Appendix AThe Protocol Hierarchy737Intent·自●看鲁·@音··●晋曲鲁山t番晋b普d。●卡鲁音·d鲁·●普b·非血如·吾·◆鲁非·曹备垂晋·739Also known as739Motivationd。鲁看。看739Applicability744Structure .Participants.........,.………………1745Collaborations746Consequences4..·.4:4·...4:·4···甲:746mplementation,747Sample code761Known uses……1766Related Patterns767xii ContentsAppendix BImplementing an ansi c-Compatible c++Interface769B.1 Memory Allocation Error Detection….,....,..…….769B2 Providing a Main Procedure (ANSi C Only)778Appendix CA Dependency Extractor/Analyzer Package779C 1 Using adep, cdep, and Idep...,.....,......780C 2 Command-Line documentation793C.3 Idep package Architecture….....,.,.,…,.…………….810C 4 Source Code曾音自自香自告即自命中·由自·813Appendix dQuick Reference815D.1 Definitions………即D电由·●着眼哥口815D 2 Major Design Rules820D 3 Minor Design Rules......821D.4 Guidelines…822D.5 Principles…824Bibliography833Index835