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

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.

主站蜘蛛池模板: 陵水| 盐亭县| 佛坪县| 韶山市| 永昌县| 海原县| 普兰店市| 株洲县| 德格县| 昌吉市| 晋中市| 利川市| 博客| 青田县| 蒙自县| 武乡县| 抚松县| 永新县| 新宁县| 内黄县| 新安县| 冷水江市| 若尔盖县| 铜梁县| 广宁县| 沭阳县| 扬中市| 芜湖市| 于都县| 和龙市| 司法| 寿阳县| 城口县| 同江市| 深州市| 南木林县| 库车县| 留坝县| 秭归县| 大丰市| 辉南县|