kgrzybek / modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.
MIT License
11.15k stars 1.75k forks source link

Add Directory.Packages.props #291

Closed Xeinaemm closed 11 months ago

Xeinaemm commented 11 months ago

Changes:

This PR closes MSBuild changes, there are no hardcoded values and it fully works based on patterns. For example, by adding a new module it will automatically set all necessary dependencies for the new module and also add it to API. IntegrationEvents works similarly, it will automatically add new project events to other modules' applications.

The only manual thing to do is to add a new module and include all the projects in the solution, but this can be fixed by creating a module template via .NET Templates.

kgrzybek commented 11 months ago

Hi @Xeinaemm

First of all - thanks for changes!

  1. Using Directory.Packages.props it is great thing but this is a tradeoff - we lose modules autonomy and modularization. This way you cannot upgrade package only in one module without changing other modules (override). I mean sometimes it is not a problem, but with larger projects with multiple teams working on the same monolith could be a problem. I accept this change but I will write ADR or some info in README about this considerations.

  2. Autoreferencing libraries based on convention is good, but there is one exception. Before the change we exactly know which integration events were used by which module. This was important. After the change all modules reference all integration events and this is not good (for instance UsersModule referenced only Meetings.IntegrationEvents, now it references all IntegrationEvents from all modules. So imo we should not do it for integration events and keep them as before (explicit reference).

Xeinaemm commented 11 months ago

Using Directory.Packages.props it is great thing but this is a tradeoff - we lose modules autonomy and modularization.

It's true with CPM enabled, but I avoided this feature in this case. I managed 150+ shared libraries and 120+ services which were put into 32 products similar to this template. I made this in a way that you can always add your libraries and override them freely in any project. Only downgrading defined dependencies isn't allowed. The goal of Directory.Packages.props should be a source of truth, it's easier for me as a maintainer to look at one place and update a dozen products at once. In the end, you have a finite number of dependencies, even after 20 years of development.

I can help you with ADR, but in this case, I didn't want to change behaviors, only places. I have for sure some objections to some dependencies or references but I need to put it in words.

So imo we should not do it for integration events and keep them as before (explicit reference).

Ok

kgrzybek commented 11 months ago

@Xeinaemm good job!