Advice from the GoF: Design to Interfaces

Behavior in object-oriented systems is a reflection of the interaction of objects. If you change the objects, or alter their interaction, the resulting behavior changes.

This means that objects have relationships to other objects, usually through references that are used to call methods. The Gang of Four recommends that these relationships should be defined based on how the objects look to each other, not by how the objects are implemented.

It’s easy to misinterpret this to mean, “every object should have a separate interface,” referring to the type “interface” that many languages provide. But the advice was not meant to indicate any language-specific idiom.

An “interface” means any defined means of communication. A method signature is an interface. The collective public methods of a class are an interface. An abstract class is an interface. And so forth.

What is meant is that the interface of any interaction should be based on what is needed by the clients and not the way the behavior is implemented. Changing the implementation should not affect the interface, and thus should not affect the clients.

In other words, the full version of this is “design to interfaces (how an object behaves) rather than implementations.”

This is Scott Bain. Visit us at

2 thoughts on “Advice from the GoF: Design to Interfaces”

  1. Well said, and I’ll add to this that your user interface should be designed from the perspective of how your user interfaces with it, not how you would build it.
    So an online shopping website should be designed from the perspective of an online shopper, what do they do first, then second, then next. Notice how this is radically different from ‘we need to set up a domain’, ‘we need a shopping cart widget’, ‘we need to accept credit cards’, and etc.
    At we believe the heart of good interface design got lost in the emergence of agile, and we welcome influencers such as Scott to bring this back!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.