Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What are Information Flow Metrics?
3.
Terminologies used in IF Metrics
4.
Information Flow Model
5.
Steps to derive the most simple IF Metrics.
5.1.
Conclusion
6.
FAQs
7.
Key Takeaways
Last Updated: Mar 27, 2024

Information Flow Metrics

Author Rushali Patnaik
2 upvotes

Introduction

Day by day, as computer systems become more interlinked with human life aspects, the promotion of software failures rises, thereby enhancing the need for software assurance research and practice. A software metric is a measure of software characteristics that are calculable or countable. Software metrics are essential for many reasons, including measuring software performance, planning work items, measuring productivity, and many other uses. Software assurance activities have identified numerous software bugs before the systems are implemented.

What are Information Flow Metrics?

Information Flow metrics is the set of metrics that measure the complexity of code by calculating the passage of information among system components or modules. These metrics are also known as Henry and Kafura's Metric as they are given by Henry and Kafura. These metrics are based on the concept:  the simplest systems consist of components. The work done by these components and how they are fitted together identify the system's complexity. 

Information flow and data processes are essential for promoting the collective processes in the code. Information flow measure also assists scientific exchanges, which are highly relevant areas for research in any system that seems much more reliable.

Terminologies used in IF Metrics

  1. Component:  The parts or constituents of a decomposed (software) system are called components.
  2. Cohesion:  A measure of the degree to which a component performs a single function is called cohesion. If a component does numerous discrete tasks, it lacks cohesion.
  3. Coupling: The degree of linkage between one component to others in the same system is called coupling.  A highly coupled component is linked to many components, whereas a slightly coupled component is linked to only a few. 
     

Also read  V Model in Software Engineering

Information Flow Model

Information Flow metrics measure the information flowing among modules of the system. It is responsive to the complexity due to interconnection among system components. This measure also includes the complexity of a software module, which is the sum of all the complexities of the methods present in the module. A procedure contributes complexity due to the following two factors.

  1. The complexity of the process code itself.
  2. The complexity due to the process's linkage to other processes. The effect of the first case has been included through the LOC (Line Of Code) measure. For estimating the second case, Henry and Kafura have described two terminologies: FAN IN and FAN OUT.
     

FAN-IN: FAN-IN of a component is a count of the number of other components that can call or pass information to that component. 

FAN -OUT: FAN-OUT of a component is the number of components that are called by or receive information from that component.

The figure given below shows a fragment of a system design having component 'A,' for which we can define three measures:

  1. ‘FAN-IN’ is a count of the number of other components calling or passing control to A.
  2. ‘FAN-OUT’ is the number of components called by A.

                          Figure: Aspects of complexity

 3. The information flow index of component A, abbreviated as IF(A), is derived from the first two components by using the following formula- 

 IF(A) = [ FAN-IN(A) * FAN-OUT(A) ]

Steps to derive the most simple IF Metrics.

  1. First, note each component's level in the system model.
  2. Calculate the number of calls, i.e., FAN-IN of each component. Components at the top-most level should have a FAN-IN of zero. More than one component in the design is allowed to be at the top-most level in some organisations, so for them, FAN-IN of one is taken. Also, a simple model of FAN-IN can penalise reused components.
  3. For each component, count the number of calls from the component. For a component that calls no other, assign a FAN OUT value of one. 
  4. Evaluate the IF value for each component using the above formula.
  5. Add the IF value for all components within each level. This is called the level sum.
  6.  Add the IF values for the total system design. This is called the system sum.
  7. Rank the component according to FAN IN, FAN OUT, and IF values for each level. Prepare three histograms or lines for each level. 
  8. The level sum values for each level should be plotted using a histogram or line plot.

Conclusion

  • Components having a lack of cohesion and high linkage (highly coupled) are less reliable and difficult to maintain.
  • High FAN-IN values of a component indicate that they lack cohesion. It also suggests that the functions are not broken down to a significant enough degree. These components are often called because they are doing more than one job.
  • High levels of FAN-OUT also indicate a lack of cohesion or missed levels of abstraction. Generally, FAN-OUT appears to be a better indicator of problem modules than FAN-IN. 
  • High IF values indicate highly coupled components.

FAQs

  1. Consider the following system. Calculate FAN-IN and FAN-OUT of A, and what do they indicate?


    FAN-IN(A) = 3, FAN-OUT(A) = 2
    1. High FAN-IN indicates this module has been used heavily. This shows the reusability of modules and thus reduces redundancy in the coding.  
    2. High FAN-OUT indicates a highly coupled module, thus more dependency on other modules.
     
  2. How do FAN-IN and FAN-OUT of a module affect the design structure?
    Higher FAN-IN means heavy use of that module, i.e., the module's reusability and better design structure. In contrast, high FAN-OUT means highly coupled,i.e., more dependent on others, showing poor design structure and high maintainability cost.
     
  3. Define the terms cohesion and coupling.
    Cohesion:  A measure of the degree to which a component performs a single function is called cohesion.
    Coupling: The degree of linkage between one component to others in the same system is called coupling.

Key Takeaways

In this article, we have extensively discussed Information Flow Metrics, terminologies associated with them and their implementation, and some questions related to this topic. We hope that this blog has helped you enhance your knowledge and if you wish to learn more, check out our Coding Ninjas Blog site and visit our Library. Do upvote our blog to help other ninjas grow.
Check out this problem - Largest Rectangle in Histogram

Happy Learning! 

Live masterclass