Differentiate between LOC and Function Point in Software Engineering
Last Updated : 25 Sep, 2024
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 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 number 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 held up by the software are used to find FPC (function point count).
Example of function point :
Check out this article for a 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 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.
For a comprehensive overview of LOC and FP, including detailed examples and calculations, explore our course, " Complete Guide to Software Testing ," at GeeksforGeeks.
Difference between LOC and Function Point :
Function Point (FP) | Line of Code (LOC) |
Function Point metric is specification-based. | LOC metric is based on analogy. |
Function Point metric is language independent. | LOC metric is dependent on language. |
Function Point metric is user-oriented. | LOC metric is design-oriented. |
Function Point metric is extendible to Line of Code. | It is changeable to FP (i.e. backfiring) |
Function Point is used for data processing systems | LOC is used for calculating the size of the computer program |
Function Point can be used to portray the project time | LOC is used for calculating and comparing the productivity of programmers. |
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.
Similar Reads
Function Oriented Design - Software Engineering The design process for software systems often has two levels. At the first level, the focus is on deciding which modules are needed for the system based on SRS (Software Requirement Specification) and how the modules should be interconnected. Function Oriented Design is an approach to software desig
3 min read
Software Engineering | Calculation of Function Point (FP) Function Point (FP) is an element of software development which helps to approximate the cost of development early in the process. It may measures functionality from user's point of view. Counting Function Point (FP): Step-1: F = 14 * scale Scale varies from 0 to 5 according to character of Complexi
4 min read
Lines of Code (LOC) in Software Engineering A line of code (LOC) is any line of text in a code that is not a comment or blank line, and also header lines, in any case of the number of statements or fragments of statements on the line. LOC consists of all lines containing the declaration of any variable, and executable and non-executable state
4 min read
Difference between Function and Procedure Pre-requisites: What is SQL? Structured Query Language is a computer language that we use to interact with a relational database.SQL is a tool for organizing, managing, and retrieving archived data from a computer database. In this article, we will see the difference between Function and Procedure.
3 min read
Difference between Program and Function 1. Program : Program, as name suggest, are set or collection of instructions used by computer to execute specific task and these are created using particular programming languages such as C++, Python, Ruby, etc. 2. Function : Function, as name suggests, is basic concept in computer programming that
2 min read