Oliver Salzburg
Oliver Salzburg

Reputation: 22099

How can I detect incomplete module dependencies?

We have an application that has grown over the years and was originally designed pretty monolithically. In the recent months, we have broken the application into smaller modules, which made it a lot more maintainable.

However, the main module in our code still declares dependencies to pretty much any other module that is used anywhere in our codebase. This is ridiculous, because the main module doesn't actually have those dependencies, the modules we pulled out of it do.

The application still runs fine though, since every module is dependent upon somewhere and thus it is loaded and available.

When we now pull out a module into another codebase, it usually doesn't work, because the dependencies aren't correct (as those were declared on the core module in the original application).

How would I determine if an individual module correctly declared all of its dependencies?

Upvotes: 0

Views: 99

Answers (1)

Henning
Henning

Reputation: 26

How about writing a unit test with mocks for the injected dependencies. Calls to non mocked objects should trigger a failure.

Upvotes: 1

Related Questions