JavaNCSS Metric Results

[ packages] [ objects] [ functions] [ explanations]

The following document contains the results of a JavaNCSSmetric analysis.

Packages

[ packages] [ objects] [ functions] [ explanations]

Packages sorted by NCSS

PackageClassesFunctions NCSS JavadocsJavadoc LinesSingle Comment LinesMulti Comment Lines
jtge.sample.grid42318915890140
jtge.sample.chat.client.ui52214621890145
jtge.sample.toss8181102413312235
jtge.sample.chat.server.ui41710119781116
jtge.sample.chat.common.ui314971155087
jtge.sample.chat.server.core211521353158
jtge.sample.chat.client.core213471561058
jtge.sample.chat1746211029
jtge.sample.chat.common.core.command2540733258
jtge.sample.chat.common.core114212029
Classes totalFunctions total NCSS total JavadocsJavadoc LinesSingle Comment LinesMulti Comment Lines
3213183212961416955

Objects

[ packages] [ objects] [ functions] [ explanations]

TOP 30 classes containing the most NCSS

Object NCSS FunctionsClassesJavadocs
jtge.sample.grid.HexagonCanvas62905
jtge.sample.chat.client.ui.ControlView53824
jtge.sample.grid.GridDemo46712
jtge.sample.chat.Chat39712
jtge.sample.chat.server.ui.ControlView34524
jtge.sample.grid.GridFrame33404
jtge.sample.chat.common.ui.AbstractFrame29513
jtge.sample.chat.server.core.ServerFacade27708
jtge.sample.chat.client.ui.InputView24414
jtge.sample.chat.client.core.ClientFacade23809
jtge.sample.chat.server.ui.OutputView23809
jtge.sample.chat.common.ui.AbstractOutputView22403
jtge.sample.chat.common.ui.AbstractUserListView22505
jtge.sample.toss.View19405
jtge.sample.chat.common.core.command.MessageOrder15304
jtge.sample.chat.client.ui.UserListView14506
jtge.sample.chat.common.core.command.MessageResult14203
jtge.sample.chat.client.ui.OutputView13405
jtge.sample.toss.Controller12303
jtge.sample.toss.Model11203
jtge.sample.chat.client.ui.ClientFrame10102
jtge.sample.chat.server.ui.UserListView10304
jtge.sample.toss.TossGame10202
jtge.sample.chat.server.ui.ServerFrame9102
jtge.sample.toss.Toss9102
jtge.sample.grid.GridFrameMouseAdapter8304
jtge.sample.toss.Loss7203
jtge.sample.toss.Win7203
jtge.sample.chat.client.core.IController6506
jtge.sample.toss.Coin6203

TOP 30 classes containing the most functions

ObjectNCSS Functions ClassesJavadocs
jtge.sample.grid.HexagonCanvas62905
jtge.sample.chat.client.core.ClientFacade23809
jtge.sample.chat.client.ui.ControlView53824
jtge.sample.chat.server.ui.OutputView23809
jtge.sample.chat.Chat39712
jtge.sample.chat.server.core.ServerFacade27708
jtge.sample.grid.GridDemo46712
jtge.sample.chat.client.core.IController6506
jtge.sample.chat.client.ui.UserListView14506
jtge.sample.chat.common.ui.AbstractFrame29513
jtge.sample.chat.common.ui.AbstractUserListView22505
jtge.sample.chat.server.ui.ControlView34524
jtge.sample.chat.client.ui.InputView24414
jtge.sample.chat.client.ui.OutputView13405
jtge.sample.chat.common.ui.AbstractOutputView22403
jtge.sample.chat.server.core.IController5405
jtge.sample.grid.GridFrame33404
jtge.sample.toss.View19405
jtge.sample.chat.common.core.command.MessageOrder15304
jtge.sample.chat.server.ui.UserListView10304
jtge.sample.grid.GridFrameMouseAdapter8304
jtge.sample.toss.Controller12303
jtge.sample.chat.common.core.command.MessageResult14203
jtge.sample.toss.Coin6203
jtge.sample.toss.Loss7203
jtge.sample.toss.Model11203
jtge.sample.toss.TossGame10202
jtge.sample.toss.Win7203
jtge.sample.chat.client.ui.ClientFrame10102
jtge.sample.chat.common.core.IMessageView2102

Averages

NCSS average Program NCSSClasses averageFunctions averageJavadocs average
19.50832.000.254.094.03

Functions

[ packages] [ objects] [ functions] [ explanations]

TOP 30 functions containing the most NCSS

Function NCSS CCNJavadoc
jtge.sample.grid.GridFrame.GridFrame(String,HexagonCanvas)1731
jtge.sample.chat.client.ui.ControlView.ControlView(IController)1631
jtge.sample.chat.Chat.main(String[])1251
jtge.sample.grid.GridDemo.main(String[])1211
jtge.sample.grid.GridDemo.show(JFrame,JFrame,JFrame,JFrame)1120
jtge.sample.grid.HexagonCanvas.drawGrid(Graphics)1120
jtge.sample.chat.server.core.ServerFacade.ServerFacade()1011
jtge.sample.chat.server.ui.ControlView.ControlView(IController)1031
jtge.sample.chat.Chat.show(JFrame)820
jtge.sample.chat.Chat.usage(String)810
jtge.sample.chat.client.ui.ClientFrame.ClientFrame(String,IController)811
jtge.sample.chat.client.ui.InputView.createSendField()810
jtge.sample.chat.common.ui.AbstractFrame.configureClose(IClosable)810
jtge.sample.grid.HexagonCanvas.createOffscreen()810
jtge.sample.toss.TossGame.main(String[])811
jtge.sample.chat.client.ui.ControlView.createLogoutButton()710
jtge.sample.chat.client.ui.InputView.InputView(IController)731
jtge.sample.chat.common.core.command.MessageResult.MessageResult(IUser,String)751
jtge.sample.chat.common.ui.AbstractOutputView.createText()710
jtge.sample.chat.server.ui.ControlView.createStopButton()710
jtge.sample.chat.server.ui.OutputView.OutputView(IController)731
jtge.sample.chat.server.ui.ServerFrame.ServerFrame(String,IController)711
jtge.sample.grid.GridFrame.displayPosition(Point)721
jtge.sample.grid.HexagonCanvas.HexagonCanvas(IGrid,IHexagonBuilder,int)711
jtge.sample.grid.HexagonCanvas.drawCoordinate(Graphics,Coordinate,Polygon)710
jtge.sample.toss.Toss.execute(IContext)721
jtge.sample.chat.client.ui.ControlView.createLoginButton()610
jtge.sample.chat.common.ui.AbstractFrame.createPanel()610
jtge.sample.chat.common.ui.AbstractOutputView.createScrollPane(JComponent)610
jtge.sample.chat.common.ui.AbstractUserListView.createScrollPane(JComponent)610
Program NCSS: NCSS average CCN averageJavadocs average
832.003.931.340.70

Explanations

[ packages] [ objects] [ functions] [ explanations]

Non Commenting Source Statements (NCSS)

Statements for JavaNCSS are not statements as specified in the Java Language Specification but include all kinds of declarations too. Roughly spoken, NCSS is approximately equivalent to counting ';' and '{' characters in Java source files.

Actually, the NCSS counter gets incremented by one for each:

ExamplesComment
Package declarationpackage java.lang;
Import declarationimport java.awt.*;
Class declaration- public class Foo {

- public class Foo extends Bla {
Interface declarationpublic interface Able ; {
Field declaration- int a;

- int a, b, c = 5, d = 6;
No matter how many fields get actually declared through a comma separated list, and no matter if these fields get actually initialized, only one statement is counted. So "int a, b, c = 5, d = 6;" gets only +1 count, not four or even six (let me know if there is good reason to count it differently).
Method declaration- public void cry();

- public void gib() throws DeadException {
Constructor declarationpublic Foo() {
Constructor invocation- this();

- super();
Statement- i = 0;

- if (ok)

- if (exit) {

- if (3 == 4);

- if (4 == 4) { ; }

- } else {
expression, if, else, while, do, for, switch, break, continue, return, throw, synchronized, catch, finally
Labelfine :normal, case, default

Not counted are empty statements, empty blocks or semicolons after closing brackets. Of course, comments don't get counted too. Closing brackets also never get counted, the same applies to blocks in general.

In some cases consecutive semicolons are illegal according to the JLS but JavaNCSS still tolerates them (thought JavaNCSS is still more strict as 'javac'). Nevertheless they are never counted as two statements.

Cyclomatic Complexity Number (CCN)

CCN is also know as McCabe Metric. There exists a much hyped theory behind it based on graph theory, but it all comes down to simply counting 'if', 'for', 'while' statements etc. in a method. Whenever the control flow of a method splits, the "CCN counter" gets incremented by one.

Each method has a minimum value of 1 per default. For each of the following Java keywords/statements this value gets incremented by one:

  • if
  • for
  • while
  • case
  • catch
Also if the control flow of a method returns abortively the CCNvalue will be incremented by one:
  • return
  • throw

An ordinary return at the end of method (no matter if it's a function or a procedure) will not be counted.

Note that else, default, and finallydon't increment the CCN value any further. On the other hand, a simple method with a switchstatement and a huge block of casestatements can have a surprisingly high CCN value (still it has the same value when converting a switchblock to an equivalent sequence of ifstatements).

The first article about this trivial software metric is one of the most cited papers in computer science. Sometimes you just must be the first to point out some basic shit and you are history. It seems just like a wonder that nobody was able to package Lines of Code in a more scientific manner. Now it's too late to label someone's name on it :).