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:
- You have a
struct
.
- You replace
struct
with class
.
- You make all data members
private
.
- 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