Skip to content

VariantSync/FeatureTraceRecording

Repository files navigation

Feature Trace Recording

ACM Artifacts Evaluated Reusable

Language Preprint Documentation Talk Install GitHubPages License DOI

Artifact repository for the paper Feature Trace Recording, accepted at ESEC/FSE 2021. Authors are Paul Maximilian Bittner, Alexander Schultheiß, Thomas Thüm, Timo Kehrer, Jeffrey M. Young, and Lukas Linsbauer.

The artefact mainly consists of a library written in the Haskell language that implements feature trace recording. The library is accompanied with a demo application that uses the library to reproduce our motivating example (Alice and Bob using feature trace recording in Section 2 in our paper) as well as examples of the edit patterns we used to evaluate feature trace recording (Section 5).

What is Feature Trace Recording?

Feature trace recording is a semi-automated method for recording feature-to-code mappings during software development. It unlocks evolution as a new source of information for feature location.

Feature Trace Recording Example

Consider a developer Alice editing the pop method of a Stack class in Java as depicted in the image above. Feature-to-code mappings are indicated by corresponding colours. By labeling her edits with the feature she edits, we derive feature mappings for edited source code. We refer to such a label as feature context. It can be left empty when developers do not know the feature they edit. In our example, Alice does not know the feature of the moved line in her second edit and omits the feature context (i.e., sets it to null).

From feature contexts we can compute feature mappings for the current code base but also for other variants. Assume there is a second developer, Bob, working on another variant (e.g., branch or fork) of the software. Bob’s variant might implement other features than Alice’s. Assume Bob’s variant implements the blue feature SafeStack but not the orange feature ImmutableStack. Although Alice made many edits to ImmutableStack, we can still derive feature mappings for Bob’s code. When Alice deletes code from ImmutableStack, we can infer that this code does not belong to ImmutableStack anymore. We thus introduce the new feature mapping ¬ImmutableStack for the deleted code that is still present in Bob’s variant (highlighted in purple):

Bob's Recorded Feature Traces

A detailed explanation of this example can be found in our paper and preprint.

Feature trace recording is the first step towards our vision for bridging the gap between clone-and-own and software product lines in our project VariantSync. You may read about it in our ICSE NIER paper or watch our talk on YouTube 😊.

How to Run the Demo

Our library is written in Haskell and uses the Stack build system (see REQUIREMENTS.md). Instructions for installing Stack, building our library and running the demo are given in the INSTALL.md.

A detailed documentation can be found in docs/index.html and can be browsed on the Github page.

Some interesting code locations are:

  • main function in app/Main.hs: Here you can choose in which format source code should be displayed in the terminal. Choose from:

    • userFormat (default): The perspective of the developer who is editing source code while traces are recorded in the background. This is the format used in the figures in the paper. The tool will show the presence conditions of the snapshots.
    • userFormatDetailed: A variation of userFormat where traces and presence conditions can be investigated seperately at the same time. Code is coloured in the colour of its feature trace while presence conditions are indicated by coloured lines on the left.
    • astFormat: Shows the abstract syntax tree of the source code with feature traces as formulas.
    • tikzFormat: Tikz export of abstract syntax trees with traces. Used for figures in the paper.
  • showExamples function in app/Main.hs: Here you can choose which examples to run.

  • src/feature/recording/FeatureTraceRecording.hs: This file includes type definitions and interfaces for feature trace recording to make it configurable (e.g., plug in custom recording functions).

  • src/feature/recording/DefaultFeatureTraceRecording.hs: The implementation of feature trace recording. Here you can find Algorithm 1 from the paper (defaultFeatureTraceRecording) and the recording functions for insertions, deletions, moves, and updates.

  • src/feature/FeatureTrace.hs: Here you can find definitions for feature traces and presence conditions.

  • src/tree/grammars/SimpleJava.hs: Example implementation for a simplified Java grammar used for the examples in our paper. Here you can see the different rules of the grammar as well as the classifiation of terminal symbols (node types) as mandatory, optional, or wrappers.

  • app/examples/: In this directory, the source code for the examples can be found. The motivating example from the paper is implemented in StackPopAlice.hs and StackPopBob.hs. The reproduction of the edit patterns used in our evaluation can be found in EditPatterns.hs.

  • src/propositions/NullPropositions.hs: Operators for the ternary logic with null. We provide truthtables for the logic in meta/Truthtable.md. The implementation is based on our implementation for propositional logic in src/propositions/Propositions.hs. You can inspect the truth tables for the ternary logic by uncommenting the respective line (showTruthtables) in the main function in app/Main.hs and running the demo again.

Please cite as

@inproceedings{BST+:ESECFSE21,
	author = {Paul Maximilian Bittner and Alexander Schulthei\ss{} and Thomas Th{\"{u}}m and Timo Kehrer and Jeffrey M. Young and Lukas Linsbauer},
	title = {{Feature Trace Recording}},
	booktitle = {Proc.\ Europ.\ Software Engineering Conf./Foundations of Software Engineering (ESEC/FSE)},
	location = {Athens, Greece},
	publisher = {ACM},
	address = {New York, NY, USA},
	year = 2021,
	month = AUG,
	pages = {1007--1020},
	numpages = {14},
	isbn = {9781450385626},
	doi = {10.1145/3468264.3468531},
	url = {https://doi.org/10.1145/3468264.3468531},
	keywords = {feature traceability, disciplined annotations, clone-and-own, feature location, software product lines}
}

Limitations

So far, this library contains no implementation for parsing and diffing source code. Instead, users of this library have to provide Abstract Syntax Trees (ASTs) and edits to them as input for feature trace recording (see runFTR and runFTRWithIntermediateSteps in FeatureTraceRecording.hs). Examples for creating edits and ASTs can be found in the demos for Alice (docs, src), Bob (docs, src), and edit patterns (docs, src).

Currently, the library also does not provide (de-)serialisation of feature traces.

Contact

Don't hesitate to open issues or pull-request, or to contact us directly (paul.bittner@uni-ulm.de). We are thankful for any questions, constructive criticism, or interest. 😊