7 Replies - 509 Views - Last Post: 26 July 2019 - 08:20 PM

#1 O'Niel   User is offline

  • D.I.C Regular

Reputation: 15
  • View blog
  • Posts: 462
  • Joined: 13-September 15

SLOCCount your project! How accurate?

Posted 25 July 2019 - 07:24 PM

Hello

Sloccount is a tool to count the lines of code in your project, it also gives the total estimated cost to develop... Does someone know how accurate this is?



Let's do a test!! Use sloccount on your favorite project and post the results here... These are the results I got from a project I'm currently working on:

Totals grouped by language (dominant language first):
php:          22045 (66.54%)
javascript:     10743 (32.43%)
sh:             278 (0.84%)
perl:            64 (0.19%)




Total Physical Source Lines of Code (SLOC)                = 33,130
Development Effort Estimate, Person-Years (Person-Months) = 7.89 (94.72)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 1.17 (14.09)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 6.72
Total Estimated Cost to Develop                           = $ 1,066,287
 (average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."




Install sloccount using sudo apt-get install sloccount

Is This A Good Question/Topic? 0
  • +

Replies To: SLOCCount your project! How accurate?

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7025
  • View blog
  • Posts: 23,856
  • Joined: 05-May 12

Re: SLOCCount your project! How accurate?

Posted 25 July 2019 - 08:33 PM

If I am reducing the number of lines of code within a project, I am actually contributing more to the long term health of the project than by adding more lines of code to the project. I don't see how the COCOMO model accounts for this "cost" vs. "value".
Was This Post Helpful? 1
  • +
  • -

#3 Salem_c   User is online

  • void main'ers are DOOMED
  • member icon

Reputation: 2370
  • View blog
  • Posts: 4,498
  • Joined: 30-May 10

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 03:57 AM

> Total Estimated Cost to Develop = $ 1,066,287
Possibly accurate to within an order of magnitude, so anywhere between $100K and $10M.

Reducing a multi-dimensional quantity to a single dimensional quantity comes with some assumptions.

There's no way to compare the cost and complexity of say a few hundred lines of an FFT implementation, with say the few hundred lines of GUI boilerplate code.

Over a sufficiently large project with many kinds of modules between the trivial and the complex, it might not be that bad.

But as a planning tool for individual modules, taking an estimate of the number of lines of code and saying it will cost $X to develop would be horrible.
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7025
  • View blog
  • Posts: 23,856
  • Joined: 05-May 12

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 04:54 AM

View PostSalem_c, on 26 July 2019 - 06:57 AM, said:

Reducing a multi-dimensional quantity to a single dimensional quantity comes with some assumptions.

To quote from David Wheeler, the author of SLOCCount:

Quote

SLOCCount currently only measures physical SLOC, and not the alternative logical SLOC. Adding logical SLOC should not be too difficult, it's just that I didn't need it for my purposes. If anyone wishes to add that capability, please do so; I accept patches.

It can only provide estimates, and if you don't calibrate it, it will use data from other programs that may or may not be representative.

Warning: there's more to a software program than just how many lines of code it has, as the August 26, 2003 Dilbert strip shows.

Was This Post Helpful? 0
  • +
  • -

#5 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7025
  • View blog
  • Posts: 23,856
  • Joined: 05-May 12

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 05:00 AM

View PostSalem_c, on 26 July 2019 - 06:57 AM, said:

There's no way to compare the cost and complexity of say a few hundred lines of an FFT implementation, with say the few hundred lines of GUI boilerplate code.

True. This is why I think Boehm has this huge table of "fudge factors". (Sorry, I'm too lazy to try to rebuild the table here. Please follow the link.)
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2918
  • View blog
  • Posts: 11,334
  • Joined: 03-December 12

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 07:18 AM

Useless metric.

Production cost would include getting the requirements, no lines are being calculated for that time or refinement.
Design time, no lines.
Coding time, hey we have lines now.
Testing, possibly have lines, or maybe not - depends on the tests.
Deployment.

So in all you have one with two optionals that don't get factored in. And, lines should never be a factor of software.
Was This Post Helpful? 0
  • +
  • -

#7 O'Niel   User is offline

  • D.I.C Regular

Reputation: 15
  • View blog
  • Posts: 462
  • Joined: 13-September 15

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 07:55 PM

I totally agree with you all that amount lines of code doesn't say anything about the quality of the project without considering the other parameters.

Yesterday I stumbled on this tool by accident and decided to test it out on a project I was currently working on, and the result just surprised me. :P

I guess it's not really accurate, because besides a lot of my time I haven't spend a single euro on this project... It's made in my free time soo...

However, reading more about B. Boehm and software cost estimation got me really interested in the subject. I'll definitely be reading more about this, because I think it's a great advantage to have a little bit of insight/knowledge in this matter whenever discussing projects in a business-environment/team.
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7025
  • View blog
  • Posts: 23,856
  • Joined: 05-May 12

Re: SLOCCount your project! How accurate?

Posted 26 July 2019 - 08:20 PM

View Postastonecipher, on 26 July 2019 - 10:18 AM, said:

Production cost would include getting the requirements, no lines are being calculated for that time or refinement.
Design time, no lines.
Coding time, hey we have lines now.
Testing, possibly have lines, or maybe not - depends on the tests.
Deployment.

Take time to read the documentation I linked to on Wheeler's website. The cost of requirements gathering, prototyping, documentation, testing, paying salaries, paying rent for the office, paying for office equipment, etc. is factored into the cost based on Beohm's book: Software Engineering Economics.

I've not read the book, but my understanding is that Boehm took a survey a diverse set of software projects and figured out how much each project cost overall and he come up with the COCOMO model. The book is quite dated though: 1981. Note that in 1981 "modern programming practices" was "structured programming", not "object oriented programming" and "functional programming" as we know it today. At that time, waterfall and its inherent cost overhead was de riguer.

Notice that the SLOCCount code doesn't even deal with HTML, CSS, or Javascript. The only build script it deals with is makefile, and it seems to not know anything about Maven, Ant, MSBuild, etc.

I agree, though, that using lines of code as a metric for cost of software does not really account for the total cost and/or effort put into it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1