This is the 14th article on the System Design and Software Architecture series. In this article, we are discussing the Software Component Coupling.

Previous articles

What is a Software Component Coupling?

What is a Software Component Coupling_
What is a Software Component Coupling_

The connection of software engineering is different from that of coexistence in general. And it is a measure of how closely two components are connected. Low contact is often associated with high coexistence and vice versa. Low connectivity is usually a sign of a well-structured computer system and good design. Also, when combined with high symmetry, it supports the general purpose of high readability and maintenance.

Robert c. Martin has given three more principles for component coupling in software engineering.

Acyclic Dependency Principle (ADP):

Syndrome after Morning: Most of us have experienced this. Sometimes we work all day, get some stuff and then go home. The next morning when we checked that functionality again, we found that it was not active. Why is it not functional? Because someone stayed behind us later and changed something that depended on our activism! Uncle Bob called this ‘post morning syndrome.’

“Morning after Syndrome” takes place in a development environment where many developers modify files from the same source. In relatively small projects with several developers, it is not such a big issue. But as the size and development team of the project grows. Also, you can have a beautiful nightmare in the morning. It is not uncommon for the team to spend weeks trying to create a stable version of the project. Instead, everyone is constantly changing and changing their code and trying to make it work with changes made by someone else. There are two solutions to this problem:

The Weekly Build

The Weekly Build
The Weekly Build

It is common in medium-sized projects. It works, and all the developers ignore each other for the first four days of the week. They all work on individual copies of the code and do not worry about consolidating their work on a collective basis. Then on the fifth day, Friday, they all combine all their changes and build the system

Advantage: Allow four developers to live in a secluded world for four days

Disadvantage: Large consolidation penalty paid on Friday.

Elimination of the dependency cycle:

The solution to the problem of the “weekly build-up” case is to eliminate the dependency cycle. Make the development environment a release component. These components become a work unit that is the responsibility of an individual developer or a group of developers. When a component works for developers, they will release it for use by other developers. They give it a release number and move it to a directory that uses by other groups. They then continue to change their component in their personal areas. Everyone else uses the release version. Given the new release of the component, other groups can decide whether to adopt the new release immediately. If they decide not to, they simply use the old version. Once the team decides that they are ready to adopt the new changes, they start using the new release.

Advantages:

  • No group is at the mercy of others.
  • Changes made to one component do not necessarily have an immediate effect on the other groups.
  • Each release can decide when to adapt its own component to the new release.
  • Consolidation takes place in small increments.
  • It is widely used as a very simple and logical process. There are no “cycles” for this to work. If there are cycles in the dependent structure, we have to face the “morning after the syndrome.”

The Stable Dependencies Principle (SDP) :

The Stable Dependencies Principle (SDP) _
The Stable Dependencies Principle (SDP) _

In a single line, this principle is stated as “dependent on the direction of stability.” According to this principle, modules that are easy to modify do not rely on modules that are difficult to modify.

The design requires some instability to maintain it. Any component we expect to evaporate does not depend on a component that is difficult to modify. Otherwise, the volatile constituent will also be difficult to change.

Stability: Stability is defined as the amount of work required to make a difference. A component with a large number of dependencies is very stable because a large amount of work is required to reconcile any change with any dependency component.

Standing Summary Principle (SAP):

This principle states that “a component must need to abstract to make stable.” It is the relationship between stability and abstraction. A fixed component must abstract, and its stability does not prevent it from elongating.

Because of the instability of an unstable component, the concrete code inside it has the ability to easily modify. The fixed component must have an interface and an abstract class that can be extended.

Types of Coupling:

Types of Coupling
Types of Coupling

Data Connection:

If the interdependence of modules is based on the fact that they communicate only by communicating data. Then the modules are said to connect data. When connecting data, components are independent of each other and communicate through data. The module communication does not contain trump data. As an example: Consumer billing system.

Stamp Connection

When stamps are connected, the entire data structure is transferred from one module to another. So it involves Trump data. It is necessary due to efficiency factors – this choice is made by an intelligent designer. It is not a lazy programmer.

Connecting controls:

If modules communicate by providing control information, they are called controller connectors. Sometimes it will bad if the parameters show completely different behaviours. And it is better if the parameters are allowed to factorize and reactivate the functionality. Example: The classification function takes the comparative function as an argument.

External connection:

In an external connection, the module depends on other modules. Also, either external or specific hardware for the software being developed. External protocol, external file, device format, etc.

Public connection:

Modules share data such as global data structures. Global data change means going back to all the modules that access that data to assess the impact of change. It, therefore, has disadvantages, such as the difficulty of reusing the module and reducing the ability to control data access and maintaining maintenance capabilities.

Content Connection:

When connecting content, one module can modify data from one module to another. Or the control stream is transferred from one module to another. This is the worst form of contact and should be avoided.

Conclusion

Thanks for reading the article Software Components Coupling as an essential component in System design and architecture.

My articles on medium