[Paper Review] Fluid Intelligence Doesn't Matter! Effects of Code Examples on the Usability of Crypto APIs
This study investigates how procedural similarity in code examples affects the usability and security of cryptographic APIs among novice developers. Using a controlled experiment with 76 students, it finds that high-procedural-similarity examples significantly improve effectiveness, efficiency, satisfaction, and reduce security bugs—while fluid intelligence (Gf) has negligible influence, suggesting that better examples can compensate for individual cognitive differences in problem-solving ability.
Context: Programmers frequently look for the code of previously solved problems that they can adapt for their own problem. Despite existing example code on the web, on sites like Stack Overflow, cryptographic Application Programming Interfaces (APIs) are co monly misused. There is little known about what makes examples helpful for developers in using crypto APIs. Analogical problem solving is a psychological theory that investigates how people use known solutions to solve new problems. There is evidence that the capacity to reason and solve novel problems a.k.a Fluid Intelligence (Gf ) and structurally and procedurally similar solutions support problem solving. Aim: Our goal is to understand whether similarity and Gf also have an effect in the context of using cryptographic APIs with the help of code examples. Method: We conducted a controlled experiment with 76 student participants developing with or without procedurally similar examples, one of two Java crypto libraries and measured the Gf of the participants as well as the effect on usability (effectiveness, efficiency, satisfaction) and security bugs. Results: We observed a strong effect of code examples with a high procedural similarity on all dependent variables. Fluid intelligence Gf had no effect. It also made no difference which library the participants used. Conclusions: Example code must be more highly similar to a concrete solution, not very abstract and generic to have a positive effect in a development task.
Motivation & Objective
- To investigate whether procedural similarity in code examples improves usability and security when using cryptographic APIs.
- To assess the role of fluid intelligence (Gf) in solving crypto API tasks with the help of examples.
- To compare the usability and security outcomes across two crypto libraries: JDK and Google Tink.
- To evaluate whether real-world example usage (e.g., from Stack Overflow) can substitute for high-similarity examples in reducing errors and improving performance.
Proposed method
- Conducted a controlled experiment with 76 undergraduate students as novice developers.
- Manipulated two independent variables: crypto library (JDK vs. Tink) and example type (CryptoExamples vs. web-searched examples).
- Measured effectiveness, efficiency, satisfaction (via SUS), and static security bugs in final implementations.
- Assessed fluid intelligence (Gf) using the Bochumer Matritzentest (BOMAT) advanced short form.
- Used regression analysis to isolate the effects of Gf and example similarity on outcomes.
- Classified and compared web-searched examples to ensure no high-similarity alternatives were used by control groups.
Experimental results
Research questions
- RQ1Does providing code examples with high procedural similarity improve effectiveness, efficiency, and satisfaction when using cryptographic APIs?
- RQ2To what extent does fluid intelligence (Gf) influence the successful use of cryptographic APIs with the help of examples?
- RQ3Does the choice of crypto library (JDK vs. Tink) affect usability and security outcomes in the presence or absence of high-similarity examples?
- RQ4Are web-searched examples sufficient to match the benefits of high-procedural-similarity examples, or do they differ significantly in impact?
Key findings
- Participants using high-procedural-similarity examples (CryptoExamples) achieved a mean effectiveness of 0.841, compared to 0.376 for those without examples.
- Example users were 269% more efficient, completing 1.287 tasks per hour versus 0.298 in the control group.
- Satisfaction scores (SUS) were significantly higher for example users (STM = 61.6) than for non-example users (SJO = 39.7).
- Security bugs dropped from a mean of 3.28 in the control group to 0.33 in the example group, with 'cipher with no integrity' and 'ECB mode' being the most common issues.
- Fluid intelligence (Gf) had a negligible effect, with regression coefficients (β) close to zero, indicating no meaningful influence on outcomes.
- No significant differences were found between the JDK and Tink libraries in effectiveness, efficiency, or security outcomes, suggesting library choice was not a determining factor.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.