290 likes | 710 Views
A SLOC Counting Standard. Vu Nguyen, Sophia Deeds-Rubin, Thomas Tan Center for Systems and Software Engineering CSSE COCOMO Forum 2007. Outline. Introduction Overview Physical vs. Logical Who needs SLOC Existing SLOC definitions Problems With SLOC Counting Practice Limitations
E N D
A SLOC Counting Standard Vu Nguyen, Sophia Deeds-Rubin, Thomas Tan Center for Systems and Software Engineering CSSE COCOMO Forum 2007 (c) USC-CSSE
Outline • Introduction • Overview • Physical vs. Logical • Who needs SLOC • Existing SLOC definitions • Problems With SLOC Counting Practice • Limitations • Tool Mismatch • Counting Standard • What to count • How to count • Example • Conclusions (c) USC-CSSE
Overview • Traditional and popular sizing metric for software • Key input for many major cost estimation tool such as COCOMO, SEER, and SLIM • Direct results of programming work • Two types of lines to count • Physical SLOC • Logical SLOC (c) USC-CSSE
Physical SLOC • Language-independent • Easy to count • Dependent on style and format of language • Inconsistent across organizations, projects, and individual programmers (c) USC-CSSE
Logical SLOC • Independent of style and format • Strong correlation with effort • Recommended as standard size input for estimation models e.g. COCOMO • Lacks precise definitions • Depends on language specifics • Hard to count • Simply counts lines end with semicolon is not the way to do it (c) USC-CSSE
Importance of SLOC • Software Metrics • Estimation tools • COCOMO • SLIM • SEER – SEM • PRICE-S • Quality Measurements (c) USC-CSSE
Current SLOC Definitions • Introduced by Dr. Boehm as Delivered Source Instructions (DSI) or Delivered Source Line of Code (DSLOC) • IEEE provided definitions and attributes of SLOC sizing metrics • SEI extended SLOC metrics into a counting framework (SEI Framework) (c) USC-CSSE
Outline • Introduction • Overview • Physical vs. Logical • Who needs SLOC • Existing SLOC definitions • Problems With SLOC Counting Practice • Limitations • Tool Mismatch • Counting Standard • What to count • How to count • Example • Conclusions (c) USC-CSSE
SEI Framework • Focus on What to Count rather than How Many to Count • Provides a good checklist of the items that should be counted • Does not have the standard of how many to count for each item • Leave that decision to the user • often leads to inconsistency in user’s choice (c) USC-CSSE
SEI Framework (cont) • Example • Two different companies may have two different results for the following: How may logical SLOC counted? • if (x > 0) { • printf(“x is a positive number”); • } if (x > 0) printf(“x is a positive number”); 1 or 2 SLOC? (c) USC-CSSE
Experiment • Counting tools • At least 20 SLOC counting tools publicly available. Few supports logical SLOC • Logical SLOC results from tools are significantly different • Experiment • Three SLOC counting tools: CodeCount, RSM, and LocMetrics • Counting physical and logical SLOC of three open-source software: OpenWbem, FlighGear, and wxWidgets (c) USC-CSSE
Experiment (cont) • Comparison Results: (c) USC-CSSE
Experiment (cont) • Results (cont) • CodeCount’s logical SLOC are about: • 150% of RSM • 110% of LocMetrics • COCOMO Estimates • RSM: 67% of CodeCount’s • LocMetrics: 88% of CodeCount’s (c) USC-CSSE
Experiment Conclusions • Need to have consistent counting standard to tell how many count for each item identified as item to count • Standard would help to extend the applicability of SLOC metric for software measuring (c) USC-CSSE
Outline • Introduction • Overview • Physical vs. Logical • Who needs SLOC • Existing SLOC definitions • Problems With SLOC Counting Practice • Limitations • Tool Mismatch • Counting Standard • What to count • How to count • Example • Conclusions (c) USC-CSSE
A SLOC Counting Standard • We are proposing the a counting standard which we have used and tested in our USC CodeCount™ research project over years • Two components: • What to count • How many to count (c) USC-CSSE
What to Count Checklist of What to Count (c) USC-CSSE
What to Count (cont) Checklist of What to Count (c) USC-CSSE
What to Count (cont) Checklist of What to Count (c) USC-CSSE
How many to count • Hard to define the beginning and end of a statement • Only executable and non-executable is not enough • So, we identify and group different statement types such as selection, iteration, jump, and expression (c) USC-CSSE
SLOC Counting Rules (c) USC-CSSE
SLOC Counting Rules (cont) Logical SLOC Counting Rules for C/C++, Java, and C# (c) USC-CSSE
SLOC Counting Rules (cont) Logical SLOC Counting Rules for C/C++, Java, and C# (c) USC-CSSE
SLOC Counting Rules (cont) Logical SLOC Counting Rules for C/C++, Java, and C# (c) USC-CSSE
Example of CodeCount Counting Standard (c) USC-CSSE
Conclusions • Current SLOC counting practice has inconsistency problem • Counting standard should focus on not only what but also on how many to count • A standard and consistent SLOC definition is necessary • Our proposed counting standard has applied in USC CodeCount™ (c) USC-CSSE
Q & A Thank you! (c) USC-CSSE