Sample

MBJP/17

Human rating uses the original dataset scale.

DatasetMBJP
Human2
Lines27

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.2160–1; higher is more readable
75.0Δ 59.4
Scalabrino0.9670–1; higher is more readable
93.8Δ 78.1
Dorn0.790–1; higher is more readable
93.8Δ 78.1
Mi0.7720–1; higher is more readable
93.8Δ 78.1
LLOC9Logical lines; fewer is more readable
46.9Δ 31.2
DeepSeek V4 Pro10.670–20; mean of three runs
25.0Δ 9.4
GPT-6.1 Sol120–20; mean of three runs
12.5Δ 3.1
BTTF0.3560–1; higher is more readable
18.8Δ 3.1
Human21–5; original rating
15.6

Views

Source code

import java.io.*; import java.lang.*; import java.util.*; import java.math.*; class SquarePerimeter { /** * * Write a function to find the perimeter of a square. * * > squarePerimeter(10) * 40 * > squarePerimeter(5) * 20 * > squarePerimeter(4) * 16 */ public static int squarePerimeter(int a) { int b = a; int c = 0; for (int i = 0; i < 4; i++) { c += b; int d = b - 1; b = d + 1; } return c; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(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.451.377−14.895
Source linesThe number of non-empty source lines.27+10.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.042−6.064

Intercept 8.87 + feature contributions = -1.289 (log-odds).
Score = sigmoid(-1.289) = 0.216.

Score0.967

Feature contributions

FeatureValueContribution
(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.59.926+1.127
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.57.963+0.131
Indentation frequencyHow rapidly indentation changes from line to line.18−0.115
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.27+0.08
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.09+0.071
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.25.902−0.048
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.18+0.008

Intercept 0.07 + feature contributions = 1.324 (log-odds).
Score = sigmoid(1.324) = 0.79.

Score0.772
Score9
Run 1

The code is logically organized and the purpose is clear, but the implementation is unnecessarily convoluted. The perimeter of a square can be computed directly as 4 * a, yet the code uses a loop with redundant operations (e.g., int d = b - 1; b = d + 1;). This hurts action granularity and reading flow by introducing irrelevant steps. Nesting is shallow and indentation is fine, but the loop adds cognitive load without value. Code length is excessive for the simple task. Clarity of intent is partially obscured by the odd loop and unnecessary variables (int b, int c). Overall, the code is readable in structure but poorly designed for its purpose.

Run 2

The code has a clear method name and imports, but the logic is unnecessarily convoluted. The loop adds the same side length four times, using an extra variable and subtraction/addition that serves no purpose. This obscures the intent of calculating a square's perimeter. The code is flat and concise, but the redundant operations reduce clarity and action granularity. Overall, the structure is logical but the implementation makes the simple formula (4 * a) hard to recognize.

Run 3

The code has a clear class and method structure, but the implementation is unnecessarily convoluted. The method squarePerimeter is intended to return the perimeter of a square, which should simply be 4 * a. Instead, it introduces variables b and c, and uses a loop that adds b to c four times, with b being redundantly decremented then incremented back (d = b - 1; b = d + 1). This adds unnecessary length and obscures intent. While the indentation is flat and one action per line is mostly followed, the reading flow is hindered by these redundant operations. Clarity of intent is low because the algorithm does not directly express the mathematical relationship. The structure is not tangled, but the code length is longer than needed and the action granularity is sometimes multiple operations per line (though mostly one per line). Overall, it is readable but not efficient or clear.

Run 1

Code Structure: The class and method are logically organized, but redundant variables and calculations obscure a simple operation. Nesting: A single loop keeps nesting shallow. Clarity of intent: The method name and documentation clearly state the purpose, but names a, b, c, and d provide little meaning, and modifying b only to restore its value is confusing. Code length: The implementation is unnecessarily long compared with returning 4 * a; wildcard imports are also unused. Action granularity: Each statement performs one action on its own line. Reading flow: The overall sequence is straightforward, but the pointless subtraction and addition interrupt comprehension.

Run 2

Code Structure: A single, logically organized method, but redundant assignments and arithmetic obscure a simple calculation. Nesting: Shallow, with only one loop. Clarity of intent: The class name, method name, and examples clearly identify the purpose, but variable names a, b, c, and d are uninformative, and changing then restoring b is misleading. Code length: Unnecessarily long for an operation expressible as return 4 * a; unused wildcard imports add clutter. Action granularity: Each statement performs one action, making individual steps easy to follow. Reading flow: The method proceeds naturally from initialization to iteration to return, but the pointless manipulation of b interrupts comprehension.

Run 3

Code Structure: The single class and method are logically organized, but redundant calculations obscure a simple operation. Nesting: Only one loop is present, keeping nesting shallow. Clarity of intent: The class name, method name, and examples clearly identify the purpose, but variable names a, b, c, and d are uninformative, and modifying then restoring b is confusing. Code length: The implementation is unnecessarily long; returning 4 * a would express the calculation directly. Unused wildcard imports add clutter. Action granularity: Each statement performs one action, making individual lines easy to parse. Reading flow: The overall sequence is straightforward, but the pointless subtraction and addition interrupt the flow and require readers to verify that b remains unchanged.