Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Source lines of code
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Usage of SLOC measures== {{weasel words|date=September 2013}} SLOC measures are somewhat controversial, particularly in the way that they are sometimes misused. Experiments have repeatedly confirmed that effort is highly correlated with SLOC{{Citation needed|date=July 2009}}, that is, programs with larger SLOC values take more time to develop. Thus, SLOC can be effective in estimating effort. However, functionality is less well correlated with SLOC: skilled developers may be able to develop the same functionality with far less code, so one program with fewer SLOC may exhibit more functionality than another similar program. Counting SLOC as productivity measure has its caveats, since a developer can develop only a few lines and yet be far more productive in terms of functionality than a developer who ends up creating more lines (and generally spending more effort). Good developers may merge multiple code modules into a single module, improving the system yet appearing to have negative productivity because they remove code. Furthermore, inexperienced developers often resort to [[Duplicate code|code duplication]], which is highly discouraged as it is more bug-prone and costly to maintain, but it results in higher SLOC. SLOC counting exhibits further accuracy issues at comparing programs written in different languages unless adjustment factors are applied to normalize languages. Various [[computer language]]s balance brevity and clarity in different ways; as an extreme example, most [[assembly language]]s would require hundreds of lines of code to perform the same task as a few characters in [[APL programming language|APL]]. The following example shows a comparison of a [[Hello world program|"hello world" program]] written in [[BASIC]], [[C (programming language)|C]], and [[COBOL]] (a language known for being particularly verbose). {| class="wikitable" style="margin: 1em auto 1em auto" |- ! BASIC || C || COBOL |- | <syntaxhighlight lang="BASIC"> PRINT "hello, world" </syntaxhighlight> || <syntaxhighlight lang="c"> #include <stdio.h> int main() { printf("hello, world\n"); } </syntaxhighlight> || <syntaxhighlight lang="cobol"> identification division. program-id. hello . procedure division. display "hello, world" goback . end program hello . </syntaxhighlight> |- |Lines of code: 1<br />(no whitespace)||Lines of code: 4<br />(excluding whitespace) || Lines of code: 6<br />(excluding whitespace) |} Another increasingly common problem in comparing SLOC metrics is the difference between auto-generated and hand-written code. Modern software tools often have the capability to auto-generate enormous amounts of code with a few clicks of a mouse. For instance, [[graphical user interface builder]]s automatically generate all the source code for a [[Graphical control element (software)|graphical control elements]] simply by dragging an icon onto a workspace. The work involved in creating this code cannot reasonably be compared to the work necessary to write a device driver, for instance. By the same token, a hand-coded custom GUI class could easily be more demanding than a simple device driver; hence the shortcoming of this metric. There are several cost, schedule, and effort estimation models which use SLOC as an input parameter, including the widely used Constructive Cost Model ([[COCOMO]]) series of models by [[Barry Boehm]] et al., [[PRICE Systems]] [[True S]] and Galorath's [[SEER-SEM]]. While these models have shown good predictive power, they are only as good as the estimates (particularly the SLOC estimates) fed to them. Many<ref>IFPUG [http://www.qpmg.com/pdf/articles/Quantifying_the_Benefits_Using_Function_Points.pdf "Quantifying the Benefits of Using Function Points"]</ref> have advocated the use of [[function point]]s instead of SLOC as a measure of functionality, but since function points are highly correlated to SLOC (and cannot be automatically measured) this is not a universally held view. ===Example=== According to Vincent Maraia,<ref name = "Knowing.NET"/> the SLOC values for various operating systems in [[Microsoft]]'s [[Windows NT]] product line are as follows: {| class="wikitable" summary="Microsoft Windows NT SLOC Sizes" |- ! Year || Operating system || SLOC (million) |- | 1993 || Windows NT 3.1 || 4–5<ref name = "Knowing.NET">{{cite web |url=http://www.knowing.net/index.php/2005/12/06/how-many-lines-of-code-in-windows/ |title=How Many Lines of Code in Windows? |publisher=Knowing.NET |date=December 6, 2005 |access-date=2010-08-30 }}<br />This in turn cites Vincent Maraia's ''The Build Master'' as the source of the information.</ref> |- | 1994 || Windows NT 3.5 || 7–8<ref name = "Knowing.NET"/> |- | 1996 || Windows NT 4.0 || 11–12<ref name = "Knowing.NET"/> |- | 2000 || Windows 2000 || more than 29<ref name = "Knowing.NET"/> |- | 2001 || Windows XP || 45<ref>{{cite web |url=https://www.facebook.com/windows/posts/155741344475532 |archive-url=https://ghostarchive.org/iarchive/facebook/30968512668/155741344475532 |archive-date=2022-02-26 |url-access=limited|title=How Many Lines of Code in Windows XP? |publisher=Microsoft |date=January 11, 2011 }}{{cbignore}}</ref><ref>{{Cite web|date=2012-09-21|title=A history of Windows - Microsoft Windows|url=http://windows.microsoft.com/en-AU/windows/history#T1=era6|access-date=2021-03-26|archive-url=https://web.archive.org/web/20120921002229/http://windows.microsoft.com/en-AU/windows/history#T1=era6|archive-date=2012-09-21}}</ref> |- | 2003 || Windows Server 2003 || 50<ref name = "Knowing.NET"/> |} David A. Wheeler studied the [[Red Hat]] distribution of the [[Linux|Linux operating system]], and reported that Red Hat Linux version 7.1<ref name = "Wheeler-RH7.1">{{cite web |date=2001-06-30 |url=http://www.dwheeler.com/sloc/redhat71-v1/redhat71sloc.html |author=David A. Wheeler |title=More Than a Gigabuck: Estimating GNU/Linux's Size }}</ref> (released April 2001) contained over 30 million physical SLOC. He also extrapolated that, had it been developed by conventional proprietary means, it would have required about 8,000 person-years of development effort and would have cost over $1 billion (in year 2000 U.S. dollars). A similar study was later made of [[Debian GNU/Linux]] version 2.2 (also known as "Potato"); this operating system was originally released in August 2000. This study found that Debian GNU/Linux 2.2 included over 55 million SLOC, and if developed in a conventional proprietary way would have required 14,005 person-years and cost US$1.9 billion to develop. Later runs of the tools used report that the following release of Debian had 104 million SLOC, and {{As of|2005|alt=as of year 2005}}, the newest release is going to include over 213 million SLOC. {| class="wikitable" summary="Operating Systems SLOC Sizes" |- ! Year || Operating system || SLOC (million) |- | 2000 || Debian 2.2 || 55–59<ref>{{cite web | author = González-Barahona, Jesús M. |author2=Miguel A. Ortuño Pérez |author3=Pedro de las Heras Quirós |author4=José Centeno González |author5=Vicente Matellán Olivera | title = Counting potatoes: the size of Debian 2.2 | url = http://people.debian.org/~jgb/debian-counting/counting-potatoes/ | work = debian.org | access-date = 2003-08-12 |archive-url = https://web.archive.org/web/20080503001817/http://people.debian.org/~jgb/debian-counting/counting-potatoes/ |archive-date = 2008-05-03}}</ref><ref name="debian-sloc">{{cite web | last = Robles | first = Gregorio | title = Debian Counting | url = http://debian-counting.libresoft.es/ | access-date = 2007-02-16 | url-status = dead | archive-url = https://web.archive.org/web/20130314230249/http://debian-counting.libresoft.es/ | archive-date = 2013-03-14 }}</ref> |- | 2002 || Debian 3.0 || 104<ref name="debian-sloc"/> |- | 2005 || Debian 3.1 || 215<ref name="debian-sloc"/> |- | 2007 || Debian 4.0 || 283<ref name="debian-sloc"/> |- | 2009 || Debian 5.0 || 324<ref name="debian-sloc"/> |- | 2012 || Debian 7.0 || 419<ref>Debian 7.0 was released in May 2013. The number is an estimate published on 2012-02-13, using the code base which would become Debian 7.0, using the same software method as for the data published by David A. Wheeler. {{cite web|author=James Bromberger |title=Debian Wheezy: US$19 Billion. Your price... FREE! |url=http://blog.james.rcpt.to/2012/02/13/debian-wheezy-us19-billion-your-price-free/ |access-date=2014-02-07 |url-status=dead |archive-url=https://web.archive.org/web/20140223013701/http://blog.james.rcpt.to/2012/02/13/debian-wheezy-us19-billion-your-price-free/ |archive-date=2014-02-23 }}</ref> |- | 2009 || [[Opensolaris|OpenSolaris]] || 9.7 |- | || [[FreeBSD]] || 8.8 |- | 2005 || [[Mac OS X]] 10.4 || 86<ref>{{cite web | last = Jobs | first = Steve | title = Live from WWDC 2006: Steve Jobs Keynote | url = https://www.engadget.com/2006/08/07/live-from-wwdc-2006-steve-jobs-keynote/ |date=August 2006 | access-date = 2007-02-16 | quote = 86 million lines of source code that was ported to run on an entirely new architecture with zero hiccups.}}</ref><ref group="n">Possibly including the whole iLife suite, not just the operating system and usually bundled applications.</ref> |- | 1991 || [[Linux kernel]] 0.01 || 0.010239 |- | 2001 || Linux kernel 2.4.2 || 2.4<ref name = "Wheeler-RH7.1"/> |- | 2003 || Linux kernel 2.6.0 || 5.2 |- | 2009 || Linux kernel 2.6.29 || 11.0 |- | 2009 || Linux kernel 2.6.32 || 12.6<ref>{{cite web|url=http://www.h-online.com/open/features/What-s-new-in-Linux-2-6-32-872271.html |title=What's new in Linux 2.6.32 |access-date=2009-12-24 |archive-url=https://web.archive.org/web/20131219054613/http://www.h-online.com/open/features/What-s-new-in-Linux-2-6-32-872271.html?view=print |archive-date=2013-12-19 |url-status=live |date=2009-12-03 |author=Thorsten Leemhuis}}</ref> |- | 2010 || Linux kernel 2.6.35 || 13.5<ref>{{cite web| url=http://go.linuxfoundation.org/who-writes-linux-2012 | title=Linux Kernel Development: How Fast it is Going, Who is Doing It, What They are Doing, and Who is Sponsoring It | date = April 2012 |author1=Greg Kroah-Hartman |author2=Jonathan Corbet |author3=Amanda McPherson | publisher=[[The Linux Foundation]] | access-date=2012-04-10}}</ref> |- | 2012 || Linux kernel 3.6 || 15.9<ref>{{cite web|url=http://www.h-online.com/open/features/What-s-new-in-Linux-3-6-1714690.html%3Fpage=3 |title=Summary, Outlook, Statistics - The H Open: News and Features |archive-url=https://web.archive.org/web/20131219054847/http://www.h-online.com/open/features/What-s-new-in-Linux-3-6-1714690.html?page=3 |archive-date=2013-12-19 |url-status=live |date=2012-10-01 |author=Thorsten Leemhuis}}</ref> |- | 2015-06-30 || Linux kernel pre-4.2 || 20.2<ref>{{cite web | url=http://heise.de/-2730780 | title=Linux-Kernel durchbricht die 20-Millionen-Zeilen-Marke | date=30 June 2015 }}</ref> |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)