Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Part Four.  Cognizant Conversions


Chapter 22. Bolt-ins

Bolt: A strong pin, of iron or other material, used to fasten or hold something in place, often having a head at one end and screw thread cut upon the other end.

The term bolt-in was originally coined, to the best of my knowledge, by my friends and former colleagues Leigh and Scott,[1] who have a software consultancy based in Sydney, Australia. Generally speaking, bolt-ins "bolt in" significant enhancing functionality around existing classes. This sounds similar to the concept of veneers, and indeed bolt-ins can be considered a closely related concept. However, they are a whole lot more substantive, and they have fewer constraints than veneers.

[1] The impossibly tall Perry brothers.

Definition: Bolt-ins

Bolt-ins are template classes with the following characteristics:

  1. They derive, usually publicly, from their primary parameterizing type.

  2. They accommodate the polymorphic nature of their primary parameterizing type. Usually they also adhere to the nature, but this is not always the case, and they may define virtual methods of their own, in addition to overriding those defined by the primary parameterizing type.

  3. They may increase the footprint of the primary parameterizing type by the definition of member variables, virtual functions, and additional inheritance from nonempty types.


There is a significant gray area between veneers (see Chapter 21) and bolt-ins, but they have different intents. Where veneers are, by and large, concerned with polishing existing types, bolt-ins are concerned with significantly changing or completing the behavioral nature of (often partially defined) types.


      Previous section   Next section