Skip to content
Related Articles
Differentiate between LOC and Function Point in Software Engineering
• Last Updated : 26 Apr, 2021

1. Lines of Code (LOC) :
The line of code (LOC) metric is any line of text in a code that is not a comment or blank line, in any case of the number of statements or fragments of statements on the line. LOC clearly consists of all lines containing program header files, declaration of any variable, and executable and non-executable statements. As Lines of Code (LOC) only counts the proportion of code, you can only utilize it to compare or estimate projects that utilize the same language and are programmed using the same coding standards.

Example of Line of Code :

## C++

 `void` `selSort(``int` `x[], ``int` `n) {``  ``//Below function sorts an array in ascending order ``   ``int` `i, j, min, temp;``   ``for` `(i = 0; i < n - 1; i++) {``      ``min = i;``      ``for` `(j = i + 1; j < n; j++)``      ``if` `(x[j] < x[min])``      ``min = j;``      ``temp = x[i];``      ``x[i] = x[min];``      ``x[min] = temp;``   ``}``}`

So, now If LOC is simply a count of the numbers of lines then the above function shown contains 13 lines of code (LOC). But when comments and blank lines are ignored, the function shown above contains 12 lines of code (LOC).

2. Function Point (FP) :
In the function point metric, the number and type of functions hold up by the software are used to find FPC (function point count).

Example of function point :
Check out this article for detailed example : Calculation of Function Point (FP)
Both function point and LOC are measurement units for the size of the software. The size of the software that is dependent on development is necessary in order to come up with accurate estimates of the effort, cost, and duration of a project. Most parametric estimation models such as the Constructive Cost Model (COCOMO) accept size conveyed in either FP or LOC as an input.

Difference between LOC and Function Point :

In general, people prefer the functional size of software indicated as Function Point for one very important reason, i.e, the size expressed using the Function point metric stays constant in any case and whichever language or languages are used.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up