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.
votes (html) (csv)
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)
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.