Please enable JavaScript.
Coggle requires JavaScript to display documents.
Chapter 4: Measuring software size - Coggle Diagram
Chapter 4: Measuring software size
Size Measures
Usefulness for planning
All products require development effort, you will also need to plan the resources they require.
To be useful for planning, such measures of product size should reasonably well correlate with the hours you need to develop them.
The critical test is whether the required development effort is reasonably correlated with the size as measured.
LOC is the basic size measurement
Correlation is the degree to which two sets of data are related. The correlation value, r, varies from -1.0 to +1.0.
To be useful for estimating and planning purposes, the value of should be greater than 0.5.
With a small number of points, you can get a high correlation, but it is not very significant.
Precision
Deals with the granularity or level of detail in your measure.
Acurracy
Accuracy, however concerns the relation between an assertion and the actual fact.
There are many possible ways to define software LOC, the treatment of comments and blanks, the handling of reused code.
Automated counting
You need automated means to ensure it is accurately and economically counted.
Manually counting the instructions in even small programs is tedious, time consuming, and inaccurate.
A size measurement framework
Communication
What has been measured and what has been included and excluded?
Definition Name
The name you give the standard
Repeatability
Would someone else be able to repeat the measurement and get the same result?
Author
Your name
Date
The date you produced the standard
Count Type
Logical or physical LOC counts
Declarations
How to count them
Compiler Directives
You must decide if you count compiler directives
Comments
When comments appear on the same line with executable source code, you count the source code as if the them were not there.
Blank Lines
It is general industry practice not to count blank lines
Language
The programming language you are using
Establishing a counting standard
Count logical statements as, for example,every semicolon and selected keywords
Count all statements except blank lines and comment lines.
Count and record each language separately.
Count logical statements
Objectives
Obtain data that you can use to estimate the size of future programs.
Characterize the relative numbers of defects.
Calculate development productivity.
Omit blanks and comments
The decision to omit blanks and comments naturally follows from the decision to count logical statements.
Count and record each language separetely
Your development productivity could be quite different for each language
Counting anomalies
These counting practices can lead to some anomalies
Using LOC counts
Even though more LOC imply more function, this does not necessarily mean it is a better program.
Excess functions cost time and money and expose the program to unnecessary defects.
Too small a program could mean that the function provided was inconvenient or inadequate.
You want to use program size typically for
Packaging
The total packaging and shipping costs for widely distributed software products often exceed their development costs.
This is generally most closely related to physical product volume.
Evaluating development work
You are generally interested in relating the amount of product produced to the development effort expended
In making productivity evaluations, you are most concerned with counting the amount of source code to be produced.
Assesing program quality
You will typically want to reduce the defect counts
Help determine the quality of all or some part of your development process
Determine the relative defect content of some parts or versions of large programs
Judge the future maintenance and support workload for a program
Reuse considerations
Motivate engineers to reuse previously developed programs rather than developing them again
You can write new code or reuse code you obtain from elsewhere.
When you include many previously produced source lines in a new program, you need to decide how to count them
A more realistic concern is that counting only new and changed LOC does not properly motivate engineers to reuse existing code.
Reusing code that someone else has produced does take a good deal of work.
Line of code accounting
The reason for this is that a modified LOC must be counted as if it were a one-line deletion accompanied by a one-line addition.
Steps
Every version starts with some base number of LOC that are carried over from the prior version.
All the additions to this version are entered in the marked spaces in the Added column.
. All the subtractions are entered in the marked spaces in the Subtracted column.
Sum the amounts for each version in the Added and Subtracted columns.
Enter the added total minus the subtracted total in the Net Change column.
Add this net change to the version base to give the version total
Copy this version total under the Base column as the base for the next version.
Calculating productivity
When calculating productivity, you divide the amount of product produced by the hours you spent.
While you can select how you want to count LOC from among these or other options, you should consider the amount of work involved in each case.
Multiple regression and correlation can help you to arrive at appropriate productivity
For most new software development, added plus modified LOC is probably most appropriate for calculating productivity.
Line of code counters
Physical loc counters
You ignore comments and blank lines or count them separately.
Lines that have both comments and source code are counted as both code lines and comment lines.
Using coding standars and physical loc counter
Omit comments and blanks
You would write your source code to use a separate physical text line for every logical LOC.
When you count physical lines, omitting comments and blanks, you are also counting logical lines.
Logical loc counters
Logical LOC counters work much like physical counters except that line-counter stepping is more complex. First, you must establish a logical line-count standard.
Counting deletions and modifications
It is important for tracking of the added, deleted, and changed LOC in multiversion programs.
One approach is to flag each program line separately with a special com ment. A special LOC counter could then recognize these flags and count the added and deleted code.
You use a special program counter to compare each new program version with its immediate predecessor