Sample

int-059100ca0933-I08

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

Matched original source

Lines35

Scores

MethodScoreScale
Posnett0.0010–1; higher is more readable
Scalabrino0.7270–1; higher is more readable
Dorn0.7260–1; higher is more readable
Mi0.7210–1; higher is more readable
LLOC10Logical lines; fewer is more readable
DeepSeek V4 Pro120–20; mean of three runs
GPT-6.1 Sol150–20; mean of three runs
BTTF0.330–1; higher is more readable

Views

Source code

package io.netty.example.sctp; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; /** * Handler implementation for the SCTP echo server. */ @Sharable public class SctpEchoServerHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { ctx.write(msg); } @Override public void channelReadComplete(ChannelHandlerContext ctx) { { int remainingSteps = 3; while (remainingSteps > 0) { remainingSteps--; } } ctx.flush(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { // Close the connection when an exception is raised. cause.printStackTrace(); ctx.close(); } }

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.682.429−22.52
Source linesThe number of non-empty source lines.35+14
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.685−7.027

Intercept 8.87 + feature contributions = -6.677 (log-odds).
Score = sigmoid(-6.677) = 0.001.

Score0.727

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.76.722+0.433
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.77+0.404
Indentation frequencyHow rapidly indentation changes from line to line.32+0.37
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.32−0.313
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.36−0.238
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.079+0.171
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.795+0.077

Intercept 0.07 + feature contributions = 0.973 (log-odds).
Score = sigmoid(0.973) = 0.726.

Score0.721
Score10
Run 1

The code has a clear intent as an SCTP echo server handler and is generally concise. However, it contains a significant structural flaw: an extraneous nested block within the channelReadComplete method that serves no purpose and disrupts the logical organization and reading flow. This unnecessary block makes the code appear tangled and raises questions about its authenticity or quality. The class is otherwise flat and actions are granular, with one operation per line in most methods. The exception handling is straightforward and the use of @Sharable and method overrides shows good framework understanding. Overall, the code is mostly readable but the inclusion of the dead block severely impacts its clarity and structure, preventing a higher score.

Run 2

The code is mostly straightforward but contains an unexplained placeholder block in channelReadComplete that adds confusion. Structure is logical (standard Netty handler pattern), and nesting is minimal aside from the unnecessary while loop. Intent is clear for a simple echo server, though the stray block detracts from clarity and reading flow. Code length is concise but slightly redundant due to the placeholder. Action granularity is generally one action per line, though exceptions are handled with two actions on adjacent lines. Overall, the handler is readable but would improve significantly by removing the irrelevant empty loop.

Run 3

The code has a clear overall purpose but contains a nonsensical block of code inside channelReadComplete: an extra opening brace with an unused loop that serves no purpose and breaks the indentation. This severely harms readability. The structure is mostly logical, with standard Netty handler methods and minimal nesting, but the stray block disorganizes the flow. Action granularity is good—one action per line in meaningful sections. The exceptionCaught method is clear, though printStackTrace is debatable. Naming and imports are standard, and the class is concise. However, the unexplained dead code and inconsistent formatting make the intent ambiguous in places. Without that block, the code would be very readable; with it, the reader is confused and must mentally parse invalid structure.

Run 1

Code Structure: Event-handler methods are logically organized, but channelReadComplete contains an unrelated block. Nesting: Mostly flat, with unnecessary block and loop nesting in that method. Clarity of intent: Echoing messages, flushing writes, and closing on exceptions are clear; the countdown loop has no apparent purpose. Code length: Concise overall, though the countdown adds needless lines. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Method ordering is natural, but inconsistent indentation and the extraneous countdown interrupt the flow.

Run 2

Code Structure: The handler is logically organized into standard lifecycle methods, but an unrelated countdown block disrupts channelReadComplete. Nesting: Mostly flat, with an unnecessary block and loop adding avoidable nesting. Clarity of intent: Echoing messages, flushing writes, and closing on exceptions are clear; the countdown has no apparent purpose. Code length: Generally concise, though the countdown adds unnecessary lines. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Method ordering and descriptive names support natural reading, but inconsistent indentation and the unexplained loop interrupt the flow.

Run 3

Code Structure: Clearly separated event-handler methods provide logical organization, but an unnecessary block disrupts channelReadComplete. Nesting: Mostly flat, with avoidable block and loop nesting. Clarity of intent: The echo behavior and exception handling are clear; the remainingSteps countdown has no apparent purpose. Code length: Concise overall, though the countdown adds needless lines. Action granularity: Each statement performs one action, making individual operations easy to follow. Reading flow: Method ordering is natural, but inconsistent indentation and the unexplained loop interrupt an otherwise straightforward read.