* '''They're hard to use incorrectly.''' Good interfaces are designed to anticipate the kinds of mistakes people might make and to make them difficult -- ideally impossible -- to commit. A GUI might disable or remove commands that make no sense in the current context, for example, and an API might allow parameters to be passed in any order to eliminate "parameters passed out of order" problems.

* '''They're hard to use incorrectly.''' Good interfaces are designed to anticipate the kinds of mistakes people might make and to make them difficult -- ideally impossible -- to commit. A GUI might disable or remove commands that make no sense in the current context, for example, and an API might allow parameters to be passed in any order to eliminate "parameters passed out of order" problems.

+

+

One of the best ways to design interfaces that are easy to use correctly is to exercise them before they exist. That is, mock up a GUI and play with it before any of the underlying code has been created. Write calls to an API before any of the functions have been declared.

Revision as of 23:30, 10 November 2008

One of the most common tasks undertaken during software development is interface specification. Interfaces occur at the highest level of abstraction (user interfaces), at the lowest (function interfaces), and at numerous levels in between (class interfaces, library interfaces, package interfaces, etc.). Regardless of whether you're working with end users to specify how they'll interact with a system under design, working with other developers to specify an API, or declaring functions private to a class you're working on, interface design will be an important part of your job. If you do it well, the resulting interfaces will be a pleasure to use and will actually boost productivity. If you do it poorly, your interfaces will be a constant source of frustration and errors.

Good interfaces have two crucial characteristics:

They're 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 most obvious and easy thing to do. In an API, they almost always pass the correct parameters with the correct types and values, because, again, it's the most obvious and easy thing to do. With interfaces that are easy to use correctly, things just work.

They're hard to use incorrectly. Good interfaces are designed to anticipate the kinds of mistakes people might make and to make them difficult -- ideally impossible -- to commit. A GUI might disable or remove commands that make no sense in the current context, for example, and an API might allow parameters to be passed in any order to eliminate "parameters passed out of order" problems.

One of the best ways to design interfaces that are easy to use correctly is to exercise them before they exist. That is, mock up a GUI and play with it before any of the underlying code has been created. Write calls to an API before any of the functions have been declared.