Líneas de código fuente
De Wikipedia, la enciclopedia libre
| El texto que sigue es una traducción defectuosa o incompleta. Si deseas colaborar con Wikipedia, busca el artículo original y mejora o finaliza esta traducción. Puedes dar aviso al autor principal del artículo pegando el siguiente código en su página de discusión: {{subst:Aviso maltraducido|Líneas de código fuente}} ~~~~ |
La definición de línea de código, es básica para la mayor parte del software, es ambigua. El significado de línea de código varía de un lenguaje a otro, pero también dentro de un mismo lenguaje de programación.
En el lenguaje de programación C, por ejemplo, una línea de código puede ser (1) una instrucción acabada en un salto de línea, (2) una instrucción acabada en un punto y coma o (3) cualquier línea del programa que acabe en un salto de línea (comentarios incluidos).
Por ejemplo:
for (i=0; i<100; ++i) {printf("hola");} /* ¿Cuántas líneas tiene este programa? */
Proviene de las siglas en inglés de Source Lines of Code, en español, Líneas de Código Fuente
Contenido |
[editar] El uso de medidas de LoC
De acuerdo a Andrew Tanenbaum, los valores SLOC para diferentes sistemas operativos de la línea de productos de Microsoft Windows NT son las siguientes:
| Año | Sistema Operativo | SLOC (en milliones) |
|---|---|---|
| 1993 | Windows NT 3.1 | 4-5[1] |
| 1994 | Windows NT 3.5 | 7-8[1] |
| 1996 | Windows NT 4.0 | 11-12[1] |
| 2000 | Windows 2000 | more than 29[1] |
| 2001 | Windows XP | 40[1] |
| 2005 | Windows Vista Beta 2 | 50[cita requerida] |
David A. Wheeler ha estudiado el sistema operativo Red Hat (distribución de los sistemas operativos de Linux) e informó que Red Hat versión 7.1 (lanzado en abril de 2001) contiene cerca de 30 milliones de SLOC físicos. También extrapoló que, de haber sido desarrollado por medios convencionales de propiedad (medida de tiempo-persona) habría requerido de unos 8.000 años-persona de esfuerzo y desarrollo y hubiesen costado más de $1 billón de dólares (cotizados en el año 2000)
Un estudio similar reveló que Debian version 2.2 (conocido tambien como "Papa") contiene unos 55 millones de SLOC y de haber sido realizado mediante las propiedades convencionales, hubiese tardado unos 14005 años-persona y costado unos $1.9 billones de dólares. Más tarde se ejecutó una de las herramientas utilizadas en el informe para la siguiente versión de y se reportó que Debian posee 104 millones de SLOC, y a partir del año 2005, las siguientes versiones poseerán, al menos, más de 213 millones de SLOC.
Se pueden encontrar las cifras de los principales sistemas operativos (las distintas versiones de Windows se han presentado en una tabla de arriba)
| Sistema Operativo | SLOC (en milliones) |
|---|---|
| Red Hat Linux 6.2 | 17[cita requerida] |
| Red Hat Linux 7.1 | 30[cita requerida] |
| Debian 2.2 | 55-59[2] [3] |
| Debian 3.0 | 104[3] |
| Debian 3.1 | 215[3] |
| Debian 4.0 | 283[3] |
| OpenSolaris | 9.7 |
| FreeBSD | 8.8 |
| Mac OS X 10.4 | 86[4] |
| Núcleo de Linux 2.6.0 | 5.2 |
En comparación, las cifras de algunas herramientas gráficas.
| Graphics Program | SLOC (Million) |
|---|---|
| OpenOffice.org | ~10[cita requerida] |
| Blender 2.42 | ~1[cita requerida] |
| GIMP v2.3.8 | 0.65[cita requerida] |
| Paint.NET 3.0 | 0.13[cita requerida] |
[editar] Programas para contar líneas de código
There are many applications available for programmatically counting lines of code within source. Requirements for a source code metric tool should include the ability to process many source code languages and be operating system independent. Companies that use one tool for C on Windows and another tool for C on UNIX and a third tool for Java on Linux do not develop a common estimation basis for their CMMI metrics.
[editar] Free/Open Source
- The simplest source line counting command in UNIX variants is wc. For example, to count the number of lines in all
.cxx,.cpp,.hand.cfiles in and below the current directory, one might use the POSIX commands find and wc:
find . \( -name '*.[ch]' -o -name '*.cxx' -o -name '*.cpp' \) -exec wc -l {} \;
| Tool | Platform / Interface | Languages analyzed | Analysis type | License | Details |
|---|---|---|---|---|---|
| CCCC | Cygwin, FreeBSD, Linux, Mac OS X, Microsoft Windows / Línea de comandos | C, C++, and Java | Physical only | GPL | Metrics supported include lines of code, McCabe's cyclomatic complexity and metrics proposed by Chidamber&Kemerer and Henry&Kafura. |
| cloc | Perl | More than sixty programming and markup languages | Physical only | GPL | Counts physical lines of code, blank lines and comment lines. Comment definitions may be read from a file. Report summation features allow line counts to be aggregated by language and by project. |
| CodeCount | Cygwin, FreeBSD, Linux, Mac OS X / Command line interface | Ada, Assembly, C and C++, COBOL, FORTRAN, Java, JOVIAL, Pascal, PL1, C#, JavaScript, MUL, Perl, SQL | Physical and logical | Limited Public License | Requires significant manual steps to build and configure |
| c_count | Cygwin, FreeBSD, Linux, Mac OS X / Command line interface | C, C++, Java | Physical and logical | Licencia MIT | |
| kloc | Cygwin, FreeBSD, Linux, Mac OS X / Command line interface | C, C++, Java | Physical only | GPL | The line comment marker and block comment marker can be configured using a configuration file, allowing user to count effective lines of code and lines of comments for C, C++, Java, etc. |
| Metrics | Eclipse IDE / Interfaz gráfica de usuario | Java | Physical only | CPL | |
| SLOCCount | Cygwin, FreeBSD, Linux, Mac OS X / Command line interface | More than two dozen programming languages | Physical only | GPL | Only reports lines of code |
[editar] Freeware (código cerrado)
- K-LOC Calculator is a free Windows tool for counting physical lines.
- Code Analyzer is a free Java tool for counting LoC, computing McCabe complexity etc. for various languages.
- LinesOfCodeWichtel is a free Java tool for counting lines of code in various languages.
- LocMetrics is a free Windows tool for counting lines of C#, Java, or C++ code.
- Source Line of Code Counter A free .net based SLOC counter, supports regular expression matching, equipped with a directory browser.
- Source Monitor is a free Windows tool for counting lines of code and deriving metrics from C++, C, C#, Java, and other source code.
- Two Windows PowerShell ways to count SLOC in all .cxx, .cpp, .h, and .c files in and below the current directory:
Get-ChildItem -recurse -include *.cxx,*.cpp,*.h,*.c | Get-Content | Measure-Object -line ls -r -i *.cxx,*.cpp,*.h,*.c | gc | measure-object -l
[editar] Comerciales
- EZ-Metrix is a commercial web-based source code counting utility that measures more than 75 different languages, and compares two file lists to quantify differences (i.e., new, modified, deleted, unmodified).
- Resource Standard Metrics is a commercial tool designed to process ANSI C, ANSI C++, C#, and Java 2.0+ while operating on Windows, UNIX, Linux and Mac OS X.
- Another program for Windows, Code Counter Pro, which counts physical KLOCs and supports languages like C, C++, C#, Java, Cobol, Delphi, VB, ASP, PHP and Fortran.
[editar] Basados en Web
- Ohloh extracts LOC and other software metrics of open source projects from publicly accessible revision control repositories. It generates analyses and reports of development activity available as graphs and API-based web-services.
[editar] Véase también
[editar] Referencias
- ↑ a b c d e How Many Lines of Code in Windows?, Knowing.NET, December 06, 2005, http://www.knowing.net/PermaLink,guid,c4bdc793-bbcf-4fff-8167-3eb1f4f4ef99.aspx, consultado el 2007-10-18
This in turn cites Vincent Maraia's The Build Master as the source of the information. - ↑ González-Barahona, Jesús M., Miguel A. Ortuño Pérez, Pedro de las Heras Quirós, José Centeno González, and Vicente Matellán Olivera. «Counting potatoes: the size of Debian 2.2». debian.org. Consultado el 2003-08-12.
- ↑ a b c d Robles, Gregorio. «Debian Counting». Consultado el 2007-02-16.
- ↑ Jobs, Steve (August de 2006). «Live from WWDC 2006: Steve Jobs Keynote». Consultado el 2007-02-16. «86 million lines of source code that was ported to run on an entirely new architecture with zero hiccups.»
[editar] Enlaces externos
- Definiciones útiles sobre código fuente Recurse Standard Metrics (RSM) define "líneas de código fuente eficaces" con un realista medida, independientemente del estilo de programación.
- Líneas de codigo fuente efectivas de eLOC Metrics para el popular software libre Linux Kernel 2.6.17, Firefox, Apache HPPD, MySQL, PHP usando RSM.
- Wheeler, David A.. «SLOCCount». Consultado el 2003-08-12.
- Wheeler, David A. (June de 2001). «Contando líneas de código fuente. (SLOC)». Consultado el 2003-08-12.
- Tanenbaum, Andrew S. Sistemas operativos modernos (segunda edición). Prentice Hall. ISBN 0-13-092641-8.
- Howard Dahdah (2007-01-24). «Tanenbaum outlines his vision for a grandma-proof OS». Consultado el 2007-01-29.
- C. M. Lott: Herramientas de colección métrica para códigos fuente para C y C++

