Recommending Proper API Code Examples for Documentation Purpose - Lee Wei Mar; Ye-Chi Wu; Jiau, Hewijin Christine (2011 18th Asia-Pacific Software Engineering Conference, 2011)
Code examples are important resources for expressing correct application programming interface (API) usages. However, many framework and library APIs fail in offering sufficient code examples in corresponding API documentations. This is because constructing proper code examples for documentation purpose takes significant developers' efforts. To reduce such effort, this work proposes a methodology, PropER-Doc, that recommends proper code examples for documentation purpose. PropER-Doc accepts queries from API developers and utilizes code search engines (CSEs) to collect corresponding code example candidates. The structural and conceptual links between API elements are captured from the API implementation and available API documents to guide candidate recommendation. During recommendation, PropER-Doc groups collected candidates based on involved API types for distinguishing different API usages. To assist API developers in selecting proper candidates, a diagrammatic presentation and three code example appropriateness metrics are also developed in PropER-Doc. Two case studies on Eclipse JDT framework are conducted to confirm the effectiveness of PropER-Doc.