Modular Monolith Architecture: The Missing Guide to Public APIs

  Рет қаралды 8,121

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 33
@nthonymiller
@nthonymiller 10 күн бұрын
Great video, exactly how I handled separated modules in my modular monolith
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
Nice!
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt Get the source code here: www.patreon.com/milanjovanovic
@PippiTheLongSock
@PippiTheLongSock 9 күн бұрын
I feel like with the current implementation, where you call the IOrderService in the shipping consumer, you are introducing a degree of coupling which can potentially cause problems when (if) you decide the extract any of the two modules into a separate application (process). In that case, you will need to implement some sort of blocking out of process communication and this would mean that the shipping module (microservice) will always require the orders to be up and running. Of course, this might be a balanced well worth tradeoff, but still it is good to keep the potential pitfalls in mind. You can also continue evolving the current demo project in future videos by removing the direct call to the orders module. Anyway, just my 2 cents, great video as always, though!
@MilanJovanovicTech
@MilanJovanovicTech 9 күн бұрын
It's a good remark. Let me do exactly that in the next video and discuss the tradeoffs!
@baranacikgoz
@baranacikgoz 9 күн бұрын
I prefer using Masstransit Request Response pattern (which I saw it thanks to you) for this. Introducing a shared service interface defeat the purpose of decoupling imo. As always, thanks for the video
@MilanJovanovicTech
@MilanJovanovicTech 9 күн бұрын
It's good to have options!
@chanep1
@chanep1 7 күн бұрын
Nice replacement of multi assemblies with Architecture.Tests
@MilanJovanovicTech
@MilanJovanovicTech 7 күн бұрын
Yes, it's an interesting alternative. I haven't explored all the possible options
@mreshboboyev
@mreshboboyev 10 күн бұрын
This video is great, thank you! Can you show this in a diagram, using shapes?
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
Check this out: www.milanjovanovic.tech/blog/internal-vs-public-apis-in-modular-monoliths
@jackpioneer3566
@jackpioneer3566 10 күн бұрын
Great video as always! I noticed that in your recent videos, you are using the DbContext directly without the repository and unit-of-work patterns. Is this for simplicity, or do you think these are unnecessary abstractions?
@vinydanylo
@vinydanylo 10 күн бұрын
The DbContext already implements the unit of work pattern (SaveChangesAsync method) and the repository pattern (DbSet properties)
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
Both, kind of
@moeelhariri8041
@moeelhariri8041 10 күн бұрын
Hey Milan, did you intentionally suffix IOrderService with “Service”? Do you think IOrderShippingInfoQuery would be a more explicit name, or would you reserve “Query” and ”Command” suffixes for endpoint request contract types only, representing entry points into the system?
10 күн бұрын
imo, it´s way more convenient to expose the module public api as a facade than multiple separate querys/commands)
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
Either is fine, I just didn't want to go so granular with specific names
@fredik27
@fredik27 7 күн бұрын
Hey Milan, when i try to write my modularity test, i get: 'Program' is inaccessible due to its protection level when i try to load the program assembly: private static readonly Architecture Architecture = new ArchLoader() .LoadAssemblies(typeof(Program).Assembly) .Build(); Visual studio keeps suggesting that i use 'using Microsoft.VisualStudio.TestPlatform.TestHost;' but that seems strange to me. I really cant see what i am doing differently?
@MilanJovanovicTech
@MilanJovanovicTech 7 күн бұрын
Make a partial class
@mastersiper
@mastersiper 9 күн бұрын
Can you please make a video about modular monoliths with an message based API layer.
@MilanJovanovicTech
@MilanJovanovicTech 9 күн бұрын
Yes
@mastersiper
@mastersiper 9 күн бұрын
@ I'm looking forward to it!
@thedacian123
@thedacian123 9 күн бұрын
Woukd have not been a good architecture that the modules communicate via SB using MediatorR or channels?
@MilanJovanovicTech
@MilanJovanovicTech 8 күн бұрын
Same level of coupling, technically
@mahmudsulemansheikhwunnam3580
@mahmudsulemansheikhwunnam3580 10 күн бұрын
Please what drives this kind of structure. As a person who just started using .net my first thought would have been to use areas for each module/component.
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
There are many reasons, but it mostly depends on the complexity and scalability of your application. Check out this: www.milanjovanovic.tech/blog/internal-vs-public-apis-in-modular-monoliths
@iliyan-kulishev
@iliyan-kulishev 10 күн бұрын
How I do it, given the fact that I do CQRS, is to have every module in different assembly. But they don't refer to each other via interface, just via public service classes. And the commands, queries and responses are public and used in the services classes for input and output. I see no value of "hiding" the fact that I'm doing CQRS in every module. What do you think about this ?
@MilanJovanovicTech
@MilanJovanovicTech 10 күн бұрын
You're not really hiding the fact within the module - you'd be hiding it from other modules.
@iliyan-kulishev
@iliyan-kulishev 10 күн бұрын
@MilanJovanovicTech And I am not doing that. Why is that wrong in your opinion ?
@MilanJovanovicTech
@MilanJovanovicTech 9 күн бұрын
@ I was just referring to public-internal and what's visible to others. If other modules can see public members (commands/queries) of your module, what prevents them from using it?
@iliyan-kulishev
@iliyan-kulishev 9 күн бұрын
@@MilanJovanovicTech Nothing prevents them. If they use the mediator directly with them, I wouldn't mind either. The handlers are internal though. I like having the commands/queries public, so there's no double work with typing parameter lists in the public services. Another reason is that any client can decorate the handlers of their choice - all or for particular command/query. My weird way :)
@vincentcifello4435
@vincentcifello4435 7 күн бұрын
This misses the forest for the trees. All you have done is sweep the coupling under the rug. The real coupling here is the fact that the OrderService is storing and managing the shipping address. This forces the “Shipping Service”, whatever that is, to depend on the Order Service to do its job. Everything else is just indirection to hide this problem. There is simply no reason whatsoever that the shipping address can’t be stored and managed by its proper owner- the Shipping Service.
@MilanJovanovicTech
@MilanJovanovicTech 7 күн бұрын
Data ownership is a separate topic here (to be discussed). The communication here could've been async also, ending up with a copy of the shipping address in the shipping module. Recall that we're dealing with a monolith in this example, not separate services.
The CORRECT Way to Handle Value Objects in EF Core
12:35
Milan Jovanović
Рет қаралды 12 М.
The Right Way To Build Async APIs in ASP.NET Core
20:12
Milan Jovanović
Рет қаралды 28 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Swagger is Gone in .NET 9! Replace It With This.
9:34
Nick Chapsas
Рет қаралды 98 М.
Why is every React site so slow?
13:52
Theo - t3․gg
Рет қаралды 153 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 276 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 42 М.
Event Sourcing for .NET Developers: From Zero to Implementation
19:55
Milan Jovanović
Рет қаралды 13 М.
Stop Using Docker. Use Open Source Instead
12:40
DevOps Toolbox
Рет қаралды 324 М.
Your REST API Errors Are Wrong. Problem Details Will Fix This
16:14
Milan Jovanović
Рет қаралды 14 М.
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 293 М.
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН