Home > Software Quality Tips > Software Project Management > Using SLOC to estimate software costs, schedules
Software Quality Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SOFTWARE PROJECT MANAGEMENT

Using SLOC to estimate software costs, schedules


Daniel D. Galorath
05.11.2007
Rating: -2.40- (out of 5)


Software quality news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


Poor cost and schedule estimates ruin projects more than technical, political or development team problems. But if you can determine the source lines of code (SLOC) in an application, you can better gauge the amount of time and effort needed to complete the project. Here's a look at three ways to measure SLOC and some of the risks and realities of SLOC.

SLOC realities and risks
"In extensive research of over 20,000 software development projects spanning 18 years, we found that more projects were doomed from poor cost and schedule estimates than they ever were from technical, political, or development team problems."

This is because the software project estimate, which is based on the size estimate, establishes funding constraints and a project plan that can limit the management, engineering, quality assurance, and reporting processes that can be used, the tools that can be applied, and the ability to engage in rework and risk resolution. Unrealistic estimates caused by analyst bias, customer or management pressure, or any other factor will increase the risks to the project. Spending time in software sizing and preparing the most viable range of software sizing that serves as a foundation for the cost estimate most likely can do more to reduce risk to a project than nearly any other factor including program requirements, architecture, quality factors, and other issues that affect the integrity of the process and the timely delivery of an acceptable product within projected budgets. The figure below illustrates that size drives estimates.

[IMAGE]

Using SLOC
SLOC can be used to measure either an existing program or a program yet to be built. Using SLOC to measure the size of an existing program is reasonably straightforward and involves little risk when appropriate counting rules are applied to a sound technical baseline. This straightforward process becomes more complicated if it is used to answer quest...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Software Project Management
How to stop developer vs. tester, quality-killing blame game
How to improve software project requirements estimates tutorial
Mobile, Web app QA testing tips for handling operating system changes
5 ways to answer executives' unfair software test, QA questions
Extending application lifecycle management to the enterprise
How project managers can recover from worst case scenarios
Developing the best IT project response strategy
How to handle IT project management in a recession
The value of a project manager: Why a PM is the CEO's best friend
The challenges of dispersed software development

Software quality management
VisibleThread aims to boost IT documentation quality, improve processes
Winning responses to "Why is QA always the bottleneck?"
Using virtual lab management tools to stop developer, QA conflicts
VMLogix LabManager adds support for vSphere 4, Hyper-V R2
Surgient 7's self-provisioning promises software testers quick IT resource access
Transitioning from AJAX to .NET what changes to expect in RIA's
The QA team's role in application performance evaluation and management
Adaptation in project management through agile
Budget-friendly Web app performance testing, monitoring tips
New requirements definition tools focus on chronic flaws

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


ions such as, "How big would the application have been if we had used a different language?" or "What savings in code would result if we modified the architecture?" Careful engineering analysis in concert with some rules provided in this chapter can help make these trade-offs possible.

Program size is the most obvious and perhaps the most fundamental measure of the amount of intellectual work needed for software development. Physical lines of code are among the easiest measurements to make; measurement simply involves counting the end-of-line markers. For example the number of SLOC in Microsoft Windows can be found by searching the Internet. However, without the definition of the SLOC, that information is nearly meaningless (unless the goal is merely to "'wow"' someone with big numbers). Thus, published information on software measures that depend on SLOC is difficult to interpret and compare with programs yet to be developed. Complicating the matter, many questions, such as those related to costs, schedules, progress, reuse, and productivity may be unanswered. One Software Engineering Institute (SEI) report says this about the measurement of source code size:

Historically, the primary problem with measures of source code size has not been in coming up with numbers — anyone can do that. Rather, it has been in identifying and communicating the attributes that describe exactly what those numbers represent.

Robert E. Park, formerly of the Software Engineering Institute, developed a framework (the SEI Checklist) for defining SLOC values to enable people to carefully explain and define the SLOC measure used in a project. Of the numerous types of SLOC measures, three stand out as most used: physical carriage returns, physical SLOC, and logical SLOC. They are defined below.

Physical Carriage Returns -- Includes a count only of physical line endings. Counting physical carriage returns has little value in estimation. Counting the comment lines does not provide significant correlation with effort. Comment lines do not involve any additional intellectual work beyond what is encompassed in the code. They simply exist for documentation purposes. Blank lines can vary by 2 or 3 to 1 based only on coding standards or personal preference on the number of blanks before and after each comment and the standard for the code preamble. It should be noted that ratios of comments to source lines may have value from a quality viewpoint. Additionally, from a size perspective, the ratio could be used to approximate a logical line count. In converting physical carriage returns to an approximate logical SLOC count, we have seen that ranges can vary from 20 to 70 percent (i.e., physical carriage returns X 20 percent = approximate logical SLOC). You can develop these ratios for your software by doing manual counts on several samples of code.

Physical SLOC -- Expresses the physical length of code, which is every single line of source code as seen by human eyes, excluding comments and blanks but counting each physical line ending of all other lines. A physical SLOC is most commonly defined as a count of nonblank, non-comment lines in a program's source code. The SEI technical report on software size measurement states that, "Counts of physical lines describe size in terms of the physical length of the code as it appears when printed for people to read."

This is among the easiest measurements to make because it involves counting the end-of-line markers rather than programming language-specific syntax. You need to specify only how you will recognize the statement types that you will not count, e.g., comments and blank lines. It is relatively easy to build automated counters for physical source line measures; however, measurement results can be more subject to variations in programming style than results using other measures. Later in this chapter, Table 5.3 details differences in line counting methods.

Logical SLOC -- Measures the number of logical programming "'statements"' that may or may not cross over more than one physical line. The ideal count examines the language syntax and counts the statement types (e.g., data declarations, math statements) explicitly. Many languages can be counted more quickly by counting terminators (e.g., C-like languages can be approximated by the number of line-terminating semicolons and closing curly braces). The rules for counting logical statements should specify how to recognize and count embedded statements for each source language to be used. Logical SLOC is less sensitive to formatting and style conventions than physical SLOC. According to the SEI technical report on software size measurement:

The count of logical statements is an attempt to characterize size in terms of number of software instructions, irrespective of the physical format in which they appear.

Logical source lines are the lines that carry programming instructions and data declarations, that is, the implementation of the software design represented by the actual instructions that convert to executable code and data. Therefore, counting logical lines is the best measure of software size. Much of the historical data that has been used to construct cost models for project estimating is based on logical measures of source code size.

This article was originally printed in the book Software Sizing, Estimation, and Risk Management. It is being reprinted with permission of Auerbach Publications, Taylor & Francis Group.

----------------------------------------
About the author: Dan Galorath is president of Galorath Inc.


Rate this Tip
To rate tips, you must be a member of SearchSoftwareQuality.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Software Design & Testing - Project Management
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2006 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts