Thursday, December 9, 2010

The Singleton Design Pattern

One of the most famous design patterns is Singleton: http://en.wikipedia.org/wiki/Singleton_pattern

Wednesday, December 8, 2010

Sample Code

Sample code should be written in the style of production code, because many times sample code becomes production code.

Reference: “C++ Design” by Steve Weinrich, unpublished manuscript.

Tuesday, December 7, 2010

Header Files

When you publish a header file, anything that you #include into that header file is a part of your interface. “C++ Design” by Steve Weinrich, unpublished manuscript.

Monday, December 6, 2010

Indentation

Indent case statements one space. Indent other statements three spaces.“C++ Design” by Steve Weinrich, unpublished manuscript.

Indentation

Indent public/private/protected access specifiers one space. Indent member variables 3 spaces. “C++ Design” by Steve Weinrich, unpublished manuscript.

Library and Implementation

There are differences between library code and implementation code. Application programmers do not care about creating reusable code. “C++ Design” by Steve Weinrich, unpublished manuscript.

Classes

A class should do only one thing, and one thing only. And do it well.“C++ Design” by Steve Weinrich, unpublished manuscript.