Sample

int-f99ba0db9a37-I08

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

Matched original source

Lines55

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.7510–1; higher is more readable
Dorn0.6070–1; higher is more readable
Mi0.4420–1; higher is more readable
LLOC16Logical lines; fewer is more readable
DeepSeek V4 Pro140–20; mean of three runs
GPT-6.1 Sol14.670–20; mean of three runs
BTTF0.4010–1; higher is more readable

Views

Source code

package io.netty.example.uptime; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.MultiThreadIoEventLoopGroup; import io.netty.channel.nio.NioIoHandler; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; /** * Uptime server is served as a connection server. * So it simply discards all message received. */ public final class UptimeServer { private static final int PORT = Integer.parseInt(System.getProperty("port", "8080")); private static final UptimeServerHandler handler = new UptimeServerHandler(); private UptimeServer() { } public static void main(String[] args) throws Exception { { int totalScore = 240; int numberOfScores = 3; int averageScore = totalScore / numberOfScores; } EventLoopGroup group = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory()); try { ServerBootstrap b = new ServerBootstrap(); b.group(group) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { ch.pipeline().addLast(handler); } }); // Bind and start to accept incoming connections. ChannelFuture f = b.bind(PORT).sync(); // Wait until the server socket is closed. // In this example, this does not happen, but you can do that to gracefully // shut down your server. f.channel().closeFuture().sync(); } finally { group.shutdownGracefully(); } } }

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.1935.261−63.864
Source linesThe number of non-empty source lines.55+22
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.566−6.849

Intercept 8.87 + feature contributions = -39.842 (log-odds).
Score = sigmoid(-39.842) = 0.

Score0.751

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.48+0.923
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.55−0.911
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.48−0.681
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.89.982+0.647
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.54.945+0.358
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.079+0.175
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.89.982−0.146

Intercept 0.07 + feature contributions = 0.436 (log-odds).
Score = sigmoid(0.436) = 0.607.

Score0.442
Score16
Run 1

The code has a clear purpose and mostly follows standard Netty patterns with reasonable structure. However, several issues reduce readability. There's an inexplicable dead-code block containing an unused local variable calculation, which is confusing and detracts from clarity. The b.group(...).channel(...).handler(...).childHandler(...) chain spans multiple lines with inconsistent indentation, though this is common in Netty examples. The anonymous inner class adds nesting but is idiomatic. Comments are helpful, but the overall flow is interrupted by the dead code. The code is otherwise concise and each line performs a single logical action.

Run 2

The code has good overall structure with clear separation of concerns and readable Netty boilerplate. However, a stray block containing unused local variable calculations (totalScore, numberOfScores, averageScore) breaks the flow and creates confusion. Imports are not alphabetically ordered. The anonymous inner class for ChannelInitializer adds moderate nesting but is idiomatic Netty. Comments are helpful and concise. Line lengths are acceptable, and most lines perform a single logical action. The static handler field and PORT parsing are straightforward. The main issue is the irrelevant code block, which significantly hurts clarity and intent.

Run 3

The code is generally well-structured and readable. It has a clear purpose, uses a clean main method with try/finally resource management, and follows netty conventions. However, readability is impacted by a stray block of unrelated code inside main (calculating totalScore/averageScore) that doesn't belong. There is also a minor inconsistency in indentation. The ChannelInitializer anonymous class adds slight nesting but is acceptable. Action granularity and flow are good overall.

Run 1

Code Structure: Server initialization, binding, waiting, and cleanup are logically organized, but the unrelated average-calculation block disrupts cohesion. Nesting: Mostly manageable, though the anonymous initializer and extra block add indentation levels. Clarity of intent: Netty APIs and lifecycle comments convey the server's purpose; unused calculation variables and abbreviated names b and f reduce clarity. Code length: Generally concise, but the unused calculation block is unnecessary. Action granularity: Statements mostly perform one action per line, and the fluent configuration chain is clearly formatted. Reading flow: The server lifecycle reads naturally, but the poorly indented calculation block interrupts it, and spacing between the package declaration and imports would improve presentation.

Run 2

1. Code Structure: Server setup, binding, waiting, and cleanup are logically organized, but the unrelated averaging block disrupts cohesion. 2. Nesting: Mostly shallow; the anonymous channel initializer adds manageable nesting, while the extra block is unnecessary. 3. Clarity of intent: Netty API calls and lifecycle comments make the server's purpose clear. Unused averaging variables and abbreviated names such as b and f reduce clarity. 4. Code length: Generally concise, but the averaging block adds irrelevant lines. 5. Action granularity: Statements are separated, and the fluent configuration places each operation on its own line. 6. Reading flow: The main lifecycle reads naturally and cleanup is clearly placed in finally. However, inconsistent indentation in the averaging block, limited spacing around the package/import section, and awkward class documentation interrupt the flow.

Run 3

Code Structure: Server setup, connection handling, and cleanup are logically organized, but the unrelated average-calculation block disrupts cohesion. Nesting: Mostly moderate, although the anonymous initializer and unnecessary calculation scope add depth. Clarity of intent: Netty configuration and lifecycle operations are clear; short names such as b and f are less descriptive, and the unused calculation obscures the main purpose. Code length: Generally concise, with a small amount of irrelevant code and somewhat verbose shutdown comments. Action granularity: Statements generally perform one action per line, and the fluent configuration chain is clearly separated. Reading flow: Setup, binding, waiting, and cleanup follow a natural sequence, but inconsistent indentation in the calculation block interrupts scanning.