Sample
Schnappinger/junit4/junit.framework.ComparisonCompactor
Human rating uses the original dataset scale.
Scores
| Method | Score | Scale | Dataset rank (0–100) |
|---|---|---|---|
| Posnett | 0 | 0–1; higher is more readable | 37.8Δ 8.4 |
| Scalabrino | 0.488 | 0–1; higher is more readable | 8.6Δ 20.8 |
| Dorn | 0.01 | 0–1; higher is more readable | 19.8Δ 9.6 |
| Mi | 0.078 | 0–1; higher is more readable | 9.2Δ 20.1 |
| LLOC | 47 | Logical lines; fewer is more readable | 40.3Δ 10.9 |
| DeepSeek V4 Pro | 14 | 0–20; mean of three runs | 29.9Δ 0.5 |
| GPT-6.1 Sol | 16 | 0–20; mean of three runs | 38.9Δ 9.6 |
| BTTF | 0.262 | 0–1; higher is more readable | 17.8Δ 11.6 |
| Human | 3 | 1–4; original rating | 29.4 |
Views
Loading feature diagnosis…
Source regions
Feature contributions
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones. | 3067.276 | −101.22 |
| Source linesThe number of non-empty source lines. | 77 | +30.8 |
| Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value. | 4.61 | −6.915 |
Intercept 8.87 + feature contributions = -68.466 (log-odds).
Score = sigmoid(-68.466) = 0.
| Score | 0.488 |
|---|
Feature contributions
| Feature | Value | Contribution (log-odds) |
|---|---|---|
| Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names. | 164.949 | −3.321 |
| Indentation frequencyHow rapidly indentation changes from line to line. | 77 | +1.926 |
| Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code. | 78 | −1.725 |
| Number layout frequencyHow rapidly the number of numeric values per line changes through the code. | 77 | −1.346 |
| Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right. | 0 | −0.804 |
| Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom. | 76.687 | +0.662 |
| Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *. | 0.107 | −0.095 |
Intercept 0.07 + feature contributions = -4.634 (log-odds).
Score = sigmoid(-4.634) = 0.01.
| Score | 0.078 |
|---|
| Score | 47 |
|---|
Run 1
The code is generally readable with clear method names and logical separation of concerns. Methods have single responsibilities, and the structure follows a natural top-down flow. Nesting is minimal, which is positive. However, several issues reduce clarity: field names use the 'f' prefix (Hungarian-like notation), which is outdated and harms readability. Some expressions are dense, especially in computeCommonSuffix and compactString, where string concatenation and conditional logic are combined on single lines. The findCommonSuffix loop condition is non-intuitive, making the logic harder to follow. The code is concise but some expressions are overly compact, requiring careful mental parsing. Overall, the code is maintainable but would benefit from clearer variable names and breaking up complex expressions.
Run 2
The code demonstrates reasonable organization with clear method separation and a single responsibility per method. The fields use a consistent naming convention but the 'f' prefix is unfamiliar and reduces readability. Nesting is minimal, which is good. However, the intent of some methods, particularly computeCommonSuffix and compactString, is difficult to grasp due to complex string manipulation expressions. The code is relatively concise but sometimes at the cost of clarity—several lines pack multiple operations (e.g., the for-loop conditions). Action granularity is mostly one action per line, but some lines combine multiple responsibilities. Reading flow is somewhat natural but interrupted by mental effort to parse index arithmetic and the non-standard field naming. Overall, it is readable for experienced Java developers, but not immediately clear to a broader audience.
Run 3
The code has a logical structure and clear naming conventions (fExpected, fActual, fPrefix, fSuffix) but suffers from dated 'f' field prefixes which slightly hurt readability for modern Java developers. The methods are reasonably sized and separation of concerns is adequate, with distinct steps for finding prefix/suffix and building the compacted string. Nesting is minimal, with only two levels (method -> if). The main readability problems are the confusing index arithmetic in findCommonSuffix() and computeCommonSuffix() — expressions like 'fExpected.length() - fSuffix + 1' appear repeatedly with no explanation, requiring careful mental tracking. The action granularity is good, mostly one operation per line. Reading flow is natural in compact() but becomes fragmented due to the obscure offset computations. Overall structure is sound but mathematical complexity drags clarity down.
Run 1
Code Structure: Well organized into small, focused methods, although shared mutable prefix/suffix state creates implicit dependencies. Nesting: Shallow loops and conditionals, with an early return simplifying the main path. Clarity of intent: Descriptive method names and named delimiters explain the purpose, but f-prefixed fields and the unconventional suffix offset require interpretation. Code length: Concise overall; long substring and ternary expressions make boundary calculations harder to understand. Action granularity: Most lines perform one action, though the suffix loop updates two indices and some expressions combine several calculations. Reading flow: compact() presents a natural sequence from validation to comparison and formatting; helper methods support that flow, but repeated suffix arithmetic and state-dependent calls interrupt effortless reading.
Run 2
Code Structure: Well organized into small, focused methods, although shared mutable fields create implicit dependencies between calls. Nesting: Shallow, with an early return and simple loop conditions. Clarity of intent: Descriptive method names and constants convey the purpose, but f-prefixed fields and the unconventional suffix offset require careful interpretation. Code length: Generally concise, though long substring expressions and repeated suffix arithmetic reduce readability. Action granularity: Most statements perform one action; the suffix loop updates two indices, and some expressions combine several calculations. Reading flow: compact() presents a natural sequence from validation through comparison to formatting, but understanding the boundary calculations requires tracing state across helper methods.
Run 3
Code Structure: Well-organized into small, focused methods, although shared mutable prefix/suffix state creates implicit dependencies. Nesting: Shallow, with an early return and simple loop conditions. Clarity of intent: Method names and constants clearly communicate string comparison and compaction; however, f-prefixed fields and the unconventional suffix offset require extra interpretation. Code length: Generally concise, though repeated suffix arithmetic could be extracted into a named variable. Action granularity: Most lines perform one action, but the suffix loop updates two indices and some expressions combine several calculations. Reading flow: compact() presents a natural sequence from validation through comparison to formatting. Long substring expressions and inline ternaries in the context helpers interrupt otherwise smooth reading.