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

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.

主站蜘蛛池模板: 太原市| 依兰县| 襄垣县| 公主岭市| 五华县| 渭源县| 巴中市| 全南县| 新绛县| 朝阳区| 仙居县| 丹棱县| 南充市| 土默特左旗| 务川| 太湖县| 阳江市| 特克斯县| 勃利县| 南岸区| 新田县| 郓城县| 时尚| 凌海市| 从化市| 新兴县| 永福县| 金寨县| 闽清县| 凌源市| 黎城县| 息烽县| 隆昌县| 南靖县| 双峰县| 克山县| 射洪县| 佛山市| 巫山县| 松溪县| 彩票|