13 research outputs found
Analyzing the co-evolution of comments and source code
Source code comments are a valuable instrument to preserve design decisions and to communicate the intent of the code to programmers and maintainers. Nevertheless, commenting source code and keeping comments up-to-date is often neglected for reasons of time or programmers obliviousness. In this paper, we investigate the question whether developers comment their code and to what extent they add comments or adapt them when they evolve the code. We present an approach to associate comments with source code entities to track their co-evolution over multiple versions. A set of heuristics are used to decide whether a comment is associated with its preceding or its succeeding source code entity. We analyzed the co-evolution of code and comments in eight different open source and closed source software systems. We found with statistical significance that (1) the relative amount of comments and source code grows at about the same rate; (2) the type of a source code entity, such as a method declaration or an if-statement, has a significant influence on whether or not it gets commented; (3) in six out of the eight systems, code and comments co-evolve in 90% of the cases; and (4) surprisingly, API changes and comments do not co-evolve but they are re-documented in a later revision. As a result, our approach enables a quantitative assessment of the commenting process in a software system. We can, therefore, leverage the results to provide feedback during development to increase the awareness of when to add comments or when to adapt comments because of source code change
The Co-Evolution of Test Maintenance and Code Maintenance through the lens of Fine-Grained Semantic Changes
Automatic testing is a widely adopted technique for improving software
quality. Software developers add, remove and update test methods and test
classes as part of the software development process as well as during the
evolution phase, following the initial release. In this work we conduct a large
scale study of 61 popular open source projects and report the relationships we
have established between test maintenance, production code maintenance, and
semantic changes (e.g, statement added, method removed, etc.). performed in
developers' commits.
We build predictive models, and show that the number of tests in a software
project can be well predicted by employing code maintenance profiles (i.e., how
many commits were performed in each of the maintenance activities: corrective,
perfective, adaptive). Our findings also reveal that more often than not,
developers perform code fixes without performing complementary test maintenance
in the same commit (e.g., update an existing test or add a new one). When
developers do perform test maintenance, it is likely to be affected by the
semantic changes they perform as part of their commit.
Our work is based on studying 61 popular open source projects, comprised of
over 240,000 commits consisting of over 16,000,000 semantic change type
instances, performed by over 4,000 software engineers.Comment: postprint, ICSME 201
Extracting Build Changes with BUILDDIFF
Build systems are an essential part of modern software engineering projects.
As software projects change continuously, it is crucial to understand how the
build system changes because neglecting its maintenance can lead to expensive
build breakage. Recent studies have investigated the (co-)evolution of build
configurations and reasons for build breakage, but they did this only on a
coarse grained level. In this paper, we present BUILDDIFF, an approach to
extract detailed build changes from MAVEN build files and classify them into 95
change types. In a manual evaluation of 400 build changing commits, we show
that BUILDDIFF can extract and classify build changes with an average precision
and recall of 0.96 and 0.98, respectively. We then present two studies using
the build changes extracted from 30 open source Java projects to study the
frequency and time of build changes. The results show that the top 10 most
frequent change types account for 73% of the build changes. Among them, changes
to version numbers and changes to dependencies of the projects occur most
frequently. Furthermore, our results show that build changes occur frequently
around releases. With these results, we provide the basis for further research,
such as for analyzing the (co-)evolution of build files with other artifacts or
improving effort estimation approaches. Furthermore, our detailed change
information enables improvements of refactoring approaches for build
configurations and improvements of models to identify error-prone build files.Comment: Accepted at the International Conference of Mining Software
Repositories (MSR), 201
Speculative Analysis for Quality Assessment of Code Comments
Previous studies have shown that high-quality code comments assist developers
in program comprehension and maintenance tasks. However, the semi-structured
nature of comments, unclear conventions for writing good comments, and the lack
of quality assessment tools for all aspects of comments make their evaluation
and maintenance a non-trivial problem. To achieve high-quality comments, we
need a deeper understanding of code comment characteristics and the practices
developers follow. In this thesis, we approach the problem of assessing comment
quality from three different perspectives: what developers ask about commenting
practices, what they write in comments, and how researchers support them in
assessing comment quality.
Our preliminary findings show that developers embed various kinds of
information in class comments across programming languages. Still, they face
problems in locating relevant guidelines to write consistent and informative
comments, verifying the adherence of their comments to the guidelines, and
evaluating the overall state of comment quality. To help developers and
researchers in building comment quality assessment tools, we provide: (i) an
empirically validated taxonomy of comment convention-related questions from
various community forums, (ii) an empirically validated taxonomy of comment
information types from various programming languages, (iii) a
language-independent approach to automatically identify the information types,
and (iv) a comment quality taxonomy prepared from a systematic literature
review.Comment: 5 pages, 1 figure, conferenc
Deep Just-In-Time Inconsistency Detection Between Comments and Source Code
Natural language comments convey key aspects of source code such as
implementation, usage, and pre- and post-conditions. Failure to update comments
accordingly when the corresponding code is modified introduces inconsistencies,
which is known to lead to confusion and software bugs. In this paper, we aim to
detect whether a comment becomes inconsistent as a result of changes to the
corresponding body of code, in order to catch potential inconsistencies
just-in-time, i.e., before they are committed to a code base. To achieve this,
we develop a deep-learning approach that learns to correlate a comment with
code changes. By evaluating on a large corpus of comment/code pairs spanning
various comment types, we show that our model outperforms multiple baselines by
significant margins. For extrinsic evaluation, we show the usefulness of our
approach by combining it with a comment update model to build a more
comprehensive automatic comment maintenance system which can both detect and
resolve inconsistent comments based on code changes.Comment: Accepted in AAAI 202
Are your comments outdated? Towards automatically detecting code-comment consistency
In software development and maintenance, code comments can help developers
understand source code, and improve communication among developers. However,
developers sometimes neglect to update the corresponding comment when changing
the code, resulting in outdated comments (i.e., inconsistent codes and
comments). Outdated comments are dangerous and harmful and may mislead
subsequent developers. More seriously, the outdated comments may lead to a
fatal flaw sometime in the future. To automatically identify the outdated
comments in source code, we proposed a learning-based method, called CoCC, to
detect the consistency between code and comment. To efficiently identify
outdated comments, we extract multiple features from both codes and comments
before and after they change. Besides, we also consider the relation between
code and comment in our model. Experiment results show that CoCC can
effectively detect outdated comments with precision over 90%. In addition, we
have identified the 15 most important factors that cause outdated comments, and
verified the applicability of CoCC in different programming languages. We also
used CoCC to find outdated comments in the latest commits of open source
projects, which further proves the effectiveness of the proposed method
Recommending Code Changes for Automatic Backporting of Linux Device Drivers
International audienceDevice drivers are essential components of any operating system (OS). They specify the communication protocol that allows the OS to interact with a device. However, drivers for new devices are usually created for a specific OS version. These drivers often need to be backported to the older versions to allow use of the new device. Backporting is often done manually, and is tedious and error prone. To alleviate this burden on developers, we propose an automatic recommendation system to guide the selection of backporting changes. Our approach analyzes the version history for cues to recommend candidate changes. We have performed an experiment on 100 Linux driver files and have shown that we can give a recommendation containing the correct backport for 68 of the drivers. For these 68 cases, 73.5%, 85.3%, and 88.2% of the correct recommendations are located in the Top-1, Top-2, and Top-5 positions of the recommendation lists respectively. The successful cases cover various kinds of changes including change of record access, deletion of function argument, change of a function name, change of constant, and change of if condition. Manual investigation of failed cases highlights limitations of our approach, including inability to infer complex changes, and unavailability of relevant cues in version history