Sample

Schnappinger/argoUML/org.argouml.uml.cognitive.critics.WizMEName

Human rating uses the original dataset scale.

Human3.91
Lines159

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
54.8Δ 1.6
Scalabrino0.8910–1; higher is more readable
87.0Δ 30.6
Dorn0.3070–1; higher is more readable
47.9Δ 8.6
Mi0.5980–1; higher is more readable
61.7Δ 5.3
LLOC39Logical lines; fewer is more readable
43.9Δ 12.5
DeepSeek V4 Pro13.330–20; mean of three runs
24.1Δ 32.3
GPT-6.1 Sol150–20; mean of three runs
25.7Δ 30.7
BTTF0.540–1; higher is more readable
47.9Δ 8.6
Human3.911–4; original rating
56.4

Views

Source code

/* $Id: WizMEName.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $ ***************************************************************************** * Copyright (c) 2009-2012 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * mvw ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 1996-2007 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice // and this paragraph appear in all copies. This software program and // documentation are copyrighted by The Regents of the University of // California. The software program and documentation are supplied "AS // IS", without any accompanying services from The Regents. The Regents // does not warrant that the operation of the program will be // uninterrupted or error-free. The end-user understands that the program // was developed for research purposes and is advised not to rely // exclusively on the program for any reason. IN NO EVENT SHALL THE // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. package org.argouml.uml.cognitive.critics; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JPanel; import org.argouml.cognitive.ui.WizStepTextField; import org.argouml.i18n.Translator; import org.argouml.model.Model; /** * A non-modal wizard to help the user change the name of a * MModelElement to a better name. * * @author jrobbins */ public class WizMEName extends UMLWizard { private static final Logger LOG = Logger.getLogger(WizMEName.class.getName()); private String instructions = Translator.localize("critics.WizMEName-ins"); private String label = Translator.localize("label.name"); private boolean mustEdit = false; private WizStepTextField step1 = null; private String origSuggest; /** * The constructor. * */ public WizMEName() { } /** * @param s the instructions */ public void setInstructions(String s) { instructions = s; } /** * @param b if true, then the wizard step needs userinput, * i.e. it must be edited */ public void setMustEdit(boolean b) { mustEdit = b; } /** * Create a new panel for the given step. * * @see org.argouml.cognitive.critics.Wizard#makePanel(int) */ public JPanel makePanel(int newStep) { switch (newStep) { case 1: if (step1 == null) { step1 = new WizStepTextField(this, instructions, label, offerSuggestion()); } return step1; } return null; } /* * @see org.argouml.uml.cognitive.critics.UMLWizard#setSuggestion(java.lang.String) */ public void setSuggestion(String s) { origSuggest = s; super.setSuggestion(s); } /** * Return false if the user has not edited the text and they were required * to. * * @see org.argouml.cognitive.critics.Wizard#canGoNext() */ public boolean canGoNext() { if (!super.canGoNext()) { return false; } if (step1 != null) { boolean changed = origSuggest.equals(step1.getText()); if (mustEdit && !changed) { return false; } } return true; } /* * @see org.argouml.cognitive.ui.Wizard#doAction(int) */ public void doAction(int oldStep) { LOG.log(Level.FINE, "doAction {0}", oldStep); switch (oldStep) { case 1: String newName = getSuggestion(); if (step1 != null) { newName = step1.getText(); } try { Object me = getModelElement(); Model.getCoreHelper().setName(me, newName); } catch (Exception pve) { LOG.log(Level.SEVERE, "could not set name", pve); } break; } } /** * @return Returns the instructions. */ protected String getInstructions() { return instructions; } } /* end class WizMEName */

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.2636.652−87.01
Source linesThe number of non-empty source lines.159+63.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.134−7.7

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

Score0.891

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.160−4.629
Indentation frequencyHow rapidly indentation changes from line to line.96+2.583
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.158.807+1.81
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.95−1.759
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.86.388+0.589
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.042+0.537
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.86.938−0.017

Intercept 0.07 + feature contributions = -0.815 (log-odds).
Score = sigmoid(-0.815) = 0.307.

Score0.598
Score39
Run 1

The code has an adequate structure with clear class and method separation, but readability is diminished by inconsistent formatting. Nesting is reasonably flat, though the switch statements and conditional checks add complexity. Intent is mostly clear thanks to Javadocs and method names, but some methods (like doAction) mix levels of abstraction and contain broad exception handling. Code length is reasonable, though verbose comments and licensing headers add noise. Action granularity is inconsistent—some lines perform multiple operations (e.g., step1 initialization) while others are single-action. Reading flow suffers from mixing tabs/spaces, inconsistent brace styles, and scattered logging. Overall, understandable but not polished.

Run 2

The code is moderately readable but has issues. The overall structure is logical with clear class and method separation, and the intent is generally apparent from method names and Javadoc. However, there are significant readability problems: consistent use of 4-space vs 8-space indentation creates visual inconsistency, switch statements add unnecessary nesting, and some methods (makePanel, canGoNext) have awkward flow. The `changed` variable in canGoNext is misleadingly named (it actually means 'not changed'), making intent ambiguous. Action granularity is mostly good with one action per line, but nested if statements in canGoNext could be flattened with early returns. The lengthy copyright header (30+ lines) hurts initial readability. Some methods like setInstructions and setMustEdit are trivial but acceptable. The try-catch with broad Exception is acceptable for a wizard but could be more specific. Mixed brace styles and inconsistent whitespace further reduce clarity.

Run 3

The code is generally readable and well-structured. It has a clear purpose (wizard for renaming UML elements) and follows a logical organization with fields, constructor, setters, and method overrides. It uses a flat nesting structure with only one-level switch statements and no deeply nested conditionals. Action granularity is mostly one action per line. However, the score is reduced by some issues: the switch statement in makePanel uses older-style formatting with tabs that makes indentation inconsistent; the canGoNext method uses an unnecessary intermediate boolean variable 'changed' that could be simplified; the doAction method has a try-catch block that catches a generic Exception rather than specific exceptions, which slightly obscures intent. The license header is lengthy but standard for the project. Overall, the code is clear and maintainable but has minor style inconsistencies and could be more concise in a few places.

Run 1

Code Structure: Small, focused methods logically separate panel creation, navigation checks, and renaming. Nesting: Generally shallow, although switches and conditionals introduce some avoidable nesting. Clarity of intent: The wizard's purpose and most method names are clear, but abbreviated identifiers such as origSuggest and me reduce clarity. More importantly, changed stores an equality result, making the editing requirement confusing and apparently inverted. Code length: Implementation is reasonably concise; extensive license headers and redundant documentation add reading overhead. Action granularity: Statements generally perform one action each, though inline setters compress method structure. Reading flow: Method organization and early returns support natural reading, but mixed indentation, inconsistent brace placement, and single-case switches interrupt the flow.

Run 2

Code Structure: Small, focused methods logically separate panel creation, navigation validation, and renaming. Nesting: Generally shallow, although switch statements containing conditionals and exception handling add modest depth. Clarity of intent: Class documentation and most method names clearly describe the wizard's purpose; however, 'changed' actually represents equality with the original suggestion, contradicting its name and making validation confusing. Abbreviations such as 'me', 's', and 'pve' also weaken clarity. Code length: Implementation is reasonably concise, but extensive license headers, boilerplate comments, and single-case switches add reading overhead. Action granularity: Most statements perform one action per line, though inline setter bodies compress declarations and assignments. Reading flow: Methods follow a sensible progression, but inconsistent tab/space indentation, awkward wrapping, and uneven comment styles interrupt visual consistency.

Run 3

Code Structure: The class is logically organized into fields, configuration methods, panel creation, navigation validation, and action execution. Nesting: Mostly shallow, although switch, conditional, and try/catch blocks add some indentation. Clarity of intent: Documentation and method names explain the naming wizard well, but abbreviations such as me, s, and b are less descriptive. The variable changed is misleading because equals indicates unchanged text, contradicting the validation comment. Code length: Functional code is reasonably concise; extensive license headers and boilerplate comments increase scanning effort. Action granularity: Most lines contain one action, though inline setters compress method declarations and assignments together. Reading flow: Method ordering and early returns support straightforward reading, but mixed indentation, inconsistent brace formatting, and implicit superclass behavior reduce smoothness.