Data Coupling and Control Coupling

data coupling and control coupling

In this article, we will discuss about Data coupling and Control Coupling. First of all, Let’s see the definition of Data Coupling and Control Coupling. The definitions of Data coupling and Control Coupling can be found in the Glossary section of Annex B of DO-178C document.

What is Coupling?

In general, coupling indicates the relationship or dependency among software modules. Software modules can communicate with each other by using parameter passing method, by using global variables or by referencing the internal content of another module.

A highly coupled software program indicates that the software modules are heavily dependent on each other. Whereas, a loosely coupled software indicates less dependency.

Highly coupled software programs are considered to be complex for change management. You may have to change a lot of inter-dependent modules to apply a simple change. So, change management is difficult for tightly coupled software.

Data Coupling and Control Coupling

Loosely coupled software indicates more number of independent software modules. This kind of software is considered to be well partitioned and easy for change management. For a simple change, you may just have to update an independent software module. Therefore, the best quality software should contain loosely coupled software modules.

Types of Coupling

In the software engineering, there are six different types of coupling are present:

  1. Content Coupling: One module affects another module
  2. Common Coupling: Two modules share global variables/data
  3. External Coupling: Modules communicates via external databases
  4. Control Coupling: One module passes control data to dictate the execution of another module
  5. Stamp Coupling: Two modules shares same data structure
  6. Data Coupling: Two modules communicate each other by passing data/parameters

Data Coupling Definition (as per DO-178C):

The dependence of a software component on data not exclusively 
under the control of that software component.

Control Coupling Definition (as per DO-178C):

The manner or degree by which one software component influences 
the execution of another software component.

The component is defined as:

A self contained part, combination of parts, subassemblies, or 
units that perform a distinct function of a system.

Goal of Data Coupling and Control Coupling

The main goal of Data coupling and control coupling is to ensure that the connectivity between the software modules is correct and complete. The best quality software always need to have minimum coupling.

Why Data Coupling and Control Coupling?

As per the DO-178C document, there are certain objectives that need to be satisfied regarding data coupling and control coupling. Table A-7 (Verification of Verification Process results) defines the following objective:

Test coverage of software structure, both data coupling 
and control coupling, is achieved.

The purpose of this objective is to ensure that the DO-178C compliant software modules interact each other correctly.

Data Coupling

We have seen the data coupling definition and the reason for exercising the data coupling in the context of DO-178C. Now, let’s understand it a better way. Data coupling involves all global variables and the local variables.

In the case of data coupling, two software modules interact with each other by exchanging or passing data or parameters. The dependency between software modules A and B is said to be data coupled if the dependency/relationship is based on the fact that they communicate by only passing the data.

Now consider the following code snippet:

int i;

int foo(int i)
{
	i = i + 30;
	return i;
}
int baar(int j, int i)
{
	j = j + i;
	return j;
}
int main()
{
	int j=100, offset=10;
	j = j + offset;

	foo(i);
	baar(j,i);

	return 0;
}


In the above example code, there are two user-defined functions – foo() and baar(). Both the functions are sharing global data and local data by passing parameters. Therefore, we can say that these functions [ foo() and baar() ] are data coupled.

Control Coupling

The control coupling is another form of coupling where one software module passes data to another module to control the flow execution. Niw, consider the following code snippet:

void display_ac_status(int air_speed)
{
	if(air_speed < 50)
	{
		printf("Aircraft is on ground");
	}
	else
	{
		printf("Aircraft is in-Air");
	}
}

int main()
{
	int air_speed=100;

	display_ac_status(air_speed);
	
	return 0;
}

As you can clearly see in the above example, display_ac_status() function is called from main() function with “air_speed” as the parameter. The parameter “air_speed” is passed to the display_ac_status() function to determine which path to execute based on the value of the air_speed. The control flow execution inside the display_ac_status() function will be decided by the value of air_speed. If the air_speed is less than 50, then if the condition will execute and the corresponding print statement will execute, otherwise the else part will be executed.

Therefore, the flow of the execution of the display_ac_status() function is controlled by the air_speed parameter. This is called control coupling.

Data Coupling Checklist

I have compiled a detailed data coupling checklist that you can use during data coupling analysis.

Please comment below to get the FREE copy of the Checklist.

Control Coupling Checklist

I have compiled a detailed checklist for control coupling that you can use during the control coupling analysis.

Please comment below to get the FREE copy of the Checklist. I will email you the checklist copy.

Conclusion:

In this article, I have tried to explain the data coupling and control coupling with simple examples. This is one of the poorly understood concept in the aviation software in the context of DO-178C.

Hopefully, this article could help you!

Cheers!

Data Coupling and Control Coupling

3 thoughts on “Data Coupling and Control Coupling

  1. Data provided was useful to understand the concept but more elaborate explanation could help an engineer to perform the DCCC analysis for a software project

      1. Hi Admin,

        Can we get the procedure of doing Data Coupling and Control Coupling Coverage for Do-178b?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top
error: