Friday, March 16, 2018

27. Software Metrics Lesson to be done on 18th March

A high quality process (input) that can result in a high quality product (output)
Software Metric produces a numeric value or profile for an
attribute of a software component, system, or process
examples :
  •   Size of a product in lines of code
  • the Fog index (Gunning, 1962), which is a measure of the readability of a passage of written text
  • the number of reported faults in a delivered software product
  • number of person-days required to develop a system component
Purpose of having a Metric
Metrics facilitate prediction, costing, and management decision-making on the process, and expected products.
By comparing the values produced in measurement they can compare  to the standards that apply across an organization, you may be able to draw conclusions about the quality of software, or assess the effectiveness of software processes, tools, and methods
produce an example of using a metric in a project:
example, say an organization intends to introduce a new software-testing tool. Before introducing the tool, you record the number of software defects discovered in a given time. This is a baseline for assessing the effectiveness of the tool. After using the tool for some time, you repeat this process. If more defects have been found in
the same amount of time, after the tool has been introduced, then you may decide that it provides useful support for the software validation process
Software Metrics – 2 Types
  1. control metrics (aka Process Metrics) - support process management 
    eg : average effort and the time required to repair reported defects
  2. predictor metrics ( aka Product Metrics)- help you predict characteristics of the software 
    eg : cyclomatic complexity of a module ,
    average length of identifiers in a program,
    number of attributes and operations associated with object classes in a design
image
How Metrics are use din each SDLC stage
  • requirements analysis and specification
metrics can help to highlight critical aspects of the expected product, its quality and subsequent maintenance, based on available process and resource inputs. For example, a simple function point analysis may highlight the scale of the development and likelihood of delivery within timescale such that the stakeholders are asked to revisit the requirements, re scope and cost the system;
  • design phase
process metrics can highlight complexity, productivity, and engineering build quality. For example, the McCabe complexity metric as an indicator of complexity can result in design decisions about the process of decomposition, and subsequent testing and maintenance processes.
  • implementation and testing phase
metrics can verify and predict operational performance, configuration and maintenance requirements. For example, a metric for testing in terms of defects identified per 100 modules inspected, may cause
stakeholders to release the product early, in the sure knowledge of the number and timing of patches that would follow in terms of maintenance.
  • maintenance phase
process metrics are concerned with change, their frequency, the sub-systems affected, and the predicted cost and expected system lifetime. Process metrics such as these can lead to decisions to delay certain requests, or system decommissioning.
Directly Measurable Quality attributes
Depth of Inheritance Tree
Cyclomatic Complexity
No of Errors/ error messages 
Program size in No of Lines of Code
Length of user manual
Indirectly Measurable Quality attributes
Maintainability , Reliability ,Reusability , Usability
but  there many be relationships between external and internal attributes, so we can indirectly measure them
image
Now lets talk about few product metrics
Product metrics have 2 classes
1. Dynamic metrics, which are collected by measurements made of a program in execution. Dynamic metrics help to assess the efficiency and reliability of a program
eg : number of bug reports or the time taken to complete a computation
2. Static metrics, which are collected by measurements made of representations of the system, such as the design, program, or documentation.  Static metrics help assess the complexity, understandability, and maintainability of a software system
eg : code size and the average length of identifiers used
Some descriptions of Static Metrics
image
*** Cyclomatic complexity is a software metric, used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code.Lower the Program's cyclomatic complexity, lower the risk to modify and easier to understand
lets do a simple calculation of Cyclomatic Complexity
Cyclomatic complexity = E - N + 2*P 
where,
  E = number of edges in the flow graph.
  N = number of nodes in the flow graph.
  P = number of nodes that have exit points
image
The Cyclomatic complexity is calculated using the above control flow diagram that shows 
seven nodes(shapes) and 
eight edges (lines),
One exit point 
 hence the cyclomatic complexity is 8 - 7 + 2 = 3
image

questions to try : 

March 2017 A1 

a) Write a brief overview of the various forms of software process metrics 
available today, and discuss how they might be usefully employed from the 
initial project stages, through to the commissioning of a new system. 
Illustrate your answers with examples.

c) Consider the following software attributes: Maintainability, Cyclomatic complexity, 
Lines of Code count (LOC), Reliability, Number of errors.
Which of these attributes can be measured directly and which indirectly? 
Justify your answers.


1 comment: