LOC (Lines Of Code)

"skilled developers may be able to develop the same functionality with far less code"
--Wikipedia "Source Lines Of Code"

A very simple way to count Physical LOC (Lines Of Code) using Unix tools:

$ cd ${your project dir}
$ find -name "*.java" | xargs wc --lines

A general rule (not always true): the lower LOC is, the better the software is.

There are improved tools to calculate LOC, avoiding counting comments, braces, empty lines, etc. But I prefer self explanatory code over comments, avoid unnecessary braces, and unneeded empty lines.
See Spartan Programming (a nice article here); I agree on most of the principles, but with some exceptions (particularly about "minimizing variables names", that reduces code readability).

The only code without bugs is the code not written.


One Response to “LOC (Lines Of Code)”  

  1. 1 LeO

    On some machines you need to invoke

    find . -name “*.java”|xargs wc -l

    resp. to have some ideas of the totals:

    find . -name “*.java”|xargs wc -l|grep “total”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Calendar

October 2008
M T W T F S S
« Sep   Nov »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening