The Developer 2/2013

Page 72

Usability—as defined in wikipedia—is the ease of use and learnability of a human-made object. The object of use can be a software application, website, book, tool, machine, process, or anything a human interacts with.

An very brief introduction to

API Usability By Giovanni Asproni

When we talk about it in the software world, we typically refer to how easy it is for end users to interact with an application through a graphical user interface (GUI). The easier for a user is to learn how to use the application to achieve his goals, the more usable the application is. However, the same idea can be applied to APIs—in this context an API is any well-defined interface that defines the service that one component, module, or application provides to other software elements (http://www.ufpa.br/cdesouza/pub/ p390-desouza.pdf)—we just need to replace “application” with “API” and “user” with “programmer”: the easier is for a programmer to learn how to use the API to achieve his goals, the more usable the API is. Note that, based on the definition given above, all programmers are API writers. In fact, when working on non trivial systems, we always end up implementing one or, more often, several APIs to accomplish our tasks, either because the product itself is a library or framework to be used by third parties, or because we need to group together related pieces of functionality in frameworks, packages and libraries that are then used to build our applications. Despite the fact that the literature on API usability is not very rich, the sub-

72

ject is very important since a usable API helps • To avoid many mistakes that can introduce bugs in applications • To increase productivity by making it easier to implement functionality better and faster • To keep the code clean and maintainable • Newcomers to learn the ropes of a new application more quickly Most programmers have an intuitive grasp of usability. However, very few think of it in a structured way and know how to evaluate the implications their design choices have on it in an objective manner—we often think our code is perfect until someone else tries to use it and then gives us feedback that makes us reconsider our decisions. In the following I’ll briefly introduce some of the basics. AFFORDANCES A central concept when talking about usability is the concept of affordance, i.e. (http://en.wikipedia.org/wiki/ Affordance): A quality of an object, or an environment, that allows an individual to perform an action.

For example, a door affords to be opened and closed, or, for an example in a software context, the java.io API affords reading and writing a file. Affordances are not always obvious. An everyday example of that are doors that should be pushed to be opened, but have a handle that invite us to pull them instead. For an equivalent software example, try to read a text file line by line using Java 6 or earlier—it is definitely possible, but certainly not intuitive (I’ll leave this as an exercise to the readers). The more visible the affordances are, the more usable the API will be. COGNITIVE DIMENSIONS Measuring usability is a complex process. The following is a list of some (not all) important cognitive dimen-


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.