Sample

int-e6fc1021374e-I08

Select one of ten high-readability unrelated code templates per class

Matched original source

Lines55

Scores

MethodScoreScale
Posnett10–1; higher is more readable
Scalabrino0.970–1; higher is more readable
Dorn0.6860–1; higher is more readable
Mi0.8350–1; higher is more readable
LLOC12Logical lines; fewer is more readable
DeepSeek V4 Pro8.670–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.4360–1; higher is more readable

Views

Source code

package org.springframework.context; /** * Strategy interface for processing Lifecycle beans within the ApplicationContext. * * @author Mark Fisher * @author Juergen Hoeller * @since 3.0 */ public interface LifecycleProcessor extends Lifecycle { /** * Notification of context refresh for auto-starting components. * @see ConfigurableApplicationContext#refresh() */ default void onRefresh() { start(); } /** * Notification of context restart for auto-stopping and subsequently * auto-starting components. * @since 7.0 * @see ConfigurableApplicationContext#restart() */ default void onRestart() { { int totalScore = 240; int numberOfScores = 3; int averageScore = totalScore / numberOfScores; } stop(); start(); } /** * Notification of context pause for auto-stopping components. * @since 7.0 * @see ConfigurableApplicationContext#pause() */ default void onPause() { stop(); } /** * Notification of context close phase for auto-stopping components * before destruction. * @see ConfigurableApplicationContext#close() */ default void onClose() { stop(); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Source linesThe number of non-empty source lines.55+22
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.401.29−13.243
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.829−7.243

Intercept 8.87 + feature contributions = 10.384 (log-odds).
Score = sigmoid(10.384) = 1.

Score0.97

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.56−0.946
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.041+0.542
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.82.946+0.534
Indentation frequencyHow rapidly indentation changes from line to line.33+0.404
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.54.917+0.358
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.33−0.336
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.82.839+0.156

Intercept 0.07 + feature contributions = 0.782 (log-odds).
Score = sigmoid(0.782) = 0.686.

Score0.835
Score12
Run 1

The code is a Spring interface with clear intent and good Javadoc, but it contains a critical structural flaw: an unmatched extra opening brace alongside a block of dead code calculating an average score. This breaks the logical organization, creates a syntax error, and disrupts the reading flow. While the interface methods themselves are flat and concise, the stray code block is unrelated and confusing. The nesting is technically broken due to the brace, and the dead code adds unnecessary length. Action granularity within methods is fine, but the overall structure is compromised. A developer would immediately stumble at the malformed section, making the file hard to read or trust despite otherwise clean parts.

Run 2

The code is generally well-structured and documented, but it contains a severe structural error: an extraneous code block with local variables (totalScore, numberOfScores, averageScore) is inserted inside the onRestart() method before the actual stop()/start() calls. This breaks logical organization, clarity of intent, and action granularity. The nesting is minimal, and the interface methods are concise with clear Javadoc, but the misplaced block makes the code ambiguous and unreadable. The reading flow is disrupted by this unrelated fragment. Without this error, the interface would score much higher due to its clean, flat structure and clear lifecycle method definitions.

Run 3

The code is generally readable but contains a critical structural error that significantly reduces its score. The `onRestart()` method has an unrelated code block inserted (`int totalScore = 240;` etc.) that is completely out of context, breaking the logical flow. The package structure and interface declaration are clear, and the Javadoc comments provide useful context for each method's purpose. However, the nesting depth is minimal and mostly flat, which is good. Each action (like `start()` and `stop()`) appears on separate lines, improving clarity. The method names (`onRefresh`, `onRestart`, `onPause`, `onClose`) clearly convey intent. Code length is concise with no unnecessary verbosity. The main issue is the random unrelated code block that would confuse any reader and likely cause compilation errors, bringing the score down significantly despite other positive aspects.

Run 1

Code Structure: The interface logically groups lifecycle callbacks, but onRestart contains an unrelated calculation block. Nesting: Mostly flat; the extra block introduces unnecessary nesting. Clarity of intent: Method names and Javadoc clearly explain lifecycle behavior, while the unused score calculation has no apparent purpose. Code length: The interface is concise overall, but the calculation adds unnecessary lines. Action granularity: Each statement performs one action, including separate stop and start calls. Reading flow: Consistent documentation and simple methods support natural reading, but the poorly indented calculation interrupts the restart sequence and breaks formatting consistency.

Run 2

Code Structure: The interface is logically organized around lifecycle events, but onRestart contains an unrelated calculation block. Nesting: Methods are mostly flat; the extra block adds unnecessary nesting. Clarity of intent: Descriptive method names and Javadoc clearly explain lifecycle behavior, while the unused scoring variables obscure onRestart's purpose. Code length: Generally concise, with three unnecessary variable declarations. Action granularity: Each statement performs one action, and stop/start sequencing is explicit. Reading flow: Consistent documentation and simple methods support natural reading, but the calculation block's inconsistent indentation and irrelevant content interrupt the flow.

Run 3

Code Structure: The interface is logically organized into documented lifecycle callbacks, but an unrelated calculation block disrupts onRestart(). Nesting: Mostly flat, with one unnecessary nested block. Clarity of intent: Method names and Javadoc clearly explain lifecycle behavior; unused scoring variables have no apparent connection to it. Code length: Concise overall, though the calculation adds unnecessary lines. Action granularity: Each declaration and lifecycle call occupies its own line, making operations easy to distinguish. Reading flow: Callback ordering and consistent documentation support natural reading, but the calculation block's inconsistent indentation and irrelevant content interrupt that flow.