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

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.

主站蜘蛛池模板: 东丽区| 高台县| 富裕县| 临邑县| 肥城市| 赤水市| 榆树市| 孟津县| 贵港市| 亚东县| 太仓市| 扎赉特旗| 左权县| 阿鲁科尔沁旗| 武穴市| 墨江| 普兰店市| 舞钢市| 漳州市| 北流市| 湘阴县| 个旧市| 贵港市| 古蔺县| 沂水县| 托里县| 青州市| 晋城| 大埔区| 望奎县| 宁津县| 图片| 东城区| 清远市| 化德县| 垦利县| 隆德县| 蕉岭县| 满城县| 灯塔市| 成都市|