Context: Application Programming Interface (API) code examples are an essential knowledge resource for learning APIs. However, a few user studies have explored how the structural characteristics of the sourcecode in ...
详细信息
ISBN:
(纸本)9798400705861
Context: Application Programming Interface (API) code examples are an essential knowledge resource for learning APIs. However, a few user studies have explored how the structural characteristics of the sourcecode in code examples impact their comprehensibility and reusability. Objectives: We investigated whether the (a) linearity and (b) length of the sourcecode in API code examples affect users' performance in terms of correctness and time spent. We also collected subjective ratings. Methods: We conducted an online controlled code comprehension experiment with 61 Java developers. As a case study, we used the API code examples from the Joda-Time Java library. We had participants perform code comprehension and reuse tasks on variants of the example with different lengths and degrees of linearity. Findings: Participants demonstrated faster reaction times when exposed to linear code examples. However, no substantial differences in correctness or subjective ratings were observed. Implications: Our findings suggest that the linear presentation of a sourcecode may enhance initial example understanding and reusability. This, in turn, may provide API developers with some insights into the effective structuring of their API code examples. However, we highlight the need for further investigation.
Background: The way howprogrammers comprehend sourcecode depends on several factors, including the sourcecode itself and the programmer. Recent studies showed that novice programmers tend to read sourcecode more li...
详细信息
ISBN:
(纸本)9781450379588
Background: The way howprogrammers comprehend sourcecode depends on several factors, including the sourcecode itself and the programmer. Recent studies showed that novice programmers tend to read sourcecode more like natural language text, whereas experts tend to follow the program execution flow. But, it is unknown how the linearity of sourcecode and the comprehension strategy influence programmers' linearity of reading order. Objective: We replicate two previous studies with the aim of additionally providing empirical evidence on the influencing effects of linearity of sourcecode and programmers' comprehension strategy on linearity of reading order. Methods: To understand the effects of linearity of sourcecode on reading order, we conducted a non-exact replication of studies by Busjahn et al. and Peachock et al., which compared the reading order of novice and expert programmers. Like the original studies, we used an eye-tracker to record the eye movements of participants (12 novice and 19 intermediate programmers). Results: In line with Busjahn et al. (but different from Peachock et al.), we found that experience modulates the reading behavior of participants. However, the linearity of sourcecode has an even stronger effect on reading order than experience, whereas the comprehension strategy has a minor effect. Implications: Our results demonstrate that studies on the reading behavior of programmers must carefully select sourcecode snippets to control the influence of confounding factors. Furthermore, we identify a need for further studies on how programmers should structure sourcecode to align it with their natural reading behavior to ease program comprehension.
暂无评论