Evaluate code versions
Once you have generated alternative code versions for your selected code snippets, you can use Artemis to evaluate the quality of the code versions. Artemis offers code scoring and code validation options, which are discussed below.
Code Scoring
In order to evaluate versions, first ensure that you are on the Snippets
section of your selected code project, and that you have generated at least one version for your codebase. See image below:
To start the scoring, click on the "balance" icon, either next to a given code snippet, or at the top of the Version Scores
column.
See image below:
Once you click the "balance" icon, it will open a Score Versions
panel to select the scoring criteria. In order to start the scoring, you need to select at least one scoring criteria. We use a set of pre-defined scoring criteria to evaluate the code versions, but you are also able to set your own scoring criteria, or provide additional context for your query. See image below:
Use the checkboxes to select one or more scoring criteria to evaluate the code versions.
Click on the Criteria
button (circled in red in the image above) to edit the scoring criteria. Clicking on the Criteria
button will open the following form:
Click the down arrow on top (labeled 1️⃣ in the diagram above) to select from a list of other pre-defined scoring criteria.
Click the "notepad" icon (labeled 2️⃣ in the diagram above) to edit a scoring criteria that has already been defined.
Click the "plus" icon (labeled 3️⃣ in the diagram above) to define a completely new scoring criteria.
Once you make your edits using 1, 2, or 3 above, click Create
to add your scoring criteria.
Click Run
on the Score Versions
panel to start evaluating the code versions.
When the scoring task is complete, your scores will appear under the Version Scores
tab.
See image below:
The scoring criteria are defined as follows:
Criteria | Description |
---|---|
Readability | Measures how easy it is to understand the code version. Readability considers factors such as code structure, naming conventions, and comments. |
Maintainability | Measures how easy it is to maintain the code version. Maintainability considers factors such as code complexity, coupling, and cohesion. |
Performance | Measures how well the code version improve the predicted performance of the piece of code. Performance considers runtime and memory usage as criteria to measure performance, but these are not the only two metrics. |
Validate recommended code snippets
Artemis provides three options to validate the recommended code snippets: Compile
checks whether the recommended code will compile, Test
runs unit test to check for functionality, Benchmark
measures the performance. In order to run these validations, click the "play" icon next to Validations
, and click on the preferred tests. Click Run
to start the validation process. See image below:
Once the validation process is complete, the status of each selected test will be displayed under Validations
. See image below:
Based on code scores and validation outcomes, you can decide which of the snippets to incorporate into your codebase.