Source Code Readability Metric

 Concept

We know that readability is a critical component of software quality, but the determining factors of readability are not well understood.

We can use data from human annotators obtained through SnippetSniper to extract local source code features (like line length) that are predicative of readability. Using that, we can construct an automated metric that can quickly "score" software on its readability in a way similar to Flesh-Kincaid in the natural language domain.

Data Sets

votes (html) (csv)

snippets

Try it out

Executable jar readability.jar (5.4MB)

Run with " java -jar readability.jar "

Then enter code to check readability. Terminate code fragments with " ### "

Example: (readability is 0.729)

> java -jar readability.jar
*** Readability Metric 0.2010.12 ***

public static void main(String[] args)
{
System.out.println("Hello World!");
}

###
0.7292019724845886

Or link in readability.jar and call getReadability() direct from your java (5+) code:

raykernel.apps.readability.eval.Main : public static double getReadability(String s)

External Software Resources

weka (API) - "a collection of machine learning algorithms for data mining tasks"

FindBugs - Looks for errors in java byte code.

ċ
readability.jar
(5410k)
Ray Buse,
Feb 18, 2015, 1:41 PM
ċ
Ray Buse,
Feb 18, 2015, 1:41 PM
ċ
votes.csv
(27k)
Ray Buse,
Feb 18, 2015, 1:41 PM
ċ
votes.html
(1106k)
Ray Buse,
Feb 18, 2015, 1:42 PM
Comments