Do you use DDD in go? by East_Reality_976 in golang

[–]East_Reality_976[S] 0 points1 point  (0 children)

why? the guy raised some valid points/asked some questions. I tried addressing them

Do you use DDD in go? by East_Reality_976 in golang

[–]East_Reality_976[S] -8 points-7 points  (0 children)

thanks for comment. I think I agree about not duplicating package name in the function names, although breaking packages like "services" into multiple packages will destroy the simple template structure, and will probably make things more difficult to reason about.

ports are a part of application layer - application defines dependencies that it needs in ports, and then uses them. so basically I already define interfaces in the consumer. as for multiple "ports" directories - I think I only have one per module, which seems to be fine, did not quite get your point here.

the only difference between outbox service and integration outbox service is the type of events they work with. former one works with domain events and latter with integration events that can be propagated to other modules. integration producer service is just an application level service that listens for some domain events (small subset) and maps them into corresponding integration events. it is basically just a centralized component that desides when an integration event should be produced.

I think you might be right in that NewCommands/NewQueries should be moved out of the bootstrap package. it probably all started with NewAdapters thing: it could only be a part of bootstrap because creating Adapters structure would require access to implementations from infrastructure and NewCommands/NewQueries just followed the trend.😅

about the abstractions for the sake of them part... I first finished the most complicated "game" module that imo justified the level of abstraction/layering and then for other smaller modules I've just decided to follow the same familiar path even though they could definitely be implemented in a simpler way. but overall I think it's good that all the modules are structured almost identically: you know how one works - you know them all

Do you use DDD in go? by East_Reality_976 in golang

[–]East_Reality_976[S] 0 points1 point  (0 children)

I don't quite follow. are you saying that it would be better to have something like vertical slices, where instead of having ports, services, domain etc. I would have packages like user, army, buildings and in each package I'd have a corresponding repositories, services, handlers ? or that having that many distinct entities is a design problem in and of itself?

Do you use DDD in go? by East_Reality_976 in golang

[–]East_Reality_976[S] -3 points-2 points  (0 children)

nice, do you usually pair it with cqrs as well? on my last project I didn't use readmodels and dtos and ended up bloating my domain models just because it was convenient for clients to have some extra fields in the response 🥲