Sample

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

Human rating uses the original dataset scale.

Human3.64
Lines132

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
44.5Δ 3.9
Scalabrino0.5940–1; higher is more readable
21.9Δ 18.7
Dorn0.3190–1; higher is more readable
49.5Δ 8.9
Mi0.5610–1; higher is more readable
46.2Δ 5.6
LLOC33Logical lines; fewer is more readable
48.2Δ 7.6
DeepSeek V4 Pro130–20; mean of three runs
21.1Δ 19.5
GPT-6.1 Sol160–20; mean of three runs
38.9Δ 1.7
BTTF0.4560–1; higher is more readable
40.3Δ 0.3
Human3.641–4; original rating
40.6

Views

Source code

/* $Id: CrMissingClassName.java 19577 2011-06-22 20:37:05Z linus $ ***************************************************************************** * Copyright (c) 2009 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: * maurelio1234 ***************************************************************************** * * 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.HashSet; import java.util.Set; import javax.swing.Icon; import org.argouml.cognitive.Critic; import org.argouml.cognitive.Designer; import org.argouml.cognitive.ToDoItem; import org.argouml.cognitive.critics.Wizard; import org.argouml.model.Model; import org.argouml.uml.cognitive.UMLDecision; /** * This critics tests if a ModelElement has a name. */ public class CrMissingClassName extends CrUML { /** * The constructor. */ public CrMissingClassName() { setupHeadAndDesc(); addSupportedDecision(UMLDecision.NAMING); setKnowledgeTypes(Critic.KT_COMPLETENESS, Critic.KT_SYNTAX); addTrigger("name"); } /* * @see org.argouml.uml.cognitive.critics.CrUML#predicate2( * java.lang.Object, org.argouml.cognitive.Designer) */ @Override public boolean predicate2(Object dm, Designer dsgr) { if (!(Model.getFacade().isAModelElement(dm))) { return NO_PROBLEM; } Object e = dm; String myName = Model.getFacade().getName(e); if (myName == null || myName.equals("") || myName.length() == 0) { return PROBLEM_FOUND; } return NO_PROBLEM; } /* * @see org.argouml.cognitive.Poster#getClarifier() */ @Override public Icon getClarifier() { return ClClassName.getTheInstance(); } /* * @see org.argouml.cognitive.critics.Critic#initWizard( * org.argouml.cognitive.ui.Wizard) */ @Override public void initWizard(Wizard w) { if (w instanceof WizMEName) { ToDoItem item = (ToDoItem) w.getToDoItem(); Object me = item.getOffenders().get(0); String ins = super.getInstructions(); String sug = super.getDefaultSuggestion(); int count = 1; if (Model.getFacade().getNamespace(me) != null) { count = Model.getFacade().getOwnedElements( Model.getFacade().getNamespace(me)).size(); } sug = Model.getFacade().getUMLClassName(me) + (count + 1); ((WizMEName) w).setInstructions(ins); ((WizMEName) w).setSuggestion(sug); } } /* * @see org.argouml.cognitive.critics.Critic#getWizardClass(org.argouml.cognitive.ToDoItem) */ @Override public Class getWizardClass(ToDoItem item) { return WizMEName.class; } /* * @see org.argouml.uml.cognitive.critics.CrUML#getCriticizedDesignMaterials() */ @Override public Set<Object> getCriticizedDesignMaterials() { Set<Object> ret = new HashSet<Object>(); ret.add(Model.getMetaTypes().getUMLClass()); return ret; } }

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.2940.84−97.048
Source linesThe number of non-empty source lines.132+52.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.5.263−7.894

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

Score0.594

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.133−3.673
Indentation frequencyHow rapidly indentation changes from line to line.81+2.065
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.81−1.438
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.131.76+1.432
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.94.271+0.717
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.053+0.429
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.94.992−0.358

Intercept 0.07 + feature contributions = -0.757 (log-odds).
Score = sigmoid(-0.757) = 0.319.

Score0.561
Score33
Run 1

The code has a clear class purpose and logical method organization, but readability suffers from inconsistent indentation (tabs vs spaces), deeply nested conditionals in initWizard, and redundant null/empty checks in predicate2. The constructor mixes setup calls without clear visual separation, while initWizard combines multiple responsibilities (retrieving data, computing suggestions, setting wizard state). Several methods are concise and focused, but getWizardClass crams body onto one line. The long copyright header obscures actual code. Some methods read naturally (getClarifier, getCriticizedDesignMaterials), but initWizard's nesting and multiple state changes make it difficult to follow. Overall, functional but not consistently clean.

Run 2

The code is generally readable but has some issues. The structure is logical with clear method separation, and the intent is mostly understandable. However, there are several readability problems: inconsistent indentation (mixing tabs and spaces), deeply nested logic in the initWizard method, and poor granularity in some methods where multiple actions are packed into single lines. The predicate2 method has redundant conditions (checking both empty string and length == 0) and could be more concise. The one-line method getWizardClass breaks the reading flow, and the boolean logic could be clearer with better variable naming. The code would benefit from better formatting consistency, extraction of complex conditions into helper methods, and more readable line-by-line flow in the initWizard method where multiple operations occur per line.

Run 3

The code is generally readable but has inconsistencies. The class structure is logical, with a clear constructor and overridden methods, but the long license header disrupts the reading flow. Nesting is shallow, which is good. Intent is mostly clear, though the lengthy predicate condition could be simplified. Some methods are concise (e.g., getClarifier, getWizardClass), but the mixed indentation (spaces vs tabs) and unnecessary line breaks hurt readability. Action granularity is reasonable, with one primary action per line. Overall, the code is understandable but would benefit from consistent formatting and minor refactoring.

Run 1

Code Structure: Methods are logically separated by responsibility, with a clear class layout. Nesting: Mostly flat, using early returns; wizard initialization has only two conditional levels. Clarity of intent: Class and method names communicate the missing-name check, but abbreviated variables such as dm, me, ins, and sug reduce clarity. The redundant empty-name checks and immediately overwritten default suggestion add distraction. Code length: Implementation is compact, although extensive license text and boilerplate comments increase scanning effort. Action granularity: Most statements occupy separate lines, but getWizardClass places its entire body on one line. Reading flow: Method order is natural, but mixed indentation, awkward line wrapping, repeated facade calls, and inconsistent formatting interrupt otherwise straightforward reading.

Run 2

Code Structure: Small, focused methods organize critic configuration, validation, and wizard setup logically. Nesting: Mostly flat, with early returns and only two conditional levels in initWizard. Clarity of intent: The missing-name check is straightforward, but abbreviated variables (dm, me, ins, sug), framework-specific constants, and a generic class comment reduce clarity. Code length: Generally concise, though the empty-name checks are redundant, the e alias is unnecessary, and the initial suggestion value is overwritten without use. The lengthy license header delays reaching functional code. Action granularity: Most lines contain one statement, but getWizardClass compresses the method declaration and return onto one line. Reading flow: Method ordering is natural, but mixed indentation, awkward line wrapping, repeated facade calls, and inconsistent method formatting interrupt scanning.

Run 3

Code Structure: Responsibilities are organized into small, focused methods with clear separation between validation, wizard setup, and metadata. Nesting: Mostly shallow; initWizard has only two conditional levels, and predicate2 uses an effective early return. Clarity of intent: Class and method names convey the purpose, but abbreviated variables such as dm, me, ins, and sug require interpretation. The redundant empty-name checks and immediately overwritten default suggestion introduce distracting ambiguity. Code length: Implementation is compact, although lengthy license headers, boilerplate comments, and unnecessary assignments add reading overhead. Action granularity: Generally one action per line, except the inline getWizardClass method, which compresses declaration and return. Reading flow: Method order is logical, but inconsistent indentation and awkward wrapping of the namespace lookup interrupt an otherwise straightforward flow.