Wednesday, Afternoon
Improving Reuse in C++ Through Policy Classes (Example: Designing the Smart Pointer of the 2000's)
Convention Ctr – 211C
Andrei Alexandrescu, RealNetworks, Inc.

This tutorial has a worthy goal: together, the presenter and the attendees will implement a generic smart pointer, a highly functional piece of code that sports configurable behaviors and an amazing rate of reuse. Smart pointers are hard to get right. But because they nicely automate things that are hard to manage by hand, smart pointers are an essential ingredient of robust C++ applications. As small as they are, smart pointers can make the difference between failure and success.

The implementation presented uses a new class design technique - Policy Classes. Policy Classes are specialized structural and behavioral entities that decide one well-defined aspect of a complex behavior. The advantage of Policy Classes is that they can be combined freely in concrete classes, thus leading to combinatorial reuse. Through only six mixable-and-matchable policy classes, SmartPtr achieves about 160 different predefined behaviors. Clients can define their own policies.

Participants will learn new C++ idioms for improving code reuse, and how to dovetail generic and object-oriented programming techniques in class design.

Presentation Format: A highly interactive presentation, garnished with questions and whiteboard examples.

Attendee Background: Attendees are advanced C++ programmers and system architects. Minimal C++ template knowledge is assumed.

Andrei Alexandrescu is Development Manager with RealNetworks, Inc. He is a columnist for C++ Report, a former contributor to C/C++ Users Journal, and the author of the upcoming book “Design with C++” (tentative title), Addison Wesley Longman, Reading, MA. Andrei holds an MS degree in Electronics from the Polytechnic University of Bucharest.

at a Glance
Tutorials by Track
Full Description
of all Tutorials
Final Program

 OOPSLA'98 Home