Thursday, 6 July 2017

How to remove circular dependency - design

 Overview of issue

We have two software components A and B. A sub module of component A has a dependecy from a submodule of B and another submodule of B has another dependency from a submodule of A. The following diagram illustrates a scenario just described:
In this scenario, do you compile A before B? or B before A? It is as the paradox about the "chicken or egg".

Possible solutions

The following possible solutions resolve the issue about circular dependecy.


  1. Move the submodule 2 of Component A in B. In this cas you can build the component B without dipendency from A and then you build the component A. Probably the migration of submodule 2 into the component B is not valid solution from the point of view of Functional Analisys.
  2. Change the build strategy without impact on component structure. Almost always the granularity of building is per component, but you change the granularity per submodule, you can build the submodules with this order: submodule 2 of A, submodule Y of B, submodule X of B and at last submodule 1 of A. Changes of build strategy can may have big impacts especially for large projects not in the initial stages.
  3. Split the component A in two components. The figure below illustrates this solution. 
  4.  
The component A is splitted in A and C (new componet). The component C contains just the submodule 2 that caused the circular dependecy.  The strengths of this solution are: 
    • You don't have to change the current build strategy. Indeed the sequence build for components is: C, B and A.
    • The split of a component refers only technical point of view and not of functional.

    No comments:

    Post a Comment

    Welcome

    Hello everybody, Welcome in my blog called "Information technology archive". Obviously the topics will be related to Informatio...