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

Single responsibility

Every microservice should have responsibility over a single part of the functionality provided by the application, and that responsibility should be entirely encapsulated by the microservice. The design of the microservice should be narrowly aligned with that responsibility.

We could adopt Robert C. Martin's definition of the principle applied to OOP that said: "A class should have only one reason to change"; for this principle, we can say: a microservice should have only one reason to change.

If we realize that when we need to change a business function within our application, it modifies several microservices, or that a change cascades into non-related microservices, it is time that we reconsider how we design them.

This does not mean that we get to make microservices that do only one operation. Probably it is a good idea to have a microservice that handles the customer operations, like create, find, delete, but probably shouldn't handle operations like adding offers to a customer.

主站蜘蛛池模板: 南城县| 彭州市| 鸡西市| 都匀市| 抚远县| 庆云县| 长乐市| 驻马店市| 平果县| 昭觉县| 丰镇市| 额济纳旗| 乌审旗| 新兴县| 凉山| 元阳县| 泗水县| 赤城县| 宜良县| 永安市| 札达县| 天门市| 陕西省| 榆中县| 日照市| 凤庆县| 关岭| 平和县| 弋阳县| 遵义市| 华亭县| 时尚| 双流县| 晋宁县| 隆德县| 新河县| 永吉县| 新绛县| 滁州市| 余江县| 诸暨市|