{"id":298752,"date":"2020-02-16T15:00:09","date_gmt":"2020-02-16T15:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=298752"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-02-16T15:00:09","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=298752","title":{"rendered":"\u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438: \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/465507\/\">\u041f\u0440\u043e <b>\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b> (The Single Responsibility Principle, SRP) \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0434\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%B8%D0%BD%D1%86%D0%B8%D0%BF_%D0%B5%D0%B4%D0%B8%D0%BD%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%B9_%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D1%81%D1%82%D0%B8\" rel=\"nofollow\">\u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/a>. \u0410 \u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 SRP \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e \u0432\u0441\u043a\u043e\u043b\u044c\u0437\u044c, \u043d\u0435 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u043d\u0430 \u043d\u0438\u0445 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043d\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044f \u0442\u0435\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0434\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<a name=\"habracut\"><\/a><\/p>\n<h2>\u0423\u0440\u043e\u0432\u0435\u043d\u044c 0<\/h2>\n<p>  \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e, \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u2014 \u0414\u044f\u0434\u044f \u0411\u043e\u0431, \u0434\u0430\u043b \u0435\u043c\u0443 \u0442\u0430\u043a\u0443\u044e \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0443:  <\/p>\n<blockquote><p><i>A class should have one, and only one, reason to change.<\/i><\/p><\/blockquote>\n<blockquote><p><i>\u041a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0443 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/i><\/p><\/blockquote>\n<p>\u042d\u0442\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0446\u0438\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0438 \u043e\u043d\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u0442\u0443\u043c\u0430\u043d\u043d\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0438\u043a\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u041e\u0442\u0441\u044e\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0438 \u00ab\u043f\u0440\u0438\u0447\u0438\u043d\u044b\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0439\u043a\u043e\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u041f\u041e \u044d\u0442\u043e \u0443\u0434\u0435\u043b \u043c\u0430\u0442\u0451\u0440\u044b\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0430. \u0410 \u0432\u0435\u0434\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0446\u0435\u043d\u0438\u0442\u044c (\u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043e\u043d SRP \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0432\u044b\u0448\u0435:<br \/>  <b>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/b> <i>\u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0432\u044b\u0441\u043e\u0441\u0430\u043d \u0438\u0437 \u043f\u0430\u043b\u044c\u0446\u0430, \u0430 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u0440\u0430.<\/i>  <\/p>\n<pre><code class=\"php\">class SelectQuery {     public function __construct(QueryExecutor $executor) {...}      public function select($column, $alias = null): self {...}     public function from($table, $alias = null): self {...}     public function join(string $type, $table, $conditions = null): self {...}     public function where($column, $operator = null, $value = null): self {...}     public function orderBy($column, $order = null): self {...}     public function groupBy($column, $order = null): self {...}     public function limit(?int $limit): self {...}     public function offset(?int $offset): self {...}     public function build(): string {...}      public function rows(): array {...}     public function row(): array {...}     public function column(): array {...}     public function scalar() {...}     public function count() {...} } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c SELECT \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e. \u0421\u0440\u0430\u0437\u0443 \u0436\u0435 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u0447\u0442\u043e \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432: \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 SQL \u043a\u043e\u0434\u0430 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u043d\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 having() \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 HAVING \u0443\u0441\u043b\u043e\u0432\u0438\u0439. \u042d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 groupByKey() \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u0451\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u044d\u0442\u043e \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  \u041d\u0430\u043b\u0438\u0446\u043e \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 SRP. \u0420\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430 \u0434\u0432\u0430:  <\/p>\n<pre><code class=\"php\">class SelectQuery {     public function select($column, $alias = null): self {...}     public function from($table, $alias = null): self {...}     public function join(string $type, $table, $conditions = null): self {...}     public function where($column, $operator = null, $value = null): self {...}     public function orderBy($column, $order = null): self {...}     public function groupBy($column, $order = null): self {...}     public function limit(?int $limit): self {...}     public function offset(?int $offset): self {...}     public function build(): string {...} }  class ExecutableSelectQuery extends SelectQuery {     public function __construct(QueryExecutor $executor) {...}      public function rows(): array {...}     public function row(): array {...}     public function column(): array {...}     public function scalar() {...}     public function count() {...} } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0451 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0443 \u0432\u0435\u0449\u044c \u0438 \u0438\u043c\u0435\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u043d\u0443 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. <\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"java\">@Transactional class SearchService {     public List&lt;Athlete&gt; searchAthlete(SearchCriteria criteria)     public List&lt;User&gt; searchUser(SearchCriteria criteria)     public List&lt;Association&gt; searchAssociation(SearchCriteria criteria)     public List&lt;Orgaization&gt; searchOrganization(SearchCriteria criteria)     public List&lt;Club&gt; searchClub(SearchCriteria criteria)     public List&lt;Team&gt; searchTeam(SearchCriteria criteria)     public List&lt;Game&gt; searchGame(SearchCriteria criteria) } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 SRP. \u0412\u0435\u0434\u044c \u0442\u0430\u043a?<\/p>\n<p>  \u0410 \u043a\u0430\u043a \u0432\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"php\">class ActiveRecord {     private $properties = [];          public function __get($property) {...}     public function __set($property, $value) {...}      public fnction create() {...}     public fnction update() {...}     public fnction delete() {...}     public fnction read() {...} } <\/code><\/pre>\n<p>\u041d\u0443 ActiveRecord \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0435\u0440\u043d. \u041e\u043d \u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 SRP. \u0418\u043b\u0438 \u043d\u0435\u0442?<\/p>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u043e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 SRP \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0432\u0430\u0440\u044c\u0438\u0440\u0443\u044f \u0448\u0438\u0440\u043e\u0442\u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u0440\u043e\u0432\u043d\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 (\u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430), \u0442\u0430\u043a \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u00ab\u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432\u00bb. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<h2>\u0423\u0440\u043e\u0432\u0435\u043d\u044c -1<\/h2>\n<p>  \u041f\u043e \u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u0414\u044f\u0434\u044f \u0411\u043e\u0431 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u0448\u0451\u043b \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0432\u044b\u0432\u043e\u0434\u0443 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u0434\u0430\u0432\u043d\u0435\u0439 \u043a\u043d\u0438\u0433\u0435 <a href=\"https:\/\/www.amazon.com\/Clean-Architecture-Craftsmans-Software-Structure\/dp\/0134494164\" rel=\"nofollow\">Clean Architecture<\/a> \u0434\u0430\u0451\u0442 \u043d\u043e\u0432\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430:  <\/p>\n<blockquote><p><i>A module should be responsible to one, and only one, actor.<\/i><\/p><\/blockquote>\n<blockquote><p><i>\u041c\u043e\u0434\u0443\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u043a\u0442\u043e\u0440\u0430.<\/i><\/p><\/blockquote>\n<p>\u041f\u043e\u0434 \u0430\u043a\u0442\u043e\u0440\u043e\u043c \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0433\u0440\u0443\u043f\u043f\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043b\u0438\u0446, \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f <b>\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f<\/b> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<br \/>  \u042d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e, \u0442.\u043a., \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u043d\u043e \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0435 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0435, \u0430 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0435, \u0447\u0442\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e SRP \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043b\u044e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435:  <\/p>\n<blockquote><p>\u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u044c \u043a\u043e\u0434\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043d\u0435\u043c\u0443 \u043a\u043e\u0434\u0435.<\/p><\/blockquote>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u0442\u043e\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u043b\u0438, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u0430\u0431\u043e\u0440 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u0441\u0440\u0430\u0437\u0443, \u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0447\u044c\u0451-\u043b\u0438\u0431\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 \u043a\u043e\u0434\u0435.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043e\u043a\u0430\u0436\u0435\u043c \u044d\u0442\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u0442\u043e\u0440, \u0438\u043b\u0438 \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0433\u0440\u0443\u043f\u043f\u0430 \u043b\u0438\u0446 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0440\u043e\u043b\u0438 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0438 \u0433\u0434\u0435-\u0442\u043e \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u044f \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u0438\u0437 \u0434\u0432\u0443\u0445: \u043b\u0438\u0431\u043e \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430), \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a SRP \u0432\u043e\u043e\u0431\u0449\u0435, \u043b\u0438\u0431\u043e \u043e\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u00ab\u043d\u0430 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0443\u00bb, \u0447\u0442\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f YAGNI \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e.  <\/div>\n<\/div>\n<p>  \u041e\u0446\u0435\u043d\u0438\u043c \u0441 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0448 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u043a\u043b\u0430\u0441\u0441 SelectQuery. \u041e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0432\u0443\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445 (\u0442.\u0435. \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0430\u043a\u0442\u043e\u0440\u0430): \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f SQL \u043a\u043e\u0434\u0430 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u0430 \u044d\u0442\u0438\u0445 \u0430\u043a\u0442\u043e\u0440\u0430, \u0442.\u0435. \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 SQL, \u0430 \u0432 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 SRP. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u043d\u0430\u0441 \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0430\u043a\u0442\u043e\u0440 (\u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0430) \u2014 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442 SRP. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f SelectQuery \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0432\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0438\u043b\u0438 \u0432 \u0434\u0432\u0443\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445. \u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u2014 \u0441\u0442\u0440\u043e\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c:  <\/p>\n<pre><code class=\"php\">$rows = (new SelectQuery(new QueryExecutorImpl()))     -&gt;select(...)     -&gt;from(...)     -&gt;where(...)     -&gt;rows(); <\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 SelectQuery \u043d\u0435 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0430\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0430\u043a\u0442\u043e\u0440\u043e\u0432. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u043a\u0442\u043e\u0440\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0435\u0433\u043e \u0437\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0431\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f SRP.<\/p>\n<p>  \u0427\u0442\u043e \u043d\u0430 \u0441\u0447\u0451\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 SearchService. \u041e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 Athlete, Association \u0438 \u0442.\u0434. \u0410 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043d\u0435\u044f\u0441\u0435\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0447\u0442\u043e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0435 DTO, \u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0438\u0441\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u043c\u044b\u0445, \u043d\u043e \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e\u0433\u0434\u0430 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u043a\u0442\u043e\u0440\u0430 \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 SRP. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0430 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u0430\u0436\u0434\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 (\u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0430\u0432\u0442\u043e\u0440\u0430), \u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441 \u0438\u043c\u0435\u0435\u0442 \u043a\u0443\u0447\u0443 \u0430\u043a\u0442\u043e\u0440\u043e\u0432, \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0436\u0451\u0441\u0442\u043a\u043e \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0412 \u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448 ActiveRecord? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0438\u043a\u0430\u043a \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u043d\u0435\u043b\u044c\u0437\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, ActiveRecord \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u0435\u0442\u0441\u044f \u0441 SRP.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u043d\u0435 \u0432\u0435\u0440\u0438\u0442<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u0430\u044f \u0432\u044b\u0448\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f ActiveRecord \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 SRP (\u043a\u0442\u043e \u0434\u0443\u043c\u0430\u0435\u0442 \u0438\u043d\u0430\u0447\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445). \u041e\u0434\u043d\u0430\u043a\u043e \u0432 <a href=\"https:\/\/www.martinfowler.com\/eaaCatalog\/activeRecord.html\" rel=\"nofollow\">\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438<\/a> \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0435\u0440\u043d\u0430 \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043e \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 SRP: \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u2014 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445.  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u0442\u043e\u0439\u0442\u0435! \u0427\u0442\u043e \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u0435\u043b\u0430\u0435\u043c? \u041d\u0430 \u043a\u0430\u043a\u043e\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b (\u0430\u043a\u0442\u043e\u0440\u043e\u0432) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f. \u041a\u0430\u043a\u043e\u0432 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0430\u043a\u0442\u043e\u0440\u043e\u0432? \u0427\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u00ab\u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439\u00bb? C\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0438\u0447\u0435\u043c. \u0414\u0430, \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0442\u043e \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043d\u043e \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0435\u0433\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a\u0436\u0435 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u0430 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u044f\u043c\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u043f\u044b\u0442\u0430 \u0438 \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043c\u0435\u0440\u0438\u0442\u044c \u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432. \u0427\u0442\u043e \u0436, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0435\u0441\u0442\u044c.<\/p>\n<h2>\u0423\u0440\u043e\u0432\u0435\u043d\u044c -2<\/h2>\n<p>  \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u0437\u043d\u0438\u043a \u043a\u0430\u043a \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/en.wikipedia.org\/wiki\/Coupling_(computer_programming)\" rel=\"nofollow\">coupling<\/a> (\u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u0437\u0430\u0446\u0435\u043f\u043b\u0435\u043d\u0438\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u044c) \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cohesion_(computer_science)\" rel=\"nofollow\">cohesion<\/a> (\u0441\u043f\u043b\u043e\u0447\u0451\u043d\u043d\u043e\u0441\u0442\u044c, \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c, \u043f\u0440\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044f).  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>\u0412 1972 \u0433\u043e\u0434\u0443 <a href=\"https:\/\/en.wikipedia.org\/wiki\/David_Parnas\" rel=\"nofollow\">\u0414\u044d\u0432\u0438\u0434 \u041f\u0430\u0440\u043d\u0430\u0441<\/a> \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044e \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0434\u0435\u044e \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0442\u043e\u043c \u043a\u0430\u043a \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/li>\n<li>\u0412 1974 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Edsger_W._Dijkstra\" rel=\"nofollow\">\u042d\u0434\u0441\u0433\u0435\u0440 \u0414\u0435\u0439\u043a\u0441\u0442\u0440\u0430<\/a> <br \/>  \u0432\u0432\u043e\u0434\u0438\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d: <a href=\"https:\/\/en.wikipedia.org\/wiki\/Separation_of_concerns\" rel=\"nofollow\">The Separation of Concerns<\/a> (\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438).<\/li>\n<li>\u0412 \u043a\u043e\u043d\u0446\u0435 70\u0445 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tom_DeMarco\" rel=\"nofollow\">\u0422\u043e\u043c \u0414\u0435\u043c\u0430\u0440\u043a\u043e<\/a> \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u044f coupling \u0438 cohesion \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435 (\u0432 1974) <a href=\"https:\/\/en.wikipedia.org\/wiki\/Larry_Constantine\" rel=\"nofollow\">\u041b\u0430\u0440\u0440\u0438 \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0438\u043d\u043e\u043c<\/a>.<\/li>\n<li>\u0412 \u043a\u043e\u043d\u0446\u0435 90\u0445 \u2014 \u043d\u0430\u0447\u0430\u043b\u0435 2000\u0445 \u0414\u044f\u0434\u044f \u0411\u043e\u0431 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0438\u0434\u0435\u0438 \u0432 <a href=\"https:\/\/blog.cleancoder.com\/uncle-bob\/2014\/05\/08\/SingleReponsibilityPrinciple.html\" rel=\"nofollow\">\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/a>.<\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0431\u0430 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<blockquote><p>Coupling \u2014 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.<\/p><\/blockquote>\n<blockquote><p>Cohesion \u2014 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f (\u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438).<\/p><\/blockquote>\n<p>\u0412\u0432\u0435\u0434\u0451\u043c \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0438 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438:  <\/p>\n<blockquote><p>\u041c\u043e\u0434\u0443\u043b\u044c A \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c B, \u0438\u043b\u0438 \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043c\u043e\u0434\u0443\u043b\u044c B \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0410, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430 \u043a\u043e\u0433\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p><\/blockquote>\n<blockquote><p>\u041c\u043e\u0434\u0443\u043b\u044c A \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f B, \u0430 \u043c\u043e\u0434\u0443\u043b\u044c B \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 A, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0410 <i>\u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442<\/i> \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u043a\u043e\u0434\u0430 \u0432 B, \u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 B <i>\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c<\/i> \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u043a\u043e\u0434\u0430 \u0432 A.<\/p><\/blockquote>\n<p>\u0413\u0434\u0435 \u043f\u043e\u0434 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043d\u0435 (\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u043e\u0434\u0443\u043b\u044f). \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430:  <\/p>\n<blockquote><p>\u041c\u043e\u0434\u0443\u043b\u044c A \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044f B, \u0430 \u043c\u043e\u0434\u0443\u043b\u044c B \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 A, \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f B \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 A.<\/p><\/blockquote>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b. \u0427\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0436\u0435\u0448\u044c \u043f\u0440\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043e\u043d\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b. \u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043b\u0430\u0441\u0441\u0430, \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434.) \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043e\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043a \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u043c\u0443 \u0442\u0430\u043a \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043d\u0438\u0437\u043a\u043e\u0435 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u0441\u043c\u043e\u0442\u0440\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/en.wikipedia.org\/wiki\/GRASP_(object-oriented_design)\" rel=\"nofollow\">GRASP<\/a>).  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435\u0442 \u043b\u0438 \u0442\u0443\u0442 \u043f\u043e\u0434\u0432\u043e\u0445\u0430?<\/b><\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0439 (\u043c\u043e\u0434\u0443\u043b\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c\u044e) \u0438 \u043d\u0438\u0437\u043a\u043e\u0439 (\u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438). \u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e? \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0430\u043c\u044b\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e, \u0430 \u0441\u0430\u043c\u044b\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 (\u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430) \u2014 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0435\u0439. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0438 \u043f\u043b\u043e\u0445\u0443\u044e \u0434\u0435\u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0438 (\u0440\u0430\u0437\u043d\u043e\u0446\u0432\u0435\u0442\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f):<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/t0\/3y\/ma\/t03ymaiosc1cmbrij7b0ctvl8lc.png\">  <\/div>\n<\/div>\n<p>  \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 <a href=\"https:\/\/www.smaele.nl\/documents\/iso\/ISO-24765-2010.pdf\" rel=\"nofollow\">ISO\/IEC\/IEEE 24765-2010<\/a> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b (\u043d\u0435\u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e) \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0438\u0434\u044b \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f (\u043e\u0442 \u0445\u0443\u0434\u0448\u0435\u0433\u043e \u043a \u043b\u0443\u0447\u0448\u0435\u043c\u0443):  <\/p>\n<ul>\n<li><b>\u0421\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c<\/b>\n<ol>\n<li>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f (coincidental)<br \/>  \u041f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u0430\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0435\u0441\u044c \u0442\u043e\u0442 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<br \/> \n<pre><code class=\"php\">class UserManager {     public function writeToFile(...) {...}     public function calculatePaymentAmount(...) {...}     public function authenticateUser(...) {...} } <\/code><\/pre>\n<p>  <\/li>\n<li>\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f (logical)<br \/>  \u0422\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c (\u043b\u0438\u0431\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043b\u0430\u0431\u043e), \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0445 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e \u0441\u0445\u043e\u0434\u0441\u0442\u0432\u0443 \u0440\u0435\u0448\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0437\u0430\u0434\u0430\u0447). \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 SearchService, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e \u0432\u0441\u0435 \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u0422\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u043d\u043e \u043e\u0431\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2014 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043f\u043e\u0438\u0441\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0445\u043e\u0442\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0440\u0430\u0437\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u044f\u043c.  <\/li>\n<li>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f (temporal)<br \/>  \u0422\u0438\u043f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0438\u043c \u043d\u0435 \u0432\u0430\u0436\u0435\u043d. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043d\u0438\u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<br \/> \n<pre><code class=\"php\">class ExceptionProcessor {     public function logException(Exception $e) {...}     public function notifyAdminAboutException(Exception $e) {...}     public function showFormattedException(Exception $e) {...} }  \/\/ \u0414\u0430\u043b\u0435\u0435, \u0433\u0434\u0435-\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 $exceptionProcessor = new ExceptionProcessor(); ... try { ... } catch (Exception $e) {     $exceptionProcessor-&gt;logException($e);     $exceptionProcessor-&gt;notifyAdminAboutException($e);     $exceptionProcessor-&gt;showException($e); } <\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u043d\u0430\u044f (procedural)<br \/>  \u0422\u0438\u043f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u041f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<br \/> \n<pre><code class=\"php\">class Concole {     public static function hasColorSupport(): bool {...}     public static function highlight(string $text): string {...} }  \/\/ \u0414\u0430\u043b\u0435\u0435, \u0433\u0434\u0435-\u0442\u043e \u0432 \u043a\u043e\u0434\u0435 $consoleText = '...'; if (Console::hasColorSupport()) {     $consoleText = Console::highlight($consoleText); } $this-&gt;write($consoleText); <\/code><\/pre>\n<p>  <\/li>\n<li>\u041a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f\/\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f (communicational\/informational)<br \/>  \u041f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 SelectQuery (\u0434\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f), ActiveRecord (\u0442\u043e\u043b\u044c\u043a\u043e CRUD), \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u043e\u043f\u043b\u043e\u0449\u0430\u044e\u0449\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0438.  <\/li>\n<li>\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u043d\u0430\u044f (sequential)<br \/>  \u041f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f, \u0442.\u0435. \u0432\u0430\u0436\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f\u043c. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043e\u0434\u043d\u0443 \u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430.<br \/> \n<pre><code class=\"php\">class ExpressionExecutor {     public function execute(string $expression) {         $ast = $this-&gt;parse(             $this-&gt;lexer(                 $this-&gt;characterIterator($expression)             )         );         return $ast-&gt;evaluate();     }      protected function parse(Lexer $lexer) {...}     protected function lexer(Iterator $iterator): Lexer {...}     protected function characterIterator($expression): Iterator {...}  } <\/code><\/pre>\n<p>  <\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f (functional)<br \/>  \u0412\u0441\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u0434\u043d\u0443 \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u044f\u043c\u0430\u044f \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438.<br \/> \n<pre><code class=\"php\">class Lexer {     public function __construct(CharacterIterator $charIterator) {...}     public function getTokens(): Generator {...} } <\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<\/li>\n<li><b>\u0421\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435<\/b><br \/> \n<ol>\n<li>\u041f\u0430\u0442\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 (pathological)<br \/>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u0438\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u0437\u0430\u0446\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0441\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (information hiding).<br \/> \n<pre><code class=\"python\">class Hash:     ...     def hashOfText(self, text):         self.__hashFromCache(text, self.__textHashCache)      def __hashFromCache(text, cache):         ...  class OrderId:     ...     def hash(self):         return Hash()._Hash__hashFromCache(self.__id, dict())  <\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 (content)<br \/>  \u0427\u0430\u0441\u0442\u044c \u0438\u043b\u0438 \u0432\u0441\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u0446\u0435\u043f\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<br \/> \n<pre><code class=\"java\">public class BitSet implements Cloneable, java.io.Serializable {     ...     public IntStream stream() {         class BitSetSpliterator implements Spliterator.OfInt {             ...         }         return StreamSupport.intStream(             new BitSetSpliterator(0, -1, 0, true),              false         );     } } <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"php\">class EventPublisher {     private $subscribers = [];      public function __construct()     {         $this-&gt;subscribers[] = new EventSubscriberContract {             public function handle(Event $event)             {                 ...             }         }     } } <\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u043e \u043e\u0431\u0449\u0435\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (common, common-environment)<br \/>  \u0414\u0432\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u0449\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 (\u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c).<br \/> \n<pre><code class=\"php\">$board = [];  class Bot implements Player {     ...     public function move()     {         global $board;         ...         if ($board[$x][$y] === $this-&gt;shape['o']) {             ...         }         ...         $board[$x][$y] = $this-&gt;shape['x'];         ...     } }  class Game {     private $player1;     private $player2;      public function __construct(Player $player1, Player $player2)     {         $this-&gt;player1 = $player1;         $this-&gt;player2 = $player2;     }      public funciton next(): bool     {         $this-&gt;player1-&gt;move();         if ($this-&gt;isGameOver()) {             return true;         }         $this-&gt;player2-&gt;move();         if ($this-&gt;isGameOver()) {             return true;         }         return false;     }      public function isGameOver(): bool     {         global $board;         if ($board[$x][$y] === 'x' || ... ) {             return true;         }         return false;     } } <\/code><\/pre>\n<p>  <\/li>\n<li>\u0421\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0435 (hybrid)<br \/>  \u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0438 \u043d\u0435\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440: \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 DTO \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438.  <\/li>\n<li>\u041f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e (control coupling)<br \/>  \u041e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0443\u0442\u0451\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<br \/> \n<pre><code class=\"php\">class SortedCollection {     private $items;     private $comparator;      public function __construct(array $items, callable $comparator) {         $this-&gt;items = $items;         $this-&gt;comparator = $comparator;     }      public function items(): array     {         $this-&gt;sort();         return $this-&gt;items;     }      private function sort(): void     {         usort($this-&gt;items, $this-&gt;comparator);     } } ... $collection = new SortedCollection([3, 5, 2, 1], function (int $a, int $b) {     return $a &lt;=&gt; $b; }); $sortedItems = $collection-&gt;items(); <\/code><\/pre>\n<p>  <\/li>\n<li>\u041f\u043e \u0434\u0430\u043d\u043d\u044b\u043c (data)<br \/>  \u0414\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<br \/> \n<pre><code class=\"php\">class UserController {     public function userDetails(string $userId, UserQueryService $service)     {         return $service-&gt;getUserDetails($userId);     } } <\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/li>\n<\/ul>\n<p>\u0413\u0434\u0435-\u0442\u043e \u0441 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u044b 70\u0445 \u0433\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0432\u0435\u043a\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0438\u0445 \u043d\u043e\u0432\u044b\u0445 \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0435\u0439. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li><a href=\"http:\/\/www.math.md\/files\/csjm\/v25-n1\/v25-n1-(pp44-74).pdf\" rel=\"nofollow\">Class Cohesion Metrics for Software Engineering<\/a><\/li>\n<li><a href=\"https:\/\/dibt.unimol.it\/staff\/fpalomba\/documents\/J16.pdf\" rel=\"nofollow\">A Survey on Software Coupling Relations and Tools<\/a><\/li>\n<li><a href=\"https:\/\/www.researchgate.net\/publication\/238729882_Measuring_coupling_and_cohesion_in_object-oriented_systems\" rel=\"nofollow\">Measuring coupling and cohesion in object-oriented system<\/a>s<\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043e\u0431\u0438\u043b\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a, \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u041e\u0442\u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u043d\u044f\u0442\u0438\u0439. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0440\u0430\u0437\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0432\u0435\u043b\u0438\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u041a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u0432\u044f\u0437\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u00ab\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438\u00bb, \u0430 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u00ab\u0432\u0440\u0435\u0434\u043d\u044b\u043c\u0438\u00bb (\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438). \u0418 \u043a\u0430\u043a\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u043a\u0430\u043a\u043e\u0439 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u0430\u043a\u0430\u044f \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0438\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u0432\u0435\u043b\u0430\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<h2>\u0423\u0440\u043e\u0432\u0435\u043d\u044c -3<\/h2>\n<p>  \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043d\u0435 \u0432\u0441\u0451 \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u00ab\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u00bb \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u0441\u0432\u044f\u0437\u0435\u0439 \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 <a href=\"http:\/\/www.wseas.us\/e-library\/conferences\/2007corfu\/papers\/540-383.pdf\" rel=\"nofollow\">Measuring Software Coupling<\/a>. \u0425\u043e\u0442\u044f \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f, \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0438 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>  \u0421\u0443\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c: \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438, \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435. \u0420\u0430\u0441\u0447\u0451\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u043d\u044b\u043c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u043c \u0438 \u043f\u043e\u043b\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0438\u0434\u043e\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u0418\u0437-\u0437\u0430 \u0434\u0438\u0430\u043b\u0435\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u044b \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043d\u0438\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c\u0438.<\/p>\n<p>  <b>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0440\u0430\u0441\u0447\u0451\u0442\u0430<\/b><\/p>\n<ol>\n<li>\u0421\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439 \u0434\u043b\u044f m \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c n \u0432\u0438\u0434\u043e\u0432 \u0441\u0432\u044f\u0437\u0435\u0439:\n<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f94\/3dc\/aca\/f943dcaca0f279ea69e022d14acf3f5d.svg\" alt=\"$\\quad \\begin{pmatrix} \u0441_{11} &amp; \u0441_{12} &amp; ... &amp; \u0441_{1n} \\\\ \u0441_{21} &amp; \u0441_{22} &amp; ... &amp; \u0441_{2n} \\\\ ... &amp; ... &amp; ... &amp; ... \\\\ \u0441_{m1} &amp; \u0441_{m2} &amp; ... &amp; \u0441_{mn} \\end{pmatrix} \\quad$\" data-tex=\"display\"><\/math><\/p>\n<p> \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/43a\/335\/15e\/43a33515ea3e3efbac8043e1589feea6.svg\" alt=\"$ \u0441_{ij}$\" data-tex=\"inline\"><\/math> \u0447\u0438\u0441\u043b\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u0432\u0438\u0434\u0430 \u0441\u0432\u044f\u0437\u0438 j \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u044c i. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u043c\u043e\u0434\u0443\u043b\u044c i \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043a\u0430\u043a\u0438\u043c\u0438-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u044f\u0437\u044c j. \u0415\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/43a\/335\/15e\/43a33515ea3e3efbac8043e1589feea6.svg\" alt=\"$ \u0441_{ij}$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u0435\u043d \u043d\u0443\u043b\u044e, \u0442\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u0432\u0438\u0434 \u0441\u0432\u044f\u0437\u0438 j \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043c\u043e\u0434\u0443\u043b\u044e i.<br \/>  \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0433\u0440\u0430\u0444 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u044f\u0437\u043d\u044b\u0439, \u0442.\u0435. \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c. \u0418\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u0438\u043b\u0438 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0445 \u0438\u0437 \u043e\u0434\u043d\u0438\u0445 \u043d\u0443\u043b\u0435\u0439.   <\/li>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:\n<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c55\/b36\/6d8\/c55b366d8ee48d170d5ce388b7065ec2.svg\" alt=\"$\\begin{pmatrix} d_{11} &amp; d_{12} &amp; ... &amp; d_{1m} \\\\ d_{21} &amp; d_{22} &amp; ... &amp; d_{2m} \\\\ ... &amp; ... &amp; ... &amp; ... \\\\ d_{m1} &amp; d_{m2} &amp; ... &amp; d_{mm} \\end{pmatrix}$\" data-tex=\"display\"><\/math><\/p>\n<p> \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c: <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/00d\/783\/1ea\/00d7831ea421f6bc417419013918f9e4.svg\" alt=\"$d_{ij} = \\left( \\sum_{k=1}^{n} c_{ik} \\times c_{jk} \\times \\beta_k \\right) \\Bigg\/ \\alpha_i$\" data-tex=\"display\"><\/math><\/p>\n<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b34\/48a\/b13\/b3448ab13359ec8082f712b0a2256a5c.svg\" alt=\"$\\alpha_i = \\sum_{j=1}^n c_{ij}$\" data-tex=\"display\"><\/math><\/p>\n<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/71d\/e20\/c93\/71de20c931df60e5d2394359b9140fae.svg\" alt=\"$\\beta_k = 1 \\Big\/ \\sum_{i=1}^m c_{ik}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/891\/96b\/fad\/89196bfad0d223a2b9d4a716349bad2e.svg\" alt=\"$ \\alpha_i $\" data-tex=\"inline\"><\/math> \u2014 \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 i-\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439, \u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/92c\/808\/e06\/92c808e0675021923f13cfc6d74f5dbe.svg\" alt=\"$ \\beta_k $\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0443\u043c\u043c\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 k-\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u0432\u044f\u0437\u0435\u0439.  <\/li>\n<li>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043c\u0435\u0435\u043c:\n<ul>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2bd\/673\/82e\/2bd67382edb306bd760d0d6302c58009.svg\" alt=\"$ 1 \\ge d_{ij} \\ge 0 $\" data-tex=\"inline\"><\/math>, \u0434\u043b\u044f \u0432\u0441\u0435\u0445 i \u0438 j.<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/95e\/a6c\/940\/95ea6c940ba4acb229a8a5a91767df79.svg\" alt=\"$ d_{ij} $\" data-tex=\"inline\"><\/math> \u2014 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 i \u0438 j, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2a5\/077\/d3d\/2a5077d3de058a6c393b779c748e5e67.svg\" alt=\"$ i \\ne j $\" data-tex=\"inline\"><\/math>.<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/95e\/a6c\/940\/95ea6c940ba4acb229a8a5a91767df79.svg\" alt=\"$ d_{ij} $\" data-tex=\"inline\"><\/math> \u2014 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u044f i \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8b3\/8d0\/460\/8b38d046069face06252671f776b709d.svg\" alt=\"$ i = j $\" data-tex=\"inline\"><\/math>.<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d94\/8bd\/868\/d948bd868130363c309e0d98252301ba.svg\" alt=\"$ d_i = 1 - d_{ii} $\" data-tex=\"inline\"><\/math> \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044f \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/40d\/f56\/05c\/40df5605c7492f1e1f2826127ede9631.svg\" alt=\"$ D = \\sum_{i=1}^m d_i $\" data-tex=\"inline\"><\/math> \u2014 \u043e\u0431\u0449\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f7d\/938\/708\/f7d9387083bd1d5f8c472f275ab263c8.svg\" alt=\"$ D_{avg} = D \/ m $\" data-tex=\"inline\"><\/math> \u2014 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/li>\n<\/ul>\n<p>  <\/li>\n<\/ol>\n<p>  \u041f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043a\u043e\u0434 \u043d\u0430 PHP:  <\/p>\n<pre><code class=\"php\">&lt;?php  class User {...}  class Chat {...}  class ChatSession {...}  interface UserRepository {    public function getMostLowLoadedOperator(): ?User; }  interface ChatRepository {     public function chatFrom($chatId): Chat; }  interface ChatSessionRepository {     public function sessionFrom($sessionId): ChatSession;      public function save(ChatSession $session): void; }  interface BotService {...}  class ChatSessionApplicationService extends AbstractApplicationService {     public function __construct(         ChatSessionRepository $sessionRepository, \tChatRepository $chatRepository, \tUserRepository $userRepository, \tBotService $botService,         UserAccessService $accessService     ) {         ...     }      public function startSession(StartSessionCommand $command): string     {         \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f Chat, ChatRepository, ChatSession, ChatSessionRepository,         \/\/ BotService \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438\u0437 AbstractApplicationService         ...     }      public function switchChatSessionToFreeOperator($sessionId): void     {         \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f ChatSession, ChatSessionRepository, User \u0438 UserRepository          \/\/ \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0438\u0437 AbstractApplicationService         ...     }      public function changeName($sessionId, string $name): void     {         \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f ChatSession, ChatSessionRepository \u0438 UserAccessService         ...     } } <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0432\u044f\u0437\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0432 PHP. \u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0441\u0432\u044f\u0437\u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u043c \u0432\u0435\u0441 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 0 \u0434\u043e 1 (0 \u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044e \u0441\u0432\u044f\u0437\u0438, 1 \u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u00ab\u0436\u0451\u0441\u0442\u043a\u043e\u0439\u00bb \u0441\u0432\u044f\u0437\u0438).<\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>\u0412\u0438\u0434 \u0441\u0432\u044f\u0437\u0438<\/th>\n<th>\u0412\u0435\u0441 \u0441\u0432\u044f\u0437\u0438<\/th>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043d\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441.<\/td>\n<td>1.0<\/td>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0440\u0435\u0439\u0442.<\/td>\n<td>0.8<\/td>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441.<\/td>\n<td>0.6<\/td>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u0430\u043a\u0438\u043c \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/td>\n<td>0.4<\/td>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0431\u0443\u0434\u0443\u0447\u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043e\u0442 \u043d\u0435\u0433\u043e.<\/td>\n<td>0.2<\/td>\n<\/tr>\n<tr>\n<td>\u041a\u043b\u0430\u0441\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0432\u0441\u0435.<\/td>\n<td>0.0<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u043c, \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443: \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u00ab\u0436\u0451\u0441\u0442\u043a\u043e\u0439\u00bb \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0434\u0440\u0443\u0433\u043e\u0439. \u041c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u043f\u043e\u0440\u0438\u0442\u044c \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0432\u0435\u0441\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f, \u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434 \u043f\u043b\u043e\u0445 \u0438\u043b\u0438 \u0445\u043e\u0440\u043e\u0448 \u0432 \u044d\u0442\u043e\u043c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0435\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0430\u0441\u0447\u0451\u0442\u0443 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0435\u0433\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 11 \u043c\u043e\u0434\u0443\u043b\u0435\u0439:  <\/p>\n<ol>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d61\/d0b\/c10\/d61d0bc102ed8095031493b7a467c717.svg\" alt=\"$ m_1 $\" data-tex=\"inline\"><\/math> \u2014 User<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/370\/b22\/883\/370b2288367184559af4aabde48be904.svg\" alt=\"$ m_2 $\" data-tex=\"inline\"><\/math> \u2014 Chat<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/82b\/af3\/0ba\/82baf30ba2e9d261656fbfd1bb3b87a1.svg\" alt=\"$ m_3 $\" data-tex=\"inline\"><\/math> \u2014 ChatSession<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bdd\/8bf\/fc9\/bdd8bffc9e6ece9d16aa0f4db6025d26.svg\" alt=\"$ m_4 $\" data-tex=\"inline\"><\/math> \u2014 UserRepository<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/45d\/21e\/e7f\/45d21ee7f0cd83d63617c849415057d1.svg\" alt=\"$ m_5 $\" data-tex=\"inline\"><\/math> \u2014 ChatRepository<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/97e\/4a9\/615\/97e4a9615ffa6b5b9d94fd50aac5ec2d.svg\" alt=\"$ m_6 $\" data-tex=\"inline\"><\/math> \u2014 ChatSessionRepository<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cd4\/961\/d8f\/cd4961d8f4030bcfca4cb75adafe429d.svg\" alt=\"$ m_7 $\" data-tex=\"inline\"><\/math> \u2014 ChatSessionApplicationService<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b18\/518\/6fc\/b185186fc64b4758440a71aaaa7123cc.svg\" alt=\"$ m_8 $\" data-tex=\"inline\"><\/math> \u2014 AbstractApplicationService<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/215\/208\/b3e\/215208b3e9885f6875de7543b3a94d58.svg\" alt=\"$ m_9 $\" data-tex=\"inline\"><\/math> \u2014 BotService<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/505\/97a\/a00\/50597aa00812f2da48e6d111b7d9dfb0.svg\" alt=\"$ m_{10} $\" data-tex=\"inline\"><\/math> \u2014 UserAccessService<\/li>\n<li><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/086\/d6e\/5e0\/086d6e5e070f522464c09ca3d3d767ef.svg\" alt=\"$ m_{11} $\" data-tex=\"inline\"><\/math> \u2014 StartSessionCommand<\/li>\n<\/ol>\n<p>  \u0421\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439, \u0433\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1c6\/aef\/5d6\/1c6aef5d6919b8ae84218dc7f7c35ec0.svg\" alt=\"$ c_{ij} $\" data-tex=\"inline\"><\/math> \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/874\/86c\/61a\/87486c61a38c7f7b92b469971ec70ec1.svg\" alt=\"$ m_j $\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d58\/c0b\/e4f\/d58c0be4f72581b4d2a2b50d3244d9c2.svg\" alt=\"$ m_i $\" data-tex=\"inline\"><\/math>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u0441\u0432\u044f\u0437\u0435\u0439 \u044d\u0442\u043e \u0432\u0435\u0441\u0430 \u0440\u0451\u0431\u0435\u0440 \u0433\u0440\u0430\u0444\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u044f\u043c\u043e\u043c \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cq\/hb\/xn\/cqhbxn-mlyvfk4lwaqesmz9r7es.png\"><br \/>  \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0435\u0439:  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a2e\/bf7\/1fd\/a2ebf71fd747bfd172af54d32f3ee66d.svg\" alt=\"$ \\small m_7m_{11} $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7de\/2d4\/ad7\/7de2d4ad7c06c73f967bf0022a8c4b53.svg\" alt=\"$ \\small m_7m_3 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/2aa\/847\/458\/2aa847458b7195c0f4d909ae95d9fba3.svg\" alt=\"$ \\small m_7m_6 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/320\/9d3\/ac7\/3209d3ac7837aa4e93e1c248a3f71cd7.svg\" alt=\"$ \\small m_6m_3 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/056\/64c\/421\/05664c421bfe909ed01c7383cd6a02d9.svg\" alt=\"$ \\small m_7m_5 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/31f\/404\/c8d\/31f404c8d5ecf396dce2679778ef6396.svg\" alt=\"$ \\small m_5m_2 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/93d\/666\/870\/93d666870767a9c9ab1622d44bbc2cbe.svg\" alt=\"$ \\small m_7m_2 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/81a\/2ba\/5cb\/81a2ba5cbe96bbbe564800dba24d11b7.svg\" alt=\"$ \\small m_7m_1 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3ea\/02d\/fd9\/3ea02dfd9876399b7f66b1e095b3f00a.svg\" alt=\"$ \\small m_7m_4 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/278\/1c2\/ea9\/2781c2ea9a27a218e98faf492ea5f387.svg\" alt=\"$ \\small m_4m_1 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b9a\/6f5\/a95\/b9a6f5a95158ad1daf733ed46a539750.svg\" alt=\"$ \\small m_7m_{10} $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b2f\/d1d\/061\/b2fd1d0612ea233a22a2ac71e1958d3b.svg\" alt=\"$ \\small m_{10}m_1 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b88\/6f9\/f5d\/b886f9f5de98e38beebc3fe0c81a4dca.svg\" alt=\"$ \\small m_7m_9 $\" data-tex=\"inline\"><\/math><\/th>\n<th><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/90f\/4ec\/493\/90f4ec493f1499c7c14c4d4b47ddb2a9.svg\" alt=\"$ \\small m_7m_8 $\" data-tex=\"inline\"><\/math><\/th>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5ea\/221\/ddf\/5ea221ddfe6e7280c39a23fd5d483eb6.svg\" alt=\"$ \\small m_1 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7d2\/c4f\/d78\/7d2c4fd7836d439319a91605f42515fa.svg\" alt=\"$ \\small m_2 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/49a\/e46\/e86\/49ae46e868d6198cc4ca991e8724e28d.svg\" alt=\"$ \\small m_3 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4d4\/acb\/fac\/4d4acbfacfdfa7b977e561af52747153.svg\" alt=\"$ \\small m_4 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0.4<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a51\/1b5\/7b4\/a511b57b45125dc3e2f5af503a5c94b0.svg\" alt=\"$ \\small m_5 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0.4<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a68\/547\/d54\/a68547d5454376ffaf5e427d5382e57c.svg\" alt=\"$ \\small m_6 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0.4<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5db\/f41\/24e\/5dbf4124e61a5393e58c91ebcfb8e202.svg\" alt=\"$ \\small m_7 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0.2<\/td>\n<td>0.2<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0.2<\/td>\n<td>0.2<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0.2<\/td>\n<td>0.2<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b21\/e02\/d8a\/b21e02d8a40dabcc37df3330739f2bbb.svg\" alt=\"$ \\small m_8 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0.6<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/508\/fe0\/dfc\/508fe0dfccb43d38bf521d6a9275be3a.svg\" alt=\"$ \\small m_9 $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aff\/382\/b47\/aff382b478e2ba5928f07f20665ffb43.svg\" alt=\"$ \\small m_{10} $\" data-tex=\"inline\"><\/math><\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1<\/td>\n<td>0.2<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/023\/356\/4b6\/0233564b6da5231fbdc0aeeedac0cd2d.svg\" alt=\"$ \\small m_{11} $\" data-tex=\"inline\"><\/math><\/td>\n<td>1<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0440\u0430\u0441\u0447\u0451\u0442\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:  <\/p>\n<p><math>$$display$$\\begin{pmatrix} 0.833 &amp; 0 &amp; 0 &amp; 0.056 &amp; 0 &amp; 0 &amp; 0.056 &amp; 0 &amp; 0 &amp; 0.056 &amp; 0 \\\\ 0 &amp; 0.833 &amp; 0 &amp; 0 &amp; 0.083 &amp; 0 &amp; 0.083 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\ 0 &amp; 0 &amp; 0.833 &amp; 0 &amp; 0 &amp; 0.083 &amp; 0.083 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\ 0.278 &amp; 0 &amp; 0 &amp; 0.5 &amp; 0 &amp; 0 &amp; 0.222 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\ 0 &amp; 0.278 &amp; 0 &amp; 0 &amp; 0.5 &amp; 0 &amp; 0.222 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\ 0 &amp; 0 &amp; 0.278 &amp; 0 &amp; 0 &amp; 0.5 &amp; 0.222 &amp; 0 &amp; 0 &amp; 0 &amp; 0 \\\\ 0.083 &amp; 0.083 &amp; 0.083 &amp; 0.067 &amp; 0.067 &amp; 0.067 &amp; 0.225 &amp; 0.075 &amp; 0.083 &amp; 0.083 &amp; 0.083 \\\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0.25 &amp; 0.75 &amp; 0 &amp; 0 &amp; 0 \\\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0.167 &amp; 0 &amp; 0.833 &amp; 0 &amp; 0 \\\\ 0.139 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0.139 &amp; 0 &amp; 0 &amp; 0.722 &amp; 0 \\\\ 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0 &amp; 0.167 &amp; 0 &amp; 0 &amp; 0 &amp; 0.833 \\end{pmatrix}$$display$$<\/math><\/p>\n<p>  \u041e\u0431\u0449\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/eed\/453\/3b2\/eed4533b293dda9a007239da0acc526c.svg\" alt=\"$ D = 3.636 $\" data-tex=\"inline\"><\/math>, \u0430 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/839\/1b0\/9f1\/8391b09f143b9fbf47b2cf792931b11e.svg\" alt=\"$ D_{avg} = 0.33 $\" data-tex=\"inline\"><\/math> <br \/>  \u041a\u0430\u043a \u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u0441\u0430\u043c\u044b\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f ChatSessionApplicationService, \u0437\u0430 \u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, UserAccessService, AbstractApplicationService \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u0421\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u0441\u043b\u0430\u0431\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c ChatSessionApplicationService \u0438 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 SRP. \u0417\u0434\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u0432\u0438\u0434\u043e\u0432 \u0441\u0432\u044f\u0437\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u043e\u0434\u0443\u043b\u044f (\u043a\u043b\u0430\u0441\u0441\u0430) \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u043c\u0435\u0442\u043e\u0434\u043e\u0432). \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u043d\u0443\u0442\u0440\u0438 ChatSessionApplicationService \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f \u0432 \u0446\u0435\u043b\u044f\u0445 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0437\u0430 1. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0441\u0432\u044f\u0437\u0435\u0439 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:  <\/p>\n<ol>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 UserRepository<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ChatRepository<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ChatSessionRepository<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 UserAccessService<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 BotService<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 AbstractApplicationService<\/li>\n<\/ol>\n<p>  \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441\u0432\u044f\u0437\u0435\u0439:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ce2\/d8a\/468\/ce2d8a46862d629a0a2ba91ad8985e2c.svg\" alt=\"$\\begin{pmatrix} 0 &amp; 1 &amp; 1 &amp; 0 &amp; 1 &amp; 1 \\\\ 1 &amp; 0 &amp; 1 &amp; 0 &amp; 0 &amp; 1 \\\\ 0 &amp; 0 &amp; 1 &amp; 1 &amp; 0 &amp; 0 \\end{pmatrix}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/14a\/b9e\/df2\/14ab9edf25c2dde0c081aaad06009df1.svg\" alt=\"$\\begin{pmatrix} 0.708 &amp; 0.208 &amp; 0.083 \\\\ 0.278 &amp; 0.611 &amp; 0.111 \\\\ 0.167 &amp; 0.167 &amp; 0.667 \\end{pmatrix}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041e\u0431\u0449\u0430\u044f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/273\/d08\/0c0\/273d080c0128a4b2f7c706cb37e4e7ec.svg\" alt=\"$ D = 1.014 $\" data-tex=\"inline\"><\/math>, \u0430 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/143\/6c0\/785\/1436c0785c2db5011fb22c1021bed73c.svg\" alt=\"$ D_{avg} = 0.338 $\" data-tex=\"inline\"><\/math><br \/>  \u0421\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430 \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c. \u041e\u0431 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0442\u0440\u0435\u0442\u044c\u0438\u043c, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043f\u0435\u0440\u0432\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0447\u0435\u043c \u0441 \u0442\u0440\u0435\u0442\u044c\u0438\u043c. \u0422\u0440\u0435\u0442\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u043b\u0430\u0431\u043e \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f. \u0412\u0441\u0451 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e ChatSessionApplicationService \u043f\u043b\u043e\u0445\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 SRP \u0438, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0441\u043e\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 (\u043a\u0442\u043e \u043d\u0435 \u0432\u0435\u0440\u0438\u0442 \u2014 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0441\u0430\u043c\u0438) \u0432 \u0441\u0438\u043b\u0443 \u0441\u043b\u0430\u0431\u043e\u0439 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438.<\/p>\n<h2>\u0414\u043d\u043e?<\/h2>\n<p>  \u0415\u0434\u0432\u0430 \u043b\u0438. \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u0435\u0434\u0443\u0442\u0441\u044f \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0438 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f SRP, \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u044b\u043c \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430\u043c.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/465507\/\"> https:\/\/habr.com\/ru\/post\/465507\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/465507\/\">\u041f\u0440\u043e <b>\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/b> (The Single Responsibility Principle, SRP) \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0434\u0430\u0451\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u043d\u043e\u0435 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0430\u043b\u043e \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u043e\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D1%80%D0%B8%D0%BD%D1%86%D0%B8%D0%BF_%D0%B5%D0%B4%D0%B8%D0%BD%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%B9_%D0%BE%D1%82%D0%B2%D0%B5%D1%82%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D1%81%D1%82%D0%B8\" rel=\"nofollow\">\u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/a>. \u0410 \u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0447\u0442\u043e \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 SRP \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e \u0432\u0441\u043a\u043e\u043b\u044c\u0437\u044c, \u043d\u0435 \u0430\u043a\u0446\u0435\u043d\u0442\u0438\u0440\u0443\u044f \u043d\u0430 \u043d\u0438\u0445 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043d\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044f \u0442\u0435\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0434\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-298752","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298752"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298752\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}