08. Riel’s Heuristics

Arthur Riel, 1996. 60 guidelines/heuristics for OO programming

Hide data within its class:

A class should not depend on its users:

Minimize the number of public methods:

Have a minimal public interface:

Avoid interface bloat:

Avoid interface pollution:

Nil or export-coupling only:

One key abstraction:

Keep related data and behavior in one place:

Separate non-communicating behavior:

Model classes, not roles:

Distribute system intelligence:

Avoid God classes:

Beware of many accessors:

Beware of non-communicating methods:

Interfaces should be dependent on the model:

Model the real world:

Eliminate irrelevant classes

Avoid verb classes:

Agent classes irrelevant:

Minimize class collaborations:

Minimize method collaborations:

Minimize methods between collaborators:

Minimize fan-out:

Containment implies uses:

Methods should use most fields of a class:

Limit compositions in a class:

Contain contents, not parents:

Contained objects should not be able to use each other: