{"id":174779,"date":"2013-04-12T18:27:03","date_gmt":"2013-04-12T14:27:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=174779"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=174779","title":{"rendered":"<span class=\"post_title\">\u0422\u0435\u0445\u043d\u0438\u043a\u0430: \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 (\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u041c. \u0424\u0430\u0443\u043b\u0435\u0440\u0430)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0430\u0447\u0430\u043b\u043e <a href=\"http:\/\/habrahabr.ru\/post\/169139\/\">\u041a\u043e\u0434 \u0441 \u0434\u0443\u0448\u043a\u043e\u043c<\/a><br \/>  \u0422\u0435\u0445\u043d\u0438\u043a\u0430: <a href=\"http:\/\/habrahabr.ru\/post\/173903\/\">\u0421\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/a><\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438, \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043f\u043e \u043a\u043d\u0438\u0433\u0435 <a href=\"http:\/\/www.ozon.ru\/context\/detail\/id\/1308678\/\">\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433. \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u041c\u0430\u0440\u0442\u0438\u043d \u0424\u0430\u0443\u043b\u0435\u0440.<\/a><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 C#, \u043d\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0434\u0435\u044e, \u0430 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h4>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438<\/h4>\n<p>  <\/p>\n<ol>\n<li> <b>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <\/b>(<i>\u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0442\u0435\u043b\u043e\u043c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0449\u0435 \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/i>).<br \/>   \u041c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0443\u0447\u0448\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class View {     private Shop shop;      private List&lt;User&gt; FilterUsers(List&lt;User&gt; users, decimal koef)     {         List&lt;User&gt; activeUsers = new List&lt;User&gt;();         foreach(User user  in users)         {             if(shop.IsActiveUser(user, koef))             {                 activeUsers.Add(user);             }         }         return activeUsers;     } }  class Shop {     public bool IsActiveUser(User user, decimal koef)     {         decimal rate = 1;         if(koef &gt; 1000)         {             rate  = koef * 1.75;         }         return user.Boss || user.HasDiscount() && rate &gt; 10;     } }  class User {     private bool boss;      public bool Boss     {         get { return boss; }     }          public bool HasDiscount()     {          \/\/ some condition     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class View {     private Shop shop;      private List&lt;User&gt; FilterUsers(List&lt;User&gt; users, decimal koef)     {         List&lt;User&gt; activeUsers = new List&lt;User&gt;();         foreach(User user  in users)         {             if(user.IsActiveUser(koef))             {                 activeUsers.Add(user);             }         }         return activeUsers;     } }  class Shop { }  class User {     private bool boss;      public bool Boss     {         get { return boss; }     }          public bool HasDiscount()     {          \/\/ some condition     }      public bool IsActiveUser(decimal koef)     {         decimal rate = 1;         if(koef &gt; 1000)         {             rate  = koef * 1,75;         }         return Boss || HasDiscount() && rate &gt; 10;     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/b> (<i>\u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435<\/i>).<br \/>   \u041f\u043e\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0443\u0447\u0448\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class Shop {     private decimal rate;     private DiscountType discountType;      public Shop(DiscountType discountType, decimal rate)     {         this.rate = rate;         this.discountType = discountType;     }      public decimal Rate     {         get{ return rate; }         set{ rate = value; }     }      public bool HasDiscount(DateTime from, DateTime to)     {         \/\/ some calculation of flag               return discountType.IsValid(rate) && flag;     }      public decimal GetDiscount(decimal amount, bool fullSum)     {         \/\/ some calculation of koef         return discountType.GetAmount(rate, fullSum) * koef;     } }  class DiscountType {         public bool IsValid(decimal rate)     {         \/\/ some calculation using rate     }      public decimal GetAmount(decimal rate, bool fullSum)     {         \/\/ some calculation using rate     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class Shop {     private DiscountType discountType;      public Shop(DiscountType discountType)     {         this.discountType = discountType;     }      public bool HasDiscount(DateTime from, DateTime to)     {        \/\/ some calculation of flag              return discountType.IsValid() && flag;     }      public decimal GetDiscount(decimal amount, bool fullSum)     {        \/\/ some calculation of koef        return discountType.GetAmount() * koef;     } }  class DiscountType {         private decimal rate;      public DiscountType(decimal rate)     {         this.rate = rate;     }      public decimal Rate     {         get{ return rate; }         set{ rate = value; }     }      public bool IsValid()     {         \/\/ some calculation using rate     }      public decimal GetAmount(bool fullSum)     {         \/\/ some calculation using rate     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430<\/b> (<i>\u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u044f \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043d\u043e\u0432\u044b\u0439<\/i>).<br \/>   \u041a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0439, \u0438\u043d\u0430\u0447\u0435 \u043e\u043d \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 God object.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class User {     private string name;     private string street;     private string city;      public string Name     {         get{ return name; }         set{ name = value; }     }      public string Street     {         get{ return street; }         set{ city = value; }     }      public string City     {         get{ return city; }         set{ city = value; }     }      public string GetAddressInfo()     {         return string.Format(&quot;{0} \\ {1}&quot;, city, street);     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class User {     private string name;     private Address address;      public string Name     {         get{ return name; }         set{ name = value; }     }      public string GetAddressInfo()     {         return address.GetFullAddress();     } }  class Address {     private string city;     private string street;      public string Street     {         get{ return street; }         set{ city = value; }     }      public string City     {         get{ return city; }         set{ city = value; }     }        public string GetFullAddress()     {         return string.Format(&quot;Adress: {0} \\ {1}&quot;, city, street);     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <\/b> (<i>\u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439<\/i>).<br \/>   \u041a\u043b\u0430\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class User {     private string name;     private Address address;      public string Name     {         get{ return name; }         set{ name = value; }     }      public Address GetAddress()     {         return address     } }  class Address {     private string areaCode;     private string country;      public string AreaCode     {         get{ return areaCode; }         set{ areaCode = value; }     }      public string Country     {         get{ return country; }         set{ country = value; }     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class User {     private string name;     private string areaCode;     private string country;      public string AreaCode     {         get{ return areaCode; }         set{ areaCode = value; }     }      public string Country     {         get{ return country; }         set{ country = value; }     }     public string Name     {         get{ return name; }         set{ name = value; }     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0421\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <\/b> (<i>\u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/i>).<br \/>   \u0418\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u044f, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class View {     private void Init()     {         \/\/ some code        User manager = currentUser.Office.Manager;     } }  class User {     private Department department;      public Department Office     {         get{ return department; }         set{ department = value; }     } }  class Department {     private User manager;      public Department(User manager)     {         this.manager = manager;     }      public User Manager         {         get{ return manager; }     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class View {     private void Init()     {         \/\/ some code        User manager = currentUser.Manager;     } }  class User {     private Department department;      public User Manager         {         get{ return department.Manager; }     } }  class Department {     private User manager;      public Department(User manager)     {         this.manager = manager;     }      public User Manager         {         get{ return manager; }     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430 <\/b> (<i>\u0437\u0430\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0443 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e<\/i>).<br \/>   \u041a\u043b\u0430\u0441\u0441 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0437\u0430\u043d\u044f\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class View {     private void Init()     {         \/\/ some code        User manager = currentUser.Manager;        decimal rate = currentUser.Rate;     } }  class User {     private Department department;     private UserType userType;      public User Manager         {         get{ return department.Manager; }     }     public decimal Rate        {         get{ return userType.Rate; }     } }  class Department {     private User manager;      public User Manager         {         get{ return manager; }     } }  class UserType {     private decimal rate;      public decimal Rate     {         get{ return rate; }     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class View {     private void Init()     {         \/\/ some code        User manager = currentUser.Office.Manager;        decimal rate = currentUser.Type.Rate;     } }  class User {     private Department department;     private UserType userType;      public Department Office     {         get{ return department; }     }     public UserType Type         {         get{ return userType; }     } }  class Department {     private User manager;      public User Manager         {         get{ return manager; }     } }  class UserType {     private decimal rate;      public decimal Rate     {         get{ return rate; }     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <\/b> (<i>\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 1-\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/i>).<br \/>   \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">class View {     private string GetUserName()     {         \/\/ some code        return &quot;\\&quot;&quot; + userName + &quot;\\&quot;&quot;;     }       private string GetCompanyName()     {         \/\/ some code        return &quot;\\&quot;&quot; + companyName + &quot;\\&quot;&quot;;     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class View {     private string GetUserName()     {         \/\/ some code        return userName.InDoubleQuote();     }       private string GetCompanyName()     {         \/\/ some code        return companyName.InDoubleQuote();     } }  static class StringExtension {     public static string InDoubleQuote(this string str)     {        return &quot;\\&quot;&quot; + str + &quot;\\&quot;&quot;;     } } <\/code><\/pre>\n<p>  <\/li>\n<li> <b>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <\/b> (<i>\u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 (\u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f) \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438<\/i>).<br \/>   \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430.<br \/>  <b>From<\/b><br \/> \n<pre><code class=\"cs\">sealed class Account {     public decimal CalculateSum()     {         \/\/ calculation summ        return summ;     } } <\/code><\/pre>\n<p>  <b>To<\/b>  <\/p>\n<pre><code class=\"cs\">class ImportantAccount {     private Account account;      public decimal CalculateMaxSum()     {         \/\/ calculation rate        return account.CalculateSum() * rate;     } } <\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u041a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432 (\u0432 \u0440\u0430\u043c\u043a\u0430\u0445 Review).<\/h4>\n<p>  \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0432\u0441\u0451 \u0441\u043f\u043e\u0440\u044b\/\u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 review-\u0435\u0440\u043e\u043c \u0438 comitt-\u0435\u0440\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:  <\/p>\n<ul>\n<li>\u041a\u043e\u043b\u043b\u0435\u0433\u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u044e\u0442 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442.\u043a. \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0440\u0430\u0437\u043d\u043e\u0433\u043b\u0430\u0441\u0438\u0435 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0412\u0441\u0451 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043e\u043d\u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u0431\u0449\u0435\u0435 \u0434\u0435\u043b\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (10%).<\/li>\n<li>\u041a\u043e\u043b\u043b\u0435\u0433\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0431\u043e\u043b\u0442\u0430\u0442\u044c: \u043f\u044f\u0442\u043d\u0438\u0446\u0430, \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043d\u0435\u0434\u0435\u043b\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0415\u0441\u0442\u044c \u0438 \u0442\u0430\u043a\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u043b\u044e\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u0440\u0435\u0449\u0430\u0442\u044c. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u044d\u0442\u043e \u043d\u0435 \u043b\u0438\u0448\u0435\u043d\u043e \u0437\u0434\u0440\u0430\u0432\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u0442.\u043a. \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u044d\u0442\u043e \u0437\u0434\u043e\u0440\u043e\u0432\u043e (10%).<\/li>\n<li>\u0421\u043f\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u043d\u043e\u0432\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0432 .NET \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <b>var<\/b> \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u0433 \u0441\u0442\u0430\u043b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0437\u0434\u0435, \u043a\u0442\u043e-\u0442\u043e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0440\u0435\u0432\u044c\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u0441\u043f\u043e\u0440\u044b, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (10%).<br \/> \n<pre><code class=\"cs\">\/\/ \u0435\u0441\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u0441 \u043f\u0440\u0430\u0432\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e \u0442\u0440\u0430\u043a\u0442\u0443\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c var var users = new List&lt;User&gt;(); var departments = user.Departmens.Cast&lt;Department&gt;();  \/\/ \u043f\u043b\u043e\u0445\u043e var users = departments.Select(d =&gt; d.User).Where(u =&gt; !u.Deleted); var departments = service.GetNotDeletedDepartments(); <\/code><\/pre>\n<p>  <\/li>\n<li>\u0416\u0430\u0440\u043a\u0438\u0435 \u0441\u043f\u043e\u0440\u044b \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u044c\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043b\u0443\u0447\u0448\u0435. \u0418 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u0441\u0442\u0440\u0430\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u0433\u043e\u0440\u0430\u0442\u044c\u0441\u044f. \u041f\u0440\u0438\u0447\u0451\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u043f\u043e\u0440\u044b, \u043b\u0438\u0448\u044c \u0442\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u043a\u0440\u0443\u0442\u044b\u043c\u0438 (70%). \u0422\u0443\u0442 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0434\u0430\u0442\u044c \u0441\u043e\u0432\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u0432\u044f\u0437\u0430\u043b\u0438\u0441\u044c \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0440, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0435 \u043b\u0438\u0447\u043d\u043e\u0441\u0442\u0438. \u0418 \u0444\u0440\u0430\u0437\u0443 <i>\u00ab\u0422\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u00bb<\/i>, \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 <i>\u00ab\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u043e \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0442\u043e\u0447\u043a\u0443 \u0437\u0440\u0435\u043d\u0438\u044f\u00bb<\/i>. \u0422.\u0435. \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0430 \u043d\u0435 \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u0433\u0438.\n<p>  \u0417\u0430\u0431\u0430\u0432\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438:<br \/>  1) Review-\u0435\u0440 \u2014 \u00ab\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0434\u00bb<br \/>  Commiter \u2014 \u00ab\u0442\u0435\u0431\u0435 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0442\u044b \u0438 \u043f\u0440\u0430\u0432\u044c\u00bb\/\u00ab\u0442\u044b \u043d\u0430\u0448\u0451\u043b \u0442\u044b \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0439\u00bb<\/p>\n<p>  2) \u0418\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e  <\/p>\n<pre><code class=\"cs\">void Method() { ...     if(flag)         koef = GetMaxRate(); ... } <\/code><\/pre>\n<p>  <b>\u0438\u043b\u0438<\/b>  <\/p>\n<pre><code class=\"cs\">void Method() { ...     if(flag)     {         koef = GetMaxRate();     } ... } <\/code><\/pre>\n<p>  <\/li>\n<\/ul>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u00ab\u0422\u0435\u0445\u043d\u0438\u043a\u0430: \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445\u00bb.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/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=\"http:\/\/habrahabr.ru\/post\/174779\/\"> http:\/\/habrahabr.ru\/post\/174779\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0430\u0447\u0430\u043b\u043e <a href=\"http:\/\/habrahabr.ru\/post\/169139\/\">\u041a\u043e\u0434 \u0441 \u0434\u0443\u0448\u043a\u043e\u043c<\/a><br \/>  \u0422\u0435\u0445\u043d\u0438\u043a\u0430: <a href=\"http:\/\/habrahabr.ru\/post\/173903\/\">\u0421\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432<\/a><\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438, \u0442\u0435\u0445\u043d\u0438\u043a\u0430 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043f\u043e \u043a\u043d\u0438\u0433\u0435 <a href=\"http:\/\/www.ozon.ru\/context\/detail\/id\/1308678\/\">\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433. \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u041c\u0430\u0440\u0442\u0438\u043d \u0424\u0430\u0443\u043b\u0435\u0440.<\/a>  <\/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-174779","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174779","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=174779"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/174779\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}