Tell me…
- Haven’t you ever wondered how many times you actually “synchronized” something?
- Didn’t you worry about not using the “do {} while ()” loop structure often enough?
- Are you an expert in applying “volatile”?
- Do you “catch” more often than you “try”?
- Is your program rather “true” or rather “false?
- And how did that “goto” make it into your source code??
Here’s a bit of a distraction among all the other, rather informative posts I’ve written recently. An utterly useless ranking of the top Java keywords in jOOQ. I mean, after all, useful metrics can already be reviewed at ohloh, or collected with FindBugs and JArchitect
Now, you can figure it out. Here’s the ranking!
Keyword Count public 8127 return 6801 final 6608 import 5938 static 3903 new 3110 extends 2111 int 1822 throws 1756 void 1707 if 1661 this 1464 private 1347 class 1239 case 841 else 839 package 711 boolean 506 throw 495 for 421 long 404 true 384 byte 345 interface 337 false 332 protected 293 super 265 break 200 try 149 switch 146 implements 139 catch 127 default 112 instanceof 107 char 96 short 91 abstract 54 double 43 transient 42 finally 34 float 34 enum 25 while 23 continue 12 synchronized 8 volatile 6 do 1
Curious about your own Java keyword ranking? I’ve published the script to calculate these values on GitHub, under the ASL 2.0 license. Check out the sources here:
https://github.com/lukaseder/silly-metrics
Use it, and publish your own rankings! And feel free to provide pull requests to count keywords from other languages, or to calculate entirely different silly and useless metrics.