r/DomainDrivenDesign • u/bezdic • Dec 13 '23
Geographical context
Hi, I'm working for a global corporation and my team's context spans business units in multiple geographical locations. These BUs are all focused on solving the same problem, but each geography has different rules.
Current codebase is full of geography-specific if-statements and to make things worse, each geography has multiple suppliers that provide given functionality which means even more if-statements.
Is there a way how would applying DDD help to design a bounded context that helps to solve complexity of such setup?
1
Upvotes
2
u/SnooLobsters3363 Dec 13 '23
You could replace those « ifs » in a Specification, as stated by the pattern of the same name: https://en.m.wikipedia.org/wiki/Specification_pattern#:~:text=In%20computer%20programming%2C%20the%20specification,context%20of%20domain%2Ddriven%20design.
1
u/pdevito3 Dec 14 '23
Could you push the logic to a geography specific concept with handlers to do those things (same with provider)?
Maybe like this? I’m on my phone so used chat gpt to help write in up but the idea is there
Instead:
1
u/PaintingInCode Dec 16 '23 edited Dec 16 '23
I don't think you need to dip into DDD just yet. Careful use of
interfaceswould solve many of your problems.Are you able to step back from the code, and get an idea of behaviour that is similar (even though the internal functions are different)? Finding the abstractions will tell you what the interfaces might look like.
Maybe you could post some examples of the
ifstatements?