Background: Modern software systems are commonly built on the top of frameworks. To accelerate the learning process of features provided by frameworks, code samples are made available to assist developers. However, we know little about how code samples are actually developed. Aims: In this paper, we aim to fill this gap by assessing the characteristics of framework code samples. We provide insights on how code samples are maintained and used by developers. Method: We analyze 233 code samples of Android and SpringBoot, and assess aspects related to their source code, evolution, popularity, and client usage. Results: We find that most code samples are small and simple, provide a working environment to the clients, and rely on automated build tools. They change frequently over time, for example, to adapt to new framework versions. We also detect that clients commonly fork the code samples, however, they rarely modify them. Conclusions: We provide a set of lessons learned and implications to creators and clients of code samples to improve maintenance and usage activities.
翻译:背景:现代软件系统通常建在框架的顶端。为了加快框架提供的特征的学习过程,提供了代码样本,以协助开发者。然而,我们很少知道代码样本是如何实际开发的。目的:在本文件中,我们的目标是通过评估框架代码样本的特征来填补这一空白。我们深入了解开发者如何维护和使用代码样本。方法:我们分析了Android和SpringBoot的233个代码样本,并评估了与其源代码、进化、普及程度和客户使用有关的方方面面。结果:我们发现大多数代码样本都是小而简单的,为客户提供了一个工作环境,并依靠自动化的建设工具。它们经常变化,例如,以适应新的框架版本。我们还发现客户通常将代码样本输入,但很少对其进行修改。结论:我们向代码样本的创建者和客户提供了一套经验教训和所涉问题,以改进维护和使用活动。