• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to calculate number of lines of code in a java web project?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Is there any tool available to calculate the number of lines of code in a web project ( I need to calculate number of lines code used in *.java files as well as *.jsp files)
Thanks
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Google for "java static source code analysis" and you'll find a bunch of tools that will give you LOC and much more.

It's also a pretty simple matter to just read all the files in a directory tree and count lines yourself. Do you have to count non-comment lines or anything tricky?

That said, many of us would be very skeptical of any use of line counts as a measure of productivity, defects per line or much of anything except finding dangerous classes or methods. What's your goal with line counts?
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A useful metric lines of code are not -- celebrity voices impersonated. Count the public methods and provide a ratio of the public to non-public methods. JSPs are easier: zero, since everybody knows you don't put code in JSPs except when asked to create a bad example.
[ October 17, 2005: Message edited by: Rick O'Shay ]
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which will not ignore comments or empty lines - just count lines of *.java-files.

It will work on most linuxes out of the box, while you need UnxUtils for the Win32 platform.

http://unxutils.sourceforge.net/
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stefan Wagner:

Which will not ignore comments or empty lines - just count lines of *.java-files.

It will work on most linuxes out of the box, while you need UnxUtils for the Win32 platform.

http://unxutils.sourceforge.net/



That said, I like to toot into Stans and Ricks horn.
Programmers, who are aware of code-metrics might change from coding for elegance to coding for many lines, making heavy use of cut'n'paste instead of codereuse and useless noise.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic