Structification

Structification results in an implementation and interface that are closely related; the interface merely parrots the internal implementation of the class. The result is almost never a good class definition. Structification is a technique for class creation that results from the following sequence of events:

  1. You have a struct.
  2. You replace struct with class.
  3. You make all data members private.
  4. For every data member foo, you define GetFoo and SetFoo.
Get and set functions are a natural part of a well-designed interface, but an interface that is long on state-related functions and short on members that actually perform an action is a sign of a bad design. Avoid it.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker