Dependency Cycle

Detect Dependency Cycle

The easiest way to keep a code base clean is to avoid dependency cycles between its components. Components are useful to partition a huge amount of code into smaller and understandable pieces. If a dependency cycle involves N components, these N components represent a single super-component. Indeed, the benefits of having N smaller components are lost: any component can be potentially broken by a change in any of the others components, you cannot unit test a component in isolation from the N-1 other ones and finally, all N components must be versioned and deployed all together.

Whether you consider that your components are classes, namespaces, Projects or a mix in between, CppDepend detects dependency cycles between them. It can also help you to find the right way to get rid of a particular dependency cycle. Once dependency cycles have been removed, CppDepend can continuously check your code base to warn you as soon as a cycle is accidentally created.

White paper: Control component dependencies