liveBook · Manning

Use case

As explained in The Design of Web APIs, Second Edition

A use case is a scenario describing a user goal and the interactions needed to achieve it.

A use case describes what a user needs to achieve through a high-level action, process, or flow. In API design, it keeps attention on user outcomes rather than databases, implementation components, or programming representations. section 2.1.2 section 2.3.2

Use cases help identify API capabilities before choosing endpoints or data models. Treat each use case as a recipe and its steps as clues for finding generic operations that can serve several contexts. section 2.1 section 2.1.3

Analyze a use case in a practical sequence:

  • Identify the relevant user, such as a customer, consumer, administrator, or end user. section 2.1.2
  • Name the user’s desired outcome in plain language, such as “Buy products” or “Send a message to a friend.” section 2.3.2 section 2.1.2
  • Decompose the outcome into observable steps without prematurely converting them into endpoints or implementation details. section 2.3.3
  • Compare the steps across use cases and extract versatile operations rather than operations tied to one narrow scenario. section 2.1.3
  • Review prioritized, alternative, and problem-focused use cases so edge users and failure situations are not omitted. section 2.3.2 section 2.4.3

From shopping goal to API capabilities

For an online shopping application, “Buy products” is the use case. Its steps are “Add a product to the cart” and “Check out.” Those steps can guide generic operations, while a narrow operation such as “Buy Christmas presents” would unnecessarily constrain reuse. A later design pass can optimize the resulting flow for usability and interoperability. section 2.3.2 section 2.3.3 section 10.2.1

Figure 2.1 We analyze the needs from the Define stage of the API lifecycle to identify the versatile API capabilities that meet them and other unknown needs. We’ll iterate with the Define and Design stages stakeholders.
figure

Use the lifecycle view to place use-case analysis after defining user needs and before programming-interface design, with iteration among stakeholders. section 2.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Defines goals and decomposes steps, then examines alternatives and flow optimization, but defers programming-interface design.
Examples
Uses messaging, online shopping, microwave cooking, food delivery, and money-transfer flows to illustrate goals, steps, and operations.
What it assumes
Assumes identifiable users and needs, while teaching capability analysis in plain language before programming concerns.
What you can do after
Apply it to identify, prioritize, decompose, and validate API capabilities before selecting interface representations.
How it connects
Connects users, API capabilities, operations, user needs, data modeling, programming interfaces, and interoperability.

Also explained in

Compare how 7 books explain use case →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.