Back to search

École de technologie supérieure

Towards recommending code examples using informal documentation

Abstract

dc:description

Past and recent research in the code example recommendation area has been accomplished to guide developers during their software development tasks. In effect, programmers spend a considerable amount of time on the Internet to find the relevant code examples to their tasks using source code of open-source projects and–or informal documentation. Informal documentation is an invaluable resource for finding helpful code examples trapped in Stack Overflow discussions, forums, emails exchanged between developers, etc. In our research, we have focused on Stack Overflow, which is one of the most popular resources for software developers’ discussions on different topics. We have collected and recommended the best code examples in the Java programming language that have been labeled as the answer code examples in order to increase the quality of the recommended code examples. Our approach has applied the Bidirectional Encoder Representations from Transformers (BERT), a model for text representation that is able to extract the semantic information of textual data properly. We have used BERT, in a first stage, to encode code examples with numerical vectors. In the next step, we have applied Locality-sensitive hashing (LSH) that has been leveraged to find the Approximate Nearest Neighbors (ANN). In our research, we have applied two versions of this approach, i.e., the Random Hyperplane-based and the Query-Aware LSH. We have compared these two algorithms based on four parameters including HitRate, Mean Reciprocal Rank (MRR), Average Execution Time, and Relevance. The findings of our study have shown that the Query-Aware (QA) approach performs better, in terms of HitRate, compared to the Random Hyperplane-based (RH) (from 20% to 35%) for query pairs respectively. QA is at least 4 times faster than RH for creating Hashing tables and assigning data samples to buckets. it returns code examples in milliseconds (ms), however, it takes seconds (sec) for RH to recommend the code examples. The QA algorithm takes into account the query, i.e., a Natural Language query or an API method and it is able to filter out the irrelevant code examples at the initial steps of the algorithm. Additionally, based on the evaluation of the obtained results, i.e., recommended code examples by two experienced software developers and the metrics’ values, QA approach recommends more similar examples based on the query values compared to the RH approach.

Degree

thesis:*
Name thesis:degree_name
Mémoire de maîtrise électronique
Level thesis:degree_level
masters
Grantor dc:publisher
École de technologie supérieure
Year dc:date
2023

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Rahmani, Sajjad

Subjects

dc:subject × 1

Rights

Language dc:language
en

Identifiers

dc:identifier.*
Identifier
INSERT-YOUR-LIBRARY-ID-HERE3202

Chain of custody

source
Harvested from
ETS (Quebec)
Base URL
espace.etsmtl.ca/cgi/oai2
Last updated
2026-11-18
Source record
OAI-PMH GetRecord
citation

Rahmani, Sajjad. Towards recommending code examples using informal documentation. masters thesis, École de technologie supérieure, 2023.