Difference between revisions of "Architecture/Source Code Inventory/Count Details"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Counting CodeLines)
m (Counting CodeLines)
Line 4: Line 4:
 
How many Lines of code do we have here ?:
 
How many Lines of code do we have here ?:
  
01:  if ( my_function1() )
+
  01:  if ( my_function1() )
02:  {
+
  02:  {
03:      //error handler
+
  03:      //error handler
04:   
+
  04:   
05:  return 1;
+
  05:  return 1;
06:  }
+
  06:  }
07:  // block of instruction 1
+
  07:  // block of instruction 1
08:  if ( my_function2() )
+
  08:  if ( my_function2() )
09:    {
+
  09:    {
10:      //error handler
+
  10:      //error handler
11:   
+
  11:   
12:    return 2;
+
  12:    return 2;
13:    }
+
  13:    }  
14:  // block of instruction 2
+
  14:  // block of instruction 2
15:  if ( my_function3() )
+
  15:  if ( my_function3() )
16:    {
+
  16:    {
17:      //error handler
+
  17:      //error handler
18:   
+
  18:   
19:    return 3;
+
  19:    return 3;
20:    }
+
  20:    }
21:  //  // block of instruction 3 + i
+
  21:  //  // block of instruction 3 + i
22:  //  if ( ... )
+
  22:  //  if ( ... )
23:  //    }
+
  23:  //    }
24:  //    ...
+
  24:  //    ...
25:  //    }
+
  25:  //    }  
26:
+
  26:
27:
+
  27:
28:
+
  28:
29:
+
  29:
30:
+
  30:
  
In my undertanding we have here something like:
+
In my understanding we have here something like:
  
30 Lines
+
  30 Lines
25 Lines of Code (LOC)
+
  25 Lines of Code (LOC)
12 Source Lines of Code (SLOC)
+
  12 Source Lines of Code (SLOC)
10 Comment Lines
+
  10 Comment Lines
6 Descriptive Comments
+
  6 Descriptive Comments
4 Lines Commented Code
+
  4 Lines Commented Code

Revision as of 16:54, 16 November 2006

Counting CodeLines

The term "CodeLines" is somewhat ambigious, therefor one will find plenty of definitions which differ slightly, others are on their way to become something like a standard. For this reason we want to try to negotiate different terms and their meanings, to form a contract of how to understand it when we speak of CodeLines

How many Lines of code do we have here ?:

 01:  if ( my_function1() )
 02:   {
 03:      //error handler
 04:  
 05:   return 1;
 06:   }
 07:  // block of instruction 1
 08:  if ( my_function2() )
 09:    {
 10:       //error handler
 11:  
 12:    return 2;
 13:    } 
 14:  // block of instruction 2
 15:  if ( my_function3() )
 16:    {
 17:       //error handler
 18:  
 19:    return 3;
 20:    }
 21:  //  // block of instruction 3 + i
 22:  //  if ( ... )
 23:  //    }
 24:  //    ...
 25:  //    } 
 26:
 27:
 28:
 29:
 30:

In my understanding we have here something like:

 30 Lines
 25 Lines of Code (LOC)
 12 Source Lines of Code (SLOC)
 10 Comment Lines
  6 Descriptive Comments
  4 Lines Commented Code
Personal tools