How to apply UX principles and methods to API usability?
Tao Dong, PhD
Sr. UX Researcher, Google
Flutter.io
Confidential + Proprietary
My Background
Now:
In the past:
Context of this talk: Flutter
A Demo in Flutter Gallery
Goals for this talk
What I hope you can get out of my talk:
What DX can learn from UX?
Agenda
1. What is API usability?
What is API usability
Column({
Key key,
MainAxisAlignment mainAxisAlignment: MainAxisAlignment.start,
MainAxisSize mainAxisSize: MainAxisSize.max,
CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.center,
TextDirection textDirection,
VerticalDirection verticalDirection: VerticalDirection.down,
TextBaseline textBaseline,
List<Widget> children: const []
})
The three pillars of API usability
API Design
Documentation
Tooling
Why is API usability important?
API usability issues can lead to:
Use Pleasantly
Use Efficiently
Use Correctly
2. How to make APIs more usable?
Some lessons learned from UX Research on Flutter
Lesson 1: Reduce Context Switching
Programmers move faster if they don’t have to leave their code editor to find the information they need.
Reduce Context Switching
Programmers move faster if they don’t have to leave their code editor to find the information they need.
Reduce Context Switching
Programmers move faster if they don’t have to leave their code editor to find the information they need.
Browser
IDE
Code Template
Autocomplete
Quick Documentation
API References
Tutorials, Videos, Forums
More time
& frictions
Jump to Source
Lesson 2: Help Build Mental Models
For complex APIs, help the user build a clear mental model by mapping concepts to visualizations and metaphors.
What is a mental model?
A classic example: will setting the thermostat to 90° warm up the room sooner than setting it to 80°?
Help Build Mental Models
For complex APIs, help the user build a clear mental model by mapping concepts to visualizations and metaphors.
AnimationController({double value, Duration duration, String debugLabel, double lowerBound: 0.0, double upperBound: 1.0, @required TickerProvider vsync })
Tween({T begin, T end })
CurveTween({@required Curve curve })
CurvedAnimation({@required Animation<double> parent, @required Curve curve, Curve reverseCurve })
How do these animation building blocks fit together?
Visualize the Conceptual Model
AnimationController.duration
AnimationController.value
.stop()
.forward()
AnimationController.reset()
timeDilation
CurveTween.curve
Tween <int>
Tween.end
Tween.begin
Animation <= Tween.animate(controller)
Lesson 3: Speak Your Users’ Language
Name your API with words your target users are familiar with and can reasonably guess without look it up in the API doc.
Speak Your Users’ Language
Naming your API with words familiar to your users makes the API easier to discover.
Quiz: Can you guess what a UI widget called Block does?
Answer: Nobody knows.
Speak Your Users’ Language
Naming your API with words familiar to your users makes the API easier to discover.
What about the name ListView?
Speak Your Users’ Language
Naming your API with words familiar to your users makes the API easier to discover.
Block was the old name of ListView until early 2017
Jakob Nielson’s Usability Heuristics
2. Match between system and the real world
The system should speak the users' language, with words, phrases and concepts familiar to the user, rather than system-oriented terms. Follow real-world conventions, making information appear in a natural and logical order.
Lesson 4: Enable Programming by Example
Examples have become the de facto way to learn programming and API.
Enable Programming by Example
Having examples somewhere is not enough. It is critical to allow the developer to quickly locate and evaluate the relevance of an example.
“This is nice, linking to actual code. But it’s very difficult to choose which one you’d like to use unless you see the output.” -- Study Participant
Enable Programming by Example
Having examples somewhere is not enough. It is critical to allow the developer to quickly locate and evaluate the relevance of an example.
Lesson 5: Promote Recognition Rather than Recall
To the human brain, recognizing the right choice is cheap, while recalling it from nothing is expensive.
Examples of Recall vs. Recognition in UI
Promote Recognition Rather than Recall
To the human brain, recognizing the right choice is cheap, while recall is expensive.
Promote Recognition Rather than Recall
To the human brain, recognizing the right choice is cheap, while recall is expensive.
Recap: Five API Usability Lessons
3. How to identify API usability issues?
Applying usability testing to APIs
Observing using the API in action
Photo by Charles Deluvio 🇵🇭🇨🇦 on Unsplash
Confidential + Proprietary
Confidential + Proprietary
4 steps in conducting an API usability test
1 | Prepare the API you want to test |
2 | Specify a representative programming task that can be accomplished using the API |
3 | Moderate and observe programmers attempting to accomplish the task |
4 | Evaluate results, decide if changes to API, tooling, or documentation are needed |
1. Prepare the API you want to test
For example, in the “build a simple UI” study, we wanted to cover the following APIs
2. Specify a representative programming task that can be accomplished using the API
Expected results
Reference Implementation
3. Moderate and observe programmers attempting to accomplish the task
The set-up:
Study Room
Observation Room
Participant
Moderator
Livestream
Remind the participant it’s a test of the API not a test of how well they code
“Please remember that we are testing the developer experience of Flutter -- it’s not a test of you. So anything you find confusing is something we need to fix.”
Ask the participant to “think aloud”
“As you work on the programing exercise, please ‘think aloud.’ That means verbally describing your mental process as it develops, including the doubts and questions you have, the solution strategies you consider, and the reasons that justify your decisions.”
An example of the “think aloud” protocol
Why is “think aloud” important?
Because if we ask the participant to recount their experience at a later time, we run the risk of “forcing subjects to infer rather than remember their mental processes.” (Ericsson & Simon, 1980)
More tips for effective observation
4. Evaluate results, decide if changes to API, tooling, or documentation are needed
“Now it’s the time to let the data speak!”
“But what is the data?”
Data from usability testing, ordered by reliability
Summary
Got questions or comments? Feel free to contact me at dongtao@acm.org or @taodong on Twitter.
Thank you!