Chapter 55. Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly

Scott Meyers

image with no caption

ONE OF THE MOST COMMON TASKS in software development is interface specification. Interfaces occur at the highest level of abstraction (user interfaces), at the lowest (function interfaces), and at levels in between (class interfaces, library interfaces, etc.). Regardless of whether you work with end users to specify how they’ll interact with a system, collaborate with developers to specify an API, or declare functions private to a class, interface design is an important part of your job. If you do it well, your interfaces will be a pleasure to use and will boost others’ productivity. If you do it poorly, your interfaces will be a source of frustration and errors.

Good interfaces are:

Easy to use correctly

People using a well-designed interface almost always use the interface correctly, because that’s the path of least resistance. In a GUI, they almost always click on the right icon, button, or menu entry, because it’s the obvious and easy thing to do. In an API, they almost always pass the correct parameters with the correct values, because that’s what’s most natural. With interfaces that are easy to use correctly, things just work.

Hard to use incorrectly

Good interfaces anticipate mistakes people might make, and make them difficult—ideally, impossible—to commit. A GUI might disable or remove commands ...

Get 97 Things Every Programmer Should Know now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.