Application Programming Interfaces (APIs) are critical to improve developer productivity: developers can reuse a significant amount of functionality instead of writing it themselves.
The flip side of API popularity is that APIs are large and numerous: developers often spend significant time searching for the functionality they need. Worse, they may not even be aware that an API exists for a given task and thus waste time reinventing the wheel.
In this talk we want to propose a way to obtain API fluency: the ability for developers to internalize how an API is used. The more developers have internalized the APIs they need, the more productive they can become. We propose an approach to improve API fluency, that means to remember APIs and to become more productive, based on the game of spaced repetition that we all know in forms of flash cards.
We implemented the game as a prototype and will present this during the talk.
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
SFScon19 - Andrea Janes - API fluency remembering APIs to become more effective
1. API Fluency
Romain Robbes, Mircea Lungu, Andrea Janes
IT University of
Copenhagen, Denmark
Free University of
Bozen-Bolzano, Italy
Free University of
Bozen-Bolzano, Italy
2. … large
… numerous
… seldom needed
… changing over time
… not well documented
APIs can be …
2
Java Development Kit (Version 9) API Specification contains 6005 interfaces and classes
Android Platform API (API level 28) includes 4389 interfaces and classes
Maven contains 12.6 million libraries and npm 700 thousand packaged modules
3. Motivating Example 1
• Intermediate JavaScript programmer
• Browses the documentation of Date
• Discovers
• getMonth(),
• getYear(), and
• getDay()
• Is not aware of Date.prototype.toJSON()
• Waste of time
3
Charlie
Front-end
JavaScript
Back-end
Python
4. Motivating Example 2
4
Bob
• Experienced, new to Android development
• Needs to save some data on a mobile device
• Searches to look for a solution on
StackOverflow
• Time-consuming, make him lose focus from
the original task
Android
5. Motivating Example 3
5
Ada
• Working daily with C#.
• Wants to write a shell script
• Does not remember the syntax for
conditional expressions in BASH
• She searches online for “bash if file exists”
• She notices that she was searching for the
same thing in the past and knows that she
will have to search for it again in the future.
Bash
>
6. API Knowledge
6
0 Awareness Fluency
80% of StackOverflow users visit
the site multiple times per week;
more than 30% visit it multiple
times per day.
Don‘t know what they do not knowFluency: the capacity to conduct a task both
correctly and rapidly
Complete API fluency is unfeasible; how can we
balance API fluency, awareness, and time
constraints, so that developers can effectively
use APIs?
7. The new idea
• Learning a human
language and learning
an API involve
learning
• a significant amount
of “vocabulary”
• Semantics: what
components mean
• Syntax: how to
combine them
7
Recalling time
Memoryretention(%)
60
70
80
90
100
50
40
30
20
10
Forgetting curve of Ebbinghaus
20 minutes
1 hour
8. Spaced repetition
• In language learning,
spaced repetition has
been shown to be very
effective to learn—and
retain—vocabulary.
• Stimulate developers to
invest a modest amount
of time to
• extend their API fluency
• increase their awareness
of API possibly useful in
the future
8
Recalling time
Memoryretention(%)
2nd1st 3rd 4th 5th
60
70
80
90
100
50
40
30
20
10
9. The new idea
• Spaced repetition can be
implemented with
physical flash cards, or in
software (e.g., Anki)
• Software manages the
spaced repetition
algorithm.
• The user needs to review
concepts and indicate
whether the recall was
successful or not.
9
10. Limitations and Design Considerations
• Flash cards are created manually,
which requires a lot of effort.
• APIs can be very large: it can be
overwhelming.
• APIs are not quite like vocabulary:
API elements may have
• parameters with a specific order,
• preconditions,
• exceptions,
• be thread-safe or not,
• side-effect free or not,
• be part of a sequence of calls.
• Personalizing learning to the
• context,
• stated needs,
• interests, and
• rate of learning of every developer
• Providing developers with a
manageable amount of API
elements to learn
• Tailoring spaced repetition
concepts to learn APIs
10
11. Towards API
• Build an API Curriculum: use large-scale mining determine the
relative importance of API elements based on usage frequency.
• Place the learner on the Curriculum: mine the developer’s
repositories to predict and to reinforce knowledge of API elements
already in use.
• Tailoring spaced repetition for APIs: adapt the level of detail and the
exercises shown to developers depending on how much they know
the underlying API.
11
0 Awareness Fluency
12. • Identifying API learning difficulties: system can be combined with
StackOverflow to detect API elements that are particularly difficult
to master.
• Monitoring API fluency:
• IDE plugin monitoring user interactions
• Web browser plugin, to track search queries.
• Dealing with data scarcity:
• Approach depends on API usage data, which makes it appropriate for popular
APIs
• Investigate how the approach can work with limited amounts of data, e.g.,
leveraging structure of API
Towards API
12
0 Awareness Fluency