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

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.

主站蜘蛛池模板: 邯郸市| 含山县| 广饶县| 南江县| 安乡县| 永定县| 六安市| 林口县| 石台县| 新建县| 滁州市| 梅河口市| 威海市| 克东县| 晴隆县| 白山市| 安西县| 耒阳市| 临江市| 休宁县| 威远县| 涪陵区| 治多县| 三江| 宽城| 古交市| 吉木萨尔县| 宁远县| 南陵县| 如东县| 乐东| 长武县| 天全县| 安丘市| 兴安县| 平凉市| 大石桥市| 南投县| 临清市| 富蕴县| 招远市|