- Overview
-
Table of Contents
- Special Member Functions: Constructors, Destructors, and the Assignment Operator
- Operator Overloading
- Memory Management
- Templates
- Namespaces
- Time and Date Library
- Streams
- Object-Oriented Programming and Design Principles
- The Standard Template Library (STL) and Generic Programming
- Exception Handling
- Runtime Type Information (RTTI)
- Signal Processing
- Creating Persistent Objects
- Bit Fields
- New Cast Operators
- Environment Variables
- Variadic Functions
- Pointers to Functions
- Function Objects
- Pointers to Members
- Lock Files
- Design Patterns
- Dynamic Linking
- Tips and Techniques
- Five Things You Need to Know About C++11 Unions
- A Tour of C99
- A Tour of C1X
- C++0X: The New Face of Standard C++
- C++0x Concurrency
- The Reflecting Circle
- We Have Mail
- The Soapbox
- Numeric Types and Arithmetic
- Careers
- Locales and Internationalization
Design Patterns
Last updated Jan 1, 2003.
Design Patterns became famous relatively recently, yet they're hardly new. Their origins can be traced back to the early days of Smalltalk, when users noticed that different and complex programming tasks consisted of smaller, recurrent design idioms serving as the building bricks of large-scale designs. They decided to formalize these recurrent idioms so that they could be reused later by other programmers, very much like standard algorithms and containers are used today.
The main difference between Design Patterns and standard libraries of algorithms is that the former are mere concepts, not actual code. This is advantageous because patterns aren't bound to a specific programming language or a platform, at least in theory.
Alas, this is also Design Patterns' main weakness: to use a Design Pattern, programmers must write it from scratch. Another problem associated with Design Patterns is that programmers who have learned a few of them start to use them excessively. For example, an application that happens to use a single data file all of a sudden wraps it in a Singleton object, even if a Singleton object isn't really necessary in this case.
That said, Design Patterns are an essential tool in every professional programmer's arsenal; ignoring them altogether would be a mistake. In this section I will introduce some of the more widely-used Design Patterns that have been implemented in C++.


