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

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.

主站蜘蛛池模板: 华坪县| 黎平县| 元阳县| 黄浦区| 江阴市| 隆德县| 乃东县| 安平县| 淄博市| 五寨县| 台前县| 肇东市| 贵港市| 宝清县| 博白县| 鄯善县| 辉南县| 苍山县| 聂拉木县| 柘荣县| 德令哈市| 获嘉县| 玉溪市| 嘉兴市| 汉川市| 隆德县| 廊坊市| 东辽县| 庆元县| 花莲市| 井陉县| 斗六市| 九龙城区| 两当县| 西藏| 新余市| 广西| 蒙自县| 西华县| 阳原县| 得荣县|