Home API's to better UI

API's to better UI

The APIs and functions that developers create for software often influence the user interface that is later created by other developers. It's therefore important to consider the interface implications of your API's. Let's take a simple example, the MessageBox function. This function makes it very easy for developers to prompt the user with YES, NO questions and RETRY, CANCEL questions but if you want to ask a YES, MAYBE question you have to do considerably more work. This function makes it hard to answer a multiple choice question. It makes it hard to answer a question that has multiple answers.

Writing an API correctly is really hard because the developer needs to think about three levels of indirection.

1) What do users want to do?
2) What do the developers using my API need to do to enable users to do what they want to do?
3) What do I have to do to help the developers using my API enable the users to do what they want to do?

Often times I see developers skip steps 1 and 2. They get caught up in the details of the API that they are building and forget that the brilliant API and function they wrote don't match the actual day to day needs of their users in step 1.

Before writing your next function ask yourself: How would a developer use my function to help an end user?

This post is licensed under CC BY 4.0 by the author.