Availability and Usage of Platform-Specific APIs: A First Empirical Study (MSR 2024)

andrehoraa 98 views 12 slides Jul 25, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

A platform-specific API is an API implemented for a particular platform (e.g., operating system), therefore, it may not work on other platforms than the target one. In this paper, we propose a first empirical study to assess the availability and usage of platform-specific APIs. We analyze the platfo...


Slide Content

Availability and Usage of Platform-Specific APIs:
A First Empirical Study
Ricardo Job and André Hora

Software Runs on Multiple Platforms
2
Diversity of Development Environments
https://www.jetbrains.com/lp/devecosystem-2023/development/#os_devenv

Platform-Specific API
API that is implemented for a particular platform,
therefore, it may not work on other platforms than the
target one.
3

signal.setitimer
if sys.platform != "win32":
# Clear the alarm signal set by
# ioloop.set_blocking_log_threshold so it doesn't fire
# after the exec.
signal.setitimer(signal.ITIMER_REAL, 0, 0)
4https://github.com/tornadoweb/tornado/blob/f5df43f26bb4d00759176f7cbec8bdce69f2f4f/tornado/autoreload.py#L206-L210

Platform-Specific APIs
The Python Standard Library Documentation (version 3.11)
5
https://docs.python.org/3.11/library/

Platform-Specific APIs
6
RQ1: What is the availability of platform-specific APIs?
RQ2: What is the usage of platform-specific APIs?

RQ1: Availability of Platform-Specific APIs
Study Design
7
availability notes
8,795 APIs
1,841 Platform-Specific APIs
version 3.11

RQ1: Availability of Platform-Specific APIs
Major Findings
8
21% of the APIs are platform-specific.
15% of the modules contain at least one platform-specific API.
17 different platforms with availability restrictions.

RQ2: Usage of Platform-Specific APIs
Study Design
9
AST-based
analysis
1,841
Platform-Specific APIs
100
Software Systems
19,288
Usage instances
683
Distinct Platform-Specific APIs

RQ2: Usage of Platform-Specific APIs
Major Findings
10
Platform-specific APIs are largely used in Python.
19K usages of platform-specific APIs in all 100 projects.
Top-3: asyncio.sleep, subprocess.Popen, and subprocess.PIPE.

Implications
Practitioners and Researchers
•Platform-specific APIs are widespread in the Python Standard
Library but there is a lack of dedicated documentation.
•Platform-specific APIs are largely used by Python systems but
there is an absence of best practices and anti-patterns.
11

Availability and Usage of Platform-Specific APIs:
A First Empirical Study
[email protected]
Tags