Question

URL generation in my web app is in charge of the presentation layer. Now consider another module sending out messages containing URLs. (Not neccessarily triggered from presentation). However, the presentation layer has to know about the module (since it might be the trigger, and the user can configure the module using the frontend).

I.e. the modules are dependent of each other... any ideas how this cyclic dependency could be avoided?

Storing URLs in my database does not seem right to me, same goes for merging the two modules.

Any help or inspiration is be very much appreciated. Thx.

Was it helpful?

Solution

Wouldn't using an interface help here? How about specifying and "consuming" an UrlGenerator interface in your backend module and implementing it in your presentation layer?

In combination with some sort of dependency injection mechanism (Factory pattern for construction of UrlGenerator clients, frameworks like Spring or Guice, Service Locator pattern), this will break the cyclic compile-time dependencies.

OTHER TIPS

Create a third module which both modules know, but they don't know each other?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top