Metric: Lines Of Code (LOC)

User Description

The software metric Lines Of Code (LOC) counts the number of source code lines of a program. This metric can be used to estimate the workload for program development, the programming productivity, and the maintainability of the application.

Metric Calculation

Each line in a textual implemented object (Function (FUN), function block (FB), data unit type (DUT), global variable list (GVL), and so on) is considered in the Lines Of Code metric.

Example

Lines Of Code calculation example:

Declaration:
1: PROGRAM SR_Main
2: VAR
3:    x: BOOL;
4: END_VAR

Implementation:
1: 
2: IF (x = TRUE) THEN
3:    DoSomething();
4: END_IF
5: 
6: // A nice comment
7: SpecialMethod();

Lines Of Code Result

Lines Of Code (LOC) = 11