DDD. Shared kernel? Or pure event-driven microservices?

Cokorda Raka picture Cokorda Raka · Mar 2, 2017 · Viewed 10k times · Source

I'm breaking my system into (at least) two bounded-contexts: study-design and survey-planning.

There's a concept named "subject" (potential subject for interviewing) in the study-design context. We also maintain associations between subjects and populations in that domain.

Now, in the survey-planning, we also need (some) information about the subject (for example: for planning a visit, or even for anticipated selection of questionnaire, in case the population the subject belongs to is known beforehand).

So, I need that "subject" in both contexts.

What approach should I pick? Having a shared kernel, as explained in Eric Evans DDD book? I don't mind (at least for now) having the two contexts sharing the same database.

enter image description here

Or... should I go pure microservice? Meaning: those two can't / shouldn't share database..., and in that case I might have to go the mirroring / duplicating route through event passing: https://www.infoq.com/news/2014/11/sharing-data-bounded-contexts

Any thoughts on which one is better, for the above situation?

Thanks!

Answer

Sergiy Chernets picture Sergiy Chernets · Mar 3, 2017

The context for microservices is distributed systems. In any other situation it would probably be overkill. Shared kernel will eventually split. That is usually the case. You may start from it. Nothing wrong with that. However, it will not stay there.