官术网_书友最值得收藏!

Follow domain-driven design

Focus on the responsibility that the microservice is trying to meet. The scope of the service is more important than the lines of code used to build it. Teams would usually sit together and build an understanding of the domain from the domain experts. Once the domain is understood, then it is modeled as domain objects, which can be further grouped as sub-domains. In a monolith, the entire domain model is within a single application, but the microservice architecture would lead your domains to be used within different business contexts.

Bounded Contexts is a term used in DDD, which maps the domain entities within the context of its usage. A payment microservice might require a domain entity such as User, to be used for billing purposes, and thus the User entity may need to have payment details associated with it. But if the same domain entity is used in a notification service, then the payment information is an additional detail, which shouldn't get leaked into this service.

The idea of a bounded context is further explained in the section on Single Responsibility.

主站蜘蛛池模板: 额尔古纳市| 姜堰市| 麻城市| 彰武县| 宁化县| 黔南| 日喀则市| 寻乌县| 大荔县| 贵阳市| 金堂县| 芜湖市| 万荣县| 重庆市| 孙吴县| 白水县| 肃宁县| 朝阳市| 象山县| 岳西县| 阳西县| 蓬溪县| 云林县| 崇礼县| 霍山县| 吉安市| 沛县| 福鼎市| 资溪县| 新津县| 钟祥市| 雷州市| 龙海市| 正镶白旗| 深泽县| 酒泉市| 牙克石市| 民乐县| 安岳县| 启东市| 左贡县|