Example Mining - Assisting Example Creation to Enhance Code Comprehension
Programmers often use examples with concrete values to better understand code. Code by itself is abstract, which empowers it to be used for a variety of uses, but can be difficult to grasp by developers. Babylonian Programming addresses this by allowing programmers to concretize their code by defining and visualizing examples directly in the code itself while editing.
Currently, Babylonian Programming implementations such as Babylonian/S require programmers to define examples manually. For examples containing small objects this is straightforward, however when creating large or complex objects it is not. Sometimes, workarounds such as copying existing code pieces or trying to recreate existing objects are used to reuse information already present in the system, but these workarounds can be error-prone and also time-consuming.
In this paper, we propose example mining to address this issue by providing techniques and integrated tools to mine examples from existing sources similar to concepts from run-time tracing and test case extraction. Example mining introduces concepts to mine examples from tests, debugging sessions, and traces of actual usage of the system under development. All tools were implemented for Babylonian/S in Squeak/Smalltalk.
We demonstrate the usefulness of the tools through walkthroughs. Our tools provide examples for many methods immediately and automatically. As a consequence, programmers have more immediate access to dynamic feedback on their abstract code, making code comprehension and debugging more effective.