Index Musings on computing

OK, they've got my number

I don't program like this any more, honest.

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 perform an action is a sign of a bad design. Avoid it.

(Quoted without permission.)

Copyright © Paul John Floyd 2002, 2004, 2006

Valid HTML 4.01!