What Is Design? 1
Abstraction and Hierarchy in Design 3
Procedural and Data-Oriented Design 4
Object-Oriented Design 6
Object-Oriented Design Methodology 9
Design Simplicity 13
Outline of the Text 14
Exercises 16
The Knight's-Tour Problem 17
Identifying Candidate Classes 20
Categories of Classes 23
Choosing the Top-Level Classes 24
Characterizing the Classes 27
Describing Object-Oriented Designs 28
Defining the Implementation 30
Evaluating a Design 39
Simplicity 41
Cohesion and Coupling 42
Information Hiding 43
Error Handling 43
Summary 44
Exercises 45
Coding Conventions 47
Naming Conventions 48
Standard Types 50
Pointers and Objects 51
Constants 52
Writing the Class Declarations 53
Writing The Methods 56
KnightMainInfo 56
KnightBoardInfo 59
KnightSquareInfo 60
KnightHeuristicInfo 64
KnightSolutionInfo 66
File Structure 67
Header Files 68
Code Files 72
Summary 73
Exercises 74
Classes as Pointers 77
Class Implementations 79
Protection 79
Constant Declarations 81
Parameters 82
Overloading 83
Operator Methods 86
Class Variables 89
C++ Storage Management 89
Constructors 89
Destructors 93
Safe Memory Management 93
C++ Types 97
Typedefs 97
Enumerations 98
Pointer Types 99
Conversion Functions 99
Comments 101
Summary 102
Exercises 103
Symbolic Differentiation 105
Natural Inheritance 108
Designing a Natural Hierarchy 110
Special Cases of Natural Inheritance 113
Interface Inheritance 115
Factory Classes 116
Wrapper Classes 118
Mix-in Inheritance 120
Inheritance for Callbacks 123
Behavior Inheritance 126
Guidelines for Using Inheritance In C++ 128
Levels of Inheritance 128
Multiple Inheritance 129
Virtual Methods 130
Summary 131
Exercises 132
Design Notations 134
Static Structure Diagram Basics 135
Class Notations 136
Relationship Notations 137
Expressing Designs Using Diagrams 140
Top-Level Design 140
Second-Level Designs 144
Message-Trace Diagrams 147
Using Design Diagrams 154
Summary 157
Exercises 158
Object Libraries 159
Types of Libraries 159
Dependency Analyzer 161
Independent Objects 162
Dependent Objects 166
Dynamic Vectors and Lists 168
Associative Containers 170
Iterators 174
The Rest of the Library 179
Data-Structure Classes 179
Algorithm Classes 180
Summary 187
Exercises 188
Debugging and Testing 189
Defensive Programming 191
Defensive Design 191
Defensive Coding 195
Assertions 198
Exceptions 199
An Example 200
Debugging Tools 203
Debugging Techniques 207
Error Location 208
Error Logging 213
Error Repair 214
Memory-Management Problems 215
Testing 216
Approaches to Testing 217
Test Case Selection 219
Summary 221
Exercises 222
A Sample Graphical Application 226
Program Structure 228
Control Structure 232
User-Interface Concepts 235
Basic Motif Concepts 236
Basic Microsoft Foundation Class Concepts 238
User-Interface Components 239
Motif Components 240
Microsoft Foundation Classes Components 244
Graphical Output 247
Summary 250
Exercises 251
Sketching the Interface 253
User-Interface Classes 258
User-Interface Methods 260
Managing the Drawing 261
Managing the Dialog Boxes 264
Implementing the User Interface 268
Implementation Strategy 269
Summary 272
Exercises 272
Human Factors 275
User-Interface Problems 276
Lack of Conventions 276
Overly Complex Displays 277
Lack of Elegance 278
Intolerance to Error 279
Bad Documentation 279
Design Guidelines 280
Common Sense 280
Consistency 281
Feedback 282
Design for Error 283
Types of Users 285
Evaluation 286
Visual Guidelines 287
Visual Clarity 287
Visual Codings 290
Principles of Layout 291
Color 293
User-Interface Models 294
Summary 296
Exercises 297
Reuse and Objects 299
Implementing Reuse 299
Why Reuse is Difficult 300
Designing Reusable Classes 302
Selecting Classes to Reuse 302
Defining a Reusable Class 304
Selecting the Level of Reuse 307
Reuse Through Inheritance 311
Defining Inheritable Classes 311
Inheritance for Callbacks 312
Application Frameworks 313
Templates 314
Creating a Template 315
Designing Template Classes 316
Specializing Templates 322
Summary 325
Exercises 325
What Is a Design Pattern? 327
Factory Patterns 330
Builder 330
Abstract Factory 332
Flyweight 333
Singleton 334
Factory Method 335
Prototype 335
Delegating Responsibility 336
Adaptor 336
Bridge 337
Decorator 339
Facade 339
Proxy 341
Control Patterns 342
Composite 342
Interpreter 342
Command 343
Iterator 344
Strategy 345
Template 346
Visitor 348
Algorithmic Patterns 350
Mediator 350
Memento 352
Observer 353
Summary 353
Exercises 355
Interprocess Communication 358
Files 359
Shared Memory 359
Messaging 360
Sockets 361
A Simple Socket Interface 362
Messaging 365
A Messaging Class Interface 366
Implementing Messaging Using Sockets 367
Remote Objects 368
Basic Concepts 369
Designing with Remote Objects 372
Implementing Remote Objects 375
ActiveX and CORBA 383
Multiple Threads of Control 383
Designing for Multiple Threads of Control 385
Synchronization Mechanisms 387
Multithreading the Chat Server 389
Summary 393
Exercises 394
The Foundations of Software Engineering 397
The Problems of Software 398
Software Engineering 399
Software Quality 401
Software Management 402
The Phases of Software Engineering 404
Requirements Analysis 405
Specifications 406
Design 412
Coding 414
Testing 414
Operation and Maintenance 415
The Software Development Process 416
The Waterfall Model 416
Prototypes and the Spiral Model 419
Summary 421
Exercises 423
Getting Started 426
Requirements Analysis and Specifications 426
Design 427
Design By Subsystem 429
Risk-Based Design 430
Building a Design Model 431
Identifying Difficult Problems 432
Solving the Difficult Problems 433
Core-Plus-Extensions Design 435
Pros and Cons 436
Defining the Core 437
Interface Definition 441
Finding Initial Methods 442
Evolving the Interface 446
Other Design Issues 447
Portability 447
Extensibility 448
Existing Frameworks 449
Managing a Software Project 451
Personnel Management 451
Design Management 453
Code Management 454
Configuration Management 456
Testing Management 457
Documentation 459
Conclusion 462
Summary 463
Exercises 464
Purpose 465
Naming Conventions 465
Files 466
Types, Variables, and Constants 466
Commenting Conventions 468
Block Comments 468
Inline Comments 469
The Readme File 470
White Space 470
Order Does Matter 470
Breaking Up Your Code 471
Source and Header Files 471
Including a Header File Multiple Times 471
Small Generic Functions 472
Glossary 472
Closing Thoughts 472
Sample Code 473
Header File Example 473
Code File Example 474
knight_local.H 478
knight.cxx 482
knightmain.cxx 483
knightboard.cxx 485
knightsquare.cxx 487
knightheuristic.cxx 490
knightsolution.cxx 492
depend_local.H 496
dependmain.cxx 499
dependnode.cxx 501
dependnodeset.cxx 503
[ home | abstract | errata | faq | contents | preface | sources | problems | links ]