C++ Tips: Design

Table of Contents

Useful constructor/destructor side-effects
Numerous class access functions
Envelope/letter class example
Virtual static members
Preventing automatic variables of a class
Handling functions with large numbers of args
Prefer compile-time and link-time errors to runtime errors
Model "has-a" or "is-implemented-in-terms-of" through layering
Square wars, or, just when you thought it was safe to use rectangles
Beating a dead rectangle
Callbacks and multiple inheritance, part I
Callbacks and multiple inheritance, part II
Callbacks and multiple inheritance, part III
Callbacks and multiple inheritance, part IV
Menu item callbacks with templates
The open/closed principle
What are "mixins"?
Class design for lines and vertical lines
Finite state machine parsing
Finite state machines and inheritance
What is an FSM?
Value versus reference semantics in C++
Value and reference semantics in C++ again
Inheritance, libraries, and mixins
Inheritance and using value-based ADTs
Abstract, concrete, and value semantics
Separating interface and implementation, abstract base classes
Pure virtual member func, printing (FAQ 73 & 74)
Type-tests, lists, and switch statements
Minimize compilation dependencies between files
Managing single instance classes
Thoughts on multiple dispatching
What is multi-dispatching (multimethods double-dispatching)?
Another example on separation of interface and implementation
Factories for creating objects
Classes, structs, and access rights (safety)
Avoiding some multiple inheritance
Virtual inheritance and the open-closed principle
Choosing inheritance (is-a) versus containment (uses)
Another example of multiple dispatching
Non-const members impact derived classes
Are switch statements bad in OO design?
Musings on the use of forwards
Simple symbol table mapping
One way to process a command line
Designing classes and io
The Law of Demeter
Inheritance - interface versus implementation
Law of Demeter in a coding example
Manual simulation of covariant return types
Foreach functions and iterators
Thoughts on access methods
Objects should always draw themselves. NOT!
What is virtual abuse?
Example of resource acquisition is initialization
Untyped private data and separation of interface and implementation
New/delete versus using local variables
Separation of implementaion and interface
Support for class invariants
Inheritance and state machines
What makes OOD good?
Polymorphic drawing devices
Discussion of mixin-style inheritance
Concrete mixin-inheritance example
One view of the OO methodological world
Interesting finite-state-machine template
Principles and Patterns of OOD
Principles - open/closed
So that's what its called (or the Liskov Substitution Principle)
Principles - Liskov Substitution Principle
OOD principles - granularity of reuse
Favor object composition over class inheritance
squares and rectangels and inheritance prevention methods
Principle 7 - Acyclic component dependencies
Design Principle 6 - unit of release
Finite State Machines
OOD Principle #8 - direction of stability
OOD principles #9- abstraction and stability
Singleton idiom example
the law of the big three
every class should have these methods
another interpretation of mixin inheritance
common C++ optimizations
simulating read-only data member
nice and regular functions
dynamically ask an object if it understands a method
example implementation of the singleton pattern
destruction of singletons
destruction of singletons followup
polymorphic constructors
example designs using factory patterns
some OOD heuristics
discussion of encapsulation heuristics
controling dependencies
using design patterns - a rationale
squares and rectangles
what is a surrogate?
Ron's member initialization idiom
is a circle an ellipse?
discussion of singletons
design by contract
the case for accessors
class relationships - I
data accessors
testing the validity of an object instance
class relationships II (long)
Writing Simple Generic Containers
LSP, inheritance, and aggregation
designing using get/set methods
avoiding multiple method calls due to multiple inheritance
controlled polymorphism
where to put small utility functions
design by contract in C++
separating interface and implementation using references
requiring overridding of methods
pros/cons of custom constructors/assignment operators
keeping destruction responsibilities at home
thread safe singleton
multiple type qualification
accessors or public members
accessors or public members (2)
non-member functions improve encapsulation
a case for protected virtual functions

This site was grabbed using the TRIAL version of Grab-a-Site. This message does not appear on a licensed copy of Grab-a-Site.