The Selfish Class


By: B. Foote, J. Yoder

Summary: What can be done to encourage reuse.

Pattern: The Selfish Class Pattern Language


Published in: PLoPD3
Pages: 452-470
Category: Design Process

What can be done to encourage reuse.

Url: http://www.laputan.org/selfish/selfish.html

Pattern: The Selfish Class

Pages: 453-455

Software is a pool of potentially reusable artifacts. For these artifacts to flourish, programmers must find them appealing, so, be sure they reliably solve a useful problem in a direct and comprehensible fashion. Make them widely available.

Pattern: Works Out of the Box

Pages: 455-459

If it's too much trouble to reuse an artifact, programmers may not bother. Design objects that exhibit reasonable behavior with default arguments. Provide everything a programmer needs to try out these objects. Make it as easy as possible for designers to see a working example.

Pattern: Low Surface-to-Volume Ratio

Pages: 459-462

Objects with complex interfaces that conceal few of their internals are hard to understand and reuse. Design objects with low surface-to-volume ratios, that is, objects with small external interfaces, or surface areas, that encapsulate a large volume of internal complexity.

Pattern: Gentle Learning Curve

Pages: 462-464

Complex interfaces can overwhelm novices. Design artifacts to allow users to start with a simple subset of their capabilities and gradually master more complex capabilities as they go along.

Pattern: Programming-by-Difference

Pages: 464-466

You want an artifact to adapt to requirements while maintaining its integrity. Use translators, subclasses, and/or wrappers to supply new states or behavior while leaving the original artifact intact.

Pattern: First One's Free

Pages: 466-467

Even a well-designed software artifact will not survive if no one sees it. Give it away.

Pattern: Winning Team

Pages: 467-469

Even a well-designed software artifact will not survive if no one sees it. Bundle it with a popular platform.