{"id":305368,"date":"2020-06-15T15:01:32","date_gmt":"2020-06-15T15:01:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305368"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305368","title":{"rendered":"\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506736\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" width=\"400\" src=\"https:\/\/habrastorage.org\/webt\/ht\/bc\/ds\/htbcds3dl1emxblkn29nn5cqr0w.png\"><\/div>\n<p>\u041f\u043e\u0436\u0430\u043b\u0443\u0439 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b SOLID, \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0435 \u0432\u0438\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u043e\u0447\u0442\u0435\u043d\u0438\u0439. \u042f \u043d\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u0430\u0442\u044c \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u201c\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435\u201d. \u041d\u043e \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043c\u044b\u0441\u043b\u044f\u043c\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435, \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435. \u0412\u043f\u043b\u043e\u0442\u044c \u0434\u043e 1.<\/p>\n<p>  \u0412 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043c\u043e\u0438 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u0440\u0435\u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0434 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041a\u043b\u0430\u0441\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u043e\u043b\u044f\u043d\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0445 \u0441\u0445\u043e\u0436\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438!<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u043e\u0441\u043b\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438 \u041e\u041e\u041f \u043d\u043e\u0432\u0438\u0447\u043a\u0438 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u043a\u043e\u0448\u0435\u0447\u043a\u0430\u043c\u0438 \u0438 \u0441\u043e\u0431\u0430\u0447\u043a\u0430\u043c\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u043c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u0440\u0430 \u0438\u043b\u0438 \u043d\u0435\u043a\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438. \u0418 \u044d\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0435 \u043c\u043d\u0435\u043d\u0438\u0435 \u043e\u0431 \u041e\u041e\u041f, \u0442\u043e\u0447\u043d\u0435\u0435 \u0447\u0435\u043c \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u043e\u0447\u043a\u0438 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0443\u0448\u0438\u0442\u0441\u044f. \u0412 \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437\u0435 \u043f\u0440\u0430\u0432\u044f\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0430\u043d\u0435\u043c\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438. \u041d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043b\u043e\u0445\u043e \u044d\u0442\u043e \u0438\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u0441\u0442\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0439 \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0438\u0440\u043e\u043c, \u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u043c\u0443 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u044e. \u0427\u0430\u0441\u0442\u043e \u0438\u0445 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0447\u0430\u0441\u0442\u043e \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0441\u043b\u043e\u0438. \u0418 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u2014 \u0433\u0440\u0443\u043f\u043f\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u043f\u043e\u0445\u043e\u0436\u0438\u043c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c. \u0418\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0418\u043b\u0438 \u0435\u0449\u0451 \u0441 \u0447\u0435\u043c-\u0442\u043e \u201c\u043f\u043e\u0445\u043e\u0436\u0438\u043c\u201d.<\/p>\n<p>  \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441, \u044f \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u044e \u043d\u0430\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c\u2026 \u0411\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0435 AnotherEntityService \u0441\u043d\u043e\u0432\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430. \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u0443\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e? \u041a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u043b\u044f\u043d\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432? \u041a\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043e\u0434\u043d\u0438\u043c \u0440\u0430\u0437\u043e\u043c?<\/p>\n<p>  \u041c\u0435\u043d\u044f \u0434\u043e\u043b\u0433\u043e \u043d\u0435 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043e\u0442 \u0434\u044f\u0434\u044e\u0448\u043a\u0438 \u0411\u043e\u0431\u0430 [\u0427\u0438\u0441\u0442\u044b\u0439 \u041a\u043e\u0434, \u0441\u0442\u0440. 177]:<\/p>\n<pre><code class=\"plaintext\">class Sql {     constructor(private table: string, private columns: Column[]) {}      public create(): string;     public insert(fields: object[]): string;     public selectAll(): string;     public select(criteria: Criteria): string;      \/\/ ... } <\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u041a\u043b\u0430\u0441\u0441 Sql \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b\u2026 \u0414\u0432\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 Sql \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0435\u0434\u0438\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438.  <\/p><\/blockquote>\n<p>\u0412\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<pre><code class=\"plaintext\">abstract class Sql {     constructor(private table: string, private columns: Column[]) {}      public abstract generate(): string; }  class CreateSql extends Sql {     public generate(): string; }  class SelectSql extends Sql {     public generate(): string; }  \/\/ ... <\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>\u041a\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u043e \u0441\u043c\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c. \u0412\u0440\u0435\u043c\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0434\u043e \u043d\u0443\u043b\u044f. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430\u0440\u0443\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0434\u0440\u0443\u0433\u043e\u0439, \u043d\u0438\u0447\u0442\u043e\u0436\u043d\u043e \u043c\u0430\u043b\u0430. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u0441\u0435\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043b\u043e\u0433\u0438\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<p>  \u0427\u0442\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0451\u0442 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b Update, \u0432\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432!  <\/p><\/blockquote>\n<p> \u0412 \u0427\u041a \u043d\u0435 \u0440\u0430\u0437 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u043c\u0438. \u041d\u043e \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0434\u0443\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u043a\u043e\u0439, \u0438 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u0440\u044f\u0441\u043d\u044b\u0439!<\/p>\n<p>  \u042f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u044e\u0441\u043e\u0432, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u0434\u0443\u0442\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0437\u0434\u0440\u043e\u0431\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443? (\u0410 \u0424\u041f-\u0448\u043d\u0438\u043a\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u0443\u044e\u0442?) \u0418\u043b\u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0442\u043e\u043b\u0441\u0442\u044f\u043a\u043e\u0432-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f \u043f\u043e\u0441\u044b\u043f\u043b\u0435\u0442\u0441\u044f \u043d\u0430\u0440\u0443\u0436\u0443? \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0435\u043c\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u0430\u0439\u043d\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<p>  \u0427\u0442\u043e \u0434\u0430\u0451\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u043e\u0442\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u043e\u043c\u0430\u043d\u0442\u0438\u043a\u0443? \u0423 \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u2014 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u042d\u0442\u043e \u0440\u043e\u043c\u0430\u043d\u0442\u0438\u043a\u0430.<\/p>\n<p>  \u041d\u043e \u0435\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0430\u0433\u043c\u0430\u0442\u0438\u0447\u043d\u043e, \u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u043d\u0430\u0431\u043e\u0440 \u0442\u043e\u0440\u0447\u0430\u0449\u0438\u0445 (\u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445) \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>  \u0418 \u044d\u0442\u043e \u0442\u0451\u043c\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u2014 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0412\u043e\u0442 \u0447\u0435\u043c \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435. \u041f\u043e\u0440\u043e\u0439 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0447\u043b\u0435\u043d\u044b, \u0442\u043e \u044d\u0442\u043e \u043b\u0443\u0447\u0448\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430! \u0418 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0445\u0440\u0430\u043d\u0438\u0442\u0435\u043b\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u044d\u0442\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f.<\/p>\n<p>  \u0421 \u043a\u0430\u043a\u0438\u0445 \u043f\u043e\u0440 \u043e\u0431\u0449\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c? \u041f\u043e\u0445\u043e\u0436\u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u201c\u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b\u201d \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u044b \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044e, SRP, OCP \u0438 ISP. \u041d\u043e \u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0441\u044c.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439, \u0430 \u043b\u0438\u0448\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0449\u0438\u043d\u044b. \u041f\u0440\u0438\u0447\u0435\u043c \u0445\u0443\u0434\u0448\u0443\u044e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0441\u0435\u0432\u0434\u043e-\u043e\u0431\u043e\u0431\u0449\u0430\u044e\u0449\u0438\u0445 \u0438\u043c\u0435\u043d \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u043d\u0435 \u0442\u044f\u043d\u0443\u0442 \u0441\u0435\u0431\u0435 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. (\u0413\u0434\u0435-\u0442\u043e \u0437\u043b\u043e\u0440\u0430\u0434\u0441\u0442\u0432\u0443\u044e\u0442 \u0424\u041f\u0448\u043d\u0438\u043a\u0438).<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Angular.<\/p>\n<pre><code class=\"javascript\">@Injectable({ providedIn: 'root' }) export class HeroService {  private heroesUrl = 'api\/heroes';  private httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application\/json' }) };    constructor(private http: HttpClient, private messageService: MessageService) {}    getHero(id: number): Observable&lt;Hero&gt; {    const url = `${this.heroesUrl}\/${id}`;    return this.http.get&lt;Hero&gt;(url).pipe(      tap((_) =&gt; this.log(`fetched hero id=${id}`)),      catchError(this.handleError&lt;Hero&gt;(`getHero id=${id}`)),    );  }    addHero(hero: Hero): Observable&lt;Hero&gt; {    return this.http.post&lt;Hero&gt;(this.heroesUrl, hero, this.httpOptions).pipe(      tap((newHero: Hero) =&gt; this.log(`added hero w\/ id=${newHero.id}`)),      catchError(this.handleError&lt;Hero&gt;('addHero')),    );  }    \/\/ ...    private handleError&lt;T&gt;(operation = 'operation', result?: T) {    return (error: any): Observable&lt;T&gt; =&gt; {      \/\/ TODO: send the error to remote logging infrastructure      console.error(error); \/\/ log to console instead      \/\/ TODO: better job of transforming error for user consumption      this.log(`${operation} failed: ${error.message}`);      return of(result as T);    };  } } <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">HeroService \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">@Injectable({ providedIn: 'root' }) export class HeroService {    private heroesUrl = 'api\/heroes';  \/\/ URL to web api    httpOptions = {    headers: new HttpHeaders({ 'Content-Type': 'application\/json' })  };    constructor(    private http: HttpClient,    private messageService: MessageService) { }    \/** GET heroes from the server *\/  getHeroes(): Observable&lt;Hero[]&gt; {    return this.http.get&lt;Hero[]&gt;(this.heroesUrl)      .pipe(        tap(_ =&gt; this.log('fetched heroes')),        catchError(this.handleError&lt;Hero[]&gt;('getHeroes', []))      );  }    \/** GET hero by id. Will 404 if id not found *\/  getHero(id: number): Observable&lt;Hero&gt; {    const url = `${this.heroesUrl}\/${id}`;    return this.http.get&lt;Hero&gt;(url).pipe(      tap(_ =&gt; this.log(`fetched hero id=${id}`)),      catchError(this.handleError&lt;Hero&gt;(`getHero id=${id}`))    );  }    \/* GET heroes whose name contains search term *\/  searchHeroes(term: string): Observable&lt;Hero[]&gt; {    if (!term.trim()) {      \/\/ if not search term, return empty hero array.      return of([]);    }    return this.http.get&lt;Hero[]&gt;(`${this.heroesUrl}\/?name=${term}`).pipe(      tap(x =&gt; x.length ?         this.log(`found heroes matching &quot;${term}&quot;`) :         this.log(`no heroes matching &quot;${term}&quot;`)),      catchError(this.handleError&lt;Hero[]&gt;('searchHeroes', []))    );  }    \/\/\/\/\/\/\/\/ Save methods \/\/\/\/\/\/\/\/\/\/    \/** POST: add a new hero to the server *\/  addHero(hero: Hero): Observable&lt;Hero&gt; {    return this.http.post&lt;Hero&gt;(this.heroesUrl, hero, this.httpOptions).pipe(      tap((newHero: Hero) =&gt; this.log(`added hero w\/ id=${newHero.id}`)),      catchError(this.handleError&lt;Hero&gt;('addHero'))    );  }    \/** DELETE: delete the hero from the server *\/  deleteHero(hero: Hero | number): Observable&lt;Hero&gt; {    const id = typeof hero === 'number' ? hero : hero.id;    const url = `${this.heroesUrl}\/${id}`;      return this.http.delete&lt;Hero&gt;(url, this.httpOptions).pipe(      tap(_ =&gt; this.log(`deleted hero id=${id}`)),      catchError(this.handleError&lt;Hero&gt;('deleteHero'))    );  }    \/** PUT: update the hero on the server *\/  updateHero(hero: Hero): Observable&lt;any&gt; {    return this.http.put(this.heroesUrl, hero, this.httpOptions).pipe(      tap(_ =&gt; this.log(`updated hero id=${hero.id}`)),      catchError(this.handleError&lt;any&gt;('updateHero'))    );  }    \/**   * Handle Http operation that failed.   * Let the app continue.   * @param operation - name of the operation that failed   * @param result - optional value to return as the observable result   *\/  private handleError&lt;T&gt;(operation = 'operation', result?: T) {    return (error: any): Observable&lt;T&gt; =&gt; {        \/\/ TODO: send the error to remote logging infrastructure      console.error(error); \/\/ log to console instead        \/\/ TODO: better job of transforming error for user consumption      this.log(`${operation} failed: ${error.message}`);        \/\/ Let the app keep running by returning an empty result.      return of(result as T);    };  }    \/** Log a HeroService message with the MessageService *\/  private log(message: string) {    this.messageService.add(`HeroService: ${message}`);  } } <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441. (\u042f \u0431\u044b \u0434\u0430\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b \u201c\u0431\u0435\u0441\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0441\u201d). \u0418 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u0441\u0451 \u0441 \u043d\u0438\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. HeroService \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 Hero \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438, \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e. \u041c\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e! \u041d\u0438 \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043e \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044f\u043c\u0438.<\/p>\n<p>  \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0410\u041f\u0418 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f Hero? \u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e, \u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441? \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438. \u041d\u043e \u0441\u0430\u043c\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u0443\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043f\u043e\u0434\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044f \u0438\u0445 \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435, \u0430 \u043d\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u201c\u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438\u201d \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0432 HeroService, \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<ul>\n<li>\u0412\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u043c url \u2014 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 BASE_HERO_API_URL.<\/li>\n<li>\u0427\u0430\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 http-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438 \u2014 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u0441\u0435\u043f\u0442\u043e\u0440. \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 HttpClient, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0440\u043d\u0451\u0442 \u043c\u0435\u0442\u043e\u0434\u044b get, post, put, delete \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u043e\u043f\u0446\u0438\u044f\u043c\u0438.<\/li>\n<li>handleError \u2014 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u0442 \u043d\u0430 \u0440\u043e\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0448\u0438\u0431\u043e\u043a.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u044b \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u043d\u0435 \u0431\u0443\u0434\u044c \u043d\u0430 \u0442\u043e \u0432\u043e\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432. \u0412\u043d\u0435\u0448\u043d\u0438\u0445 \u043f\u0440\u0438\u0447\u0438\u043d \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u043e. \u041c\u044b \u043f\u0438\u0448\u0435\u043c \u0432\u0435\u0431, \u0438 \u044d\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 \u0441\u043f\u0435\u0440\u0432\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 addHero, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e HeroService.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043a\u0430\u0436\u0438 \u043c\u043d\u0435 \u043a\u043e\u0434!<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">@Injectable({ providedIn: 'root' }) export class GetHeroesOperation {  constructor(    private http: HeroHttpClient,    private messageService: MessageService,    private errorHandler: ErrorHandler,  ) {}    execute(): Observable&lt;Hero[]&gt; {    return this.http.get&lt;Hero[]&gt;().pipe(      tap((_) =&gt; this.messageService.add('fetched heroes')),      catchError(this.errorHandler.handleError&lt;Hero[]&gt;('getHeroes', [])),    );  } }   @Injectable({ providedIn: 'root' }) export class AddHeroOperation {  constructor(    private http: HeroHttpClient,    private messageService: MessageService,    private errorHandler: ErrorHandler,  ) {}    execute(hero: Hero): Observable&lt;Hero&gt; {    return this.http.post&lt;Hero&gt;('', hero).pipe(      tap((newHero: Hero) =&gt; this.logAddedHero(newHero)),      catchError(this.errorHandler.handleError&lt;Hero&gt;('addHero')),    );  }    private logAddedHero(newHero: Hero): void {    return this.messageService.add(`AddHeroOperation: added hero w\/ id=${newHero.id}`);  } }   @Injectable({ providedIn: 'root' }) export class ErrorHandler {  constructor(private messageService: MessageService) {}    handleError&lt;T&gt;(operation: string, result?: T) {    return (error: any): Observable&lt;T&gt; =&gt; {      \/\/ TODO: send the error to remote logging infrastructure      console.error(error); \/\/ log to console instead        \/\/ TODO: better job of transforming error for user consumption      this.messageService.add(`${operation} failed: ${error.message}`);        \/\/ Let the app keep running by returning an empty result.      return of(result as T);    };  } }   @Injectable({ providedIn: 'root' }) export class HeroHttpClient {  private httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application\/json' }) };    constructor(@Inject(BASE_HERO_API_URL) private baseUrl: string, private http: HttpClient) {}    get&lt;T&gt;(endpoint = ''): Observable&lt;T&gt; {    return this.http.get&lt;T&gt;(this.getUrl(endpoint));  }    private getUrl(endpoint: string): string {    return Location.joinWithSlash(this.baseUrl, endpoint);  }    post&lt;T&gt;(endpoint = '', data: unknown): Observable&lt;T&gt; {    return this.http.post&lt;T&gt;(this.getUrl(endpoint), data, this.httpOptions);  }    put&lt;T&gt;(endpoint = '', data: unknown): Observable&lt;T&gt; {    return this.http.put&lt;T&gt;(this.getUrl(endpoint), data, this.httpOptions);  }    delete&lt;T&gt;(endpoint = ''): Observable&lt;T&gt; {    return this.http.delete&lt;T&gt;(this.getUrl(endpoint), this.httpOptions);  } }   <\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u042f \u043d\u0435 \u043f\u044b\u0442\u0430\u044e\u0441\u044c (\u0438 \u043d\u0435 \u0445\u043e\u0447\u0443) \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0439, \u0442\u0438\u043f\u0430: \u201c\u0423 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 1-\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430!\u201d. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0432 \u0441\u0438\u043b\u0443 \u0432\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u0422\u0430\u043a \u0436\u0435 \u044f \u043d\u0435 \u043f\u0440\u043e\u0442\u0438\u0432 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043b\u0430\u0441\u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e: isExecutable, validateParams, execute.<\/p>\n<p>  \u0422\u043e \u0447\u0442\u043e \u044f \u0433\u043e\u0432\u043e\u0440\u044e, \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432-\u043c\u043e\u043d\u0441\u0442\u0440\u043e\u0432. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u0418 \u043b\u0443\u0447\u0448\u0435 \u0431\u044b \u0430\u043a\u0446\u0435\u043d\u0442 \u0441\u043c\u0435\u0449\u0430\u043b\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0438\u0445 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0441\u0435\u0431\u044f \u044f \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f:<\/p>\n<p>  <b>\u041a\u043b\u0430\u0441\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0445 \u0441\u0445\u043e\u0436\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/b><\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044f \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443, \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c OCP \u0438 ISP \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435. \u041a\u043e\u0433\u0434\u0430 \u0432\u0430\u0448\u0438 \u0444\u0438\u0447\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0430 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u0432 10 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0432 10 \u0441\u043b\u043e\u044f\u0445.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c. \u0421\u043f\u0430\u0441\u0438\u0431\u043e! \u041f\u043e\u043a\u0430!<\/p><\/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\/506736\/\"> https:\/\/habr.com\/ru\/post\/506736\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506736\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" width=\"400\" src=\"https:\/\/habrastorage.org\/webt\/ht\/bc\/ds\/htbcds3dl1emxblkn29nn5cqr0w.png\"><\/div>\n<p>\u041f\u043e\u0436\u0430\u043b\u0443\u0439 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b SOLID, \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0435 \u0432\u0438\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u043e\u0447\u0442\u0435\u043d\u0438\u0439. \u042f \u043d\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u0430\u0442\u044c \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u201c\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435\u201d. \u041d\u043e \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043c\u044b\u0441\u043b\u044f\u043c\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435, \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435. \u0412\u043f\u043b\u043e\u0442\u044c \u0434\u043e 1.<\/p>\n<p>  \u0412 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043c\u043e\u0438 \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 (\u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0435\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u0440\u0435\u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0434 \u043b\u044e\u0431\u044b\u043c\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041a\u043b\u0430\u0441\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u043e\u043b\u044f\u043d\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0438\u0445 \u0441\u0445\u043e\u0436\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438!  <\/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-305368","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305368","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=305368"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305368\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}