lines of code


lines of code

(programming, unit)(LOC) A common measure of the size orprogress of a programming project. For example, one candescribe a completed project as consisting of 100,000 LOC; orone can characterise a week's progress as 5000 LOC.

Using LOC as a metric of progress encourages programmers toreinvent the wheel or split their code into lots of shortlines.

lines of code

The instructions a programmer writes when creating a program. Lines of code are the "source code" of the program, and one line may generate one machine instruction or several depending on the programming language. A line of code in assembly language is typically turned into one machine instruction. In a high-level language such as C++ or Java, one line of code generates a series of assembly language instructions, which results in multiple machine instructions. For coding examples, see source code.

Lines of Code Are Not All the Same
A single line of code may call for the inclusion of a subroutine that can be of any size, so while lines of code are commonly used to measure the overall complexity of a program, the metric is not absolute. Comparisons can also be misleading if the programs are written in different languages. For example, 20 lines of code in Java might easily require 200 lines of code in assembly language.

In addition, measuring lines of code says absolutely nothing about code quality. Five hundred lines written by a seasoned programmer can perform the same processing as two thousand lines of code by another. See assembly language, machine language and compiler.