URL generation in my web app is in charge of the presentation layer. Now consider another module sending out messages containing URLs. (Not necessarily 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.
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.