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

Single responsibility per service

The single responsibility principle is one of the principles defined as part of the SOLID design pattern. It states that a unit should only have one responsibility.

Read more about the SOLID design pattern at http://c2.com/cgi/wiki?PrinciplesOfObjectOrientedDesign.

It implies that a unit, either a class, a function, or a service, should have only one responsibility. At no point do two units share one responsibility, or one unit perform more than one responsibility. A unit with more than one responsibility indicates tight coupling:

As shown in the preceding diagram, Customer, Product, and Order are different functions of an e-commerce application. Rather than building all of them into one application, it is better to have three different services, each responsible for exactly one business function, so that changes to one responsibility will not impair the others. In the preceding scenario, Customer, Product, and Order were treated as three independent microservices.

主站蜘蛛池模板: 仁布县| 元江| 临沧市| 天津市| 文水县| 芷江| 阿瓦提县| 勐海县| 烟台市| 宁德市| 靖宇县| 娱乐| 鄂伦春自治旗| 岐山县| 上蔡县| 博客| 岳阳县| 白朗县| 万安县| 嘉鱼县| 乌鲁木齐县| 陆丰市| 香河县| 仪征市| 襄樊市| 罗甸县| 南和县| 板桥市| 阿尔山市| 周口市| 都匀市| 和田市| 土默特左旗| 罗山县| 江西省| 保德县| 怀仁县| 洪洞县| 包头市| 西盟| 柞水县|