{"id":280929,"date":"2016-11-14T16:15:03","date_gmt":"2016-11-14T13:15:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280929"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280929","title":{"rendered":"\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u041f\u043e\u0441\u0430\u0434\u043a\u0430"},"content":{"rendered":"<p><a href=\"https:\/\/habrahabr.ru\/post\/314958\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/147\/222\/882\/1472228826b441d2b4bc5a64978d996f.png\"\/><\/a><\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u0430 \u0432 <a href=\"https:\/\/habrahabr.ru\/post\/314536\/\">\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438<\/a>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>Monolithic Repositories \u2014 <strong>MonoRepo<\/strong> <em>(\u041c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438)<\/em><\/li>\n<li>Command\/Query Responsibility Segregation \u2014 <strong>CQRS<\/strong> <em>(\u0421\u0435\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c)<\/em><\/li>\n<li>Event Sourcing \u2014 <strong>ES<\/strong> <em>(\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a)<\/em><\/li>\n<li>Test Driven Development \u2014 <strong>TDD<\/strong> <em>(\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435)<\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><a href=\"https:\/\/habrahabr.ru\/post\/314536\/\">\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/314544\/\">\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/a><br \/>  \u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u041f\u043e\u0441\u0430\u0434\u043a\u0430<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/314544\/\">\u043f\u0430\u043a\u0435\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<blockquote><p>\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0437\u0435\u043c\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (<code>X<\/code> \u0438 <code>Y<\/code>, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438) \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>north<\/code>, <code>east<\/code>, <code>west<\/code> \u0438\u043b\u0438 <code>south<\/code>).<a name=\"habracut\"><\/a><\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"uproschaem-command-bus-_komandnaya-shina_\">\u0423\u043f\u0440\u043e\u0449\u0430\u0435\u043c Command Bus <em>(\u041a\u043e\u043c\u0430\u043d\u0434\u043d\u0430\u044f \u0428\u0438\u043d\u0430)<\/em><\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/gnugat.github.io\/2016\/05\/11\/towards-cqrs-command-bus.md\">\u041f\u0430\u0442\u0442\u0435\u0440\u043d Command Bus<\/a> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043a\u043b\u0430\u0441\u0441 <code>Command<\/code>, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0438\u0439 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>LandRover<\/code>)<\/li>\n<li>\u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 \u043d\u0438\u043c (\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043e\u0434\u0438\u043d \u043a \u043e\u0434\u043d\u043e\u043c\u0443) <code>CommandHandler<\/code>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u043a\u0443 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<li><code>CommandBus<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 <code>CommandHandler<\/code>, \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 <code>Middleware<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u0430, \u043e\u043f\u0443\u0441\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441 <code>CommandBus<\/code>, \u0442.\u043a. \u043d\u0430\u043c \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <code>middleware<\/code> \u0438\u043b\u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 <code>CommandHandler<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 <code>Command<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <code>Command<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">cd packages\/navigation git checkout -b 2-landing<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"prizemlenie\">\u041f\u0440\u0438\u0437\u0435\u043c\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f <code>LandRover<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"http:\/\/www.phpspec.net\/en\/stable\/\">phpspec<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec describe 'MarsRover\\Navigation\\LandRover'<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>spec\/MarsRover\/Navigation\/LandRoverSpec.php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace spec\\MarsRover\\Navigation;  use MarsRover\\Navigation\\LandRover; use PhpSpec\\ObjectBehavior; use Prophecy\\Argument;  class LandRoverSpec extends ObjectBehavior {     function it_is_initializable()     {         $this-&gt;shouldHaveType(LandRover::class);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace spec\\MarsRover\\Navigation;  use PhpSpec\\ObjectBehavior;  class LandRoverSpec extends ObjectBehavior {     const X = 23;     const Y = 42;     const ORIENTATION = 'north';      function it_has_x_coordinate()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getX()-&gt;shouldBe(self::X);     }      function it_has_y_coordinate()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getY()-&gt;shouldBe(self::Y);     }      function it_has_an_orientation()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getOrientation()-&gt;shouldBe(self::ORIENTATION);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec run<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c <code>src\/MarsRover\/Navigation\/LandRover.php<\/code> \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace MarsRover\\Navigation;  class LandRover {     private $argument1;      private $argument2;      private $argument3;      public function __construct($argument1, $argument2, $argument3)     {         $this-&gt;argument1 = $argument1;         $this-&gt;argument2 = $argument2;         $this-&gt;argument3 = $argument3;     }      public function getX()     {     }      public function getY()     {     }      public function getOrientation()     {     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0435\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace MarsRover\\Navigation;  class LandRover {     private $x;     private $y;     private $orientation;      public function __construct($x, $y, $orientation)     {         $this-&gt;x = $x;         $this-&gt;y = $y;         $this-&gt;orientation = $orientation;     }      public function getX() : int     {         return $this-&gt;x;     }      public function getY() : int     {         return $this-&gt;y;     }      public function getOrientation() : string     {         return $this-&gt;orientation;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043d\u043e\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0435\u0441\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec run<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0437\u0435\u043b\u0435\u043d\u044b\u0435! \u041d\u043e \u043d\u0430\u0448\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u043c\u044b \u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace spec\\MarsRover\\Navigation;  use PhpSpec\\ObjectBehavior;  class LandRoverSpec extends ObjectBehavior {     const X = 23;     const Y = 42;     const ORIENTATION = 'north';      function it_has_x_coordinate()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getX()-&gt;shouldBe(self::X);     }      function it_cannot_have_non_integer_x_coordinate()     {         $this-&gt;beConstructedWith(             'Nobody expects the Spanish Inquisition!',             self::Y,             self::ORIENTATION         );          $this-&gt;shouldThrow(             \\InvalidArgumentException::class         )-&gt;duringInstantiation();     }      function it_has_y_coordinate()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getY()-&gt;shouldBe(self::Y);     }      function it_cannot_have_non_integer_y_coordinate()     {         $this-&gt;beConstructedWith(             self::X,             'No one expects the Spanish Inquisition!',             self::ORIENTATION         );          $this-&gt;shouldThrow(             \\InvalidArgumentException::class         )-&gt;duringInstantiation();     }      function it_has_an_orientation()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             self::ORIENTATION         );          $this-&gt;getOrientation()-&gt;shouldBe(self::ORIENTATION);     }      function it_cannot_have_a_non_cardinal_orientation()     {         $this-&gt;beConstructedWith(             self::X,             self::Y,             'A hareng!'         );          $this-&gt;shouldThrow(             \\InvalidArgumentException::class         )-&gt;duringInstantiation();     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec run<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043d\u0438 \u043f\u0430\u0434\u0430\u044e\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"php\">namespace MarsRover\\Navigation;  class LandRover {     const VALID_ORIENTATIONS = ['north', 'east', 'west', 'south'];      private $x;     private $y;     private $orientation;      public function __construct($x, $y, $orientation)     {         if (false === is_int($x)) {             throw new \\InvalidArgumentException(                 'X coordinate must be an integer'             );         }         $this-&gt;x = $x;         if (false === is_int($y)) {             throw new \\InvalidArgumentException(                 'Y coordinate must be an integer'             );         }         $this-&gt;y = $y;         if (false === in_array($orientation, self::VALID_ORIENTATIONS, true)) {             throw new \\InvalidArgumentException(                 'Orientation must be one of: '                 .implode(', ', self::VALID_ORIENTATIONS)             );         }         $this-&gt;orientation = $orientation;     }      public function getX() : int     {         return $this-&gt;x;     }      public function getY() : int     {         return $this-&gt;y;     }      public function getOrientation() : string     {         return $this-&gt;orientation;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0441\u043d\u043e\u0432\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0435\u0441\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec run<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u0438! \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">git add -A git commit -m '2: Created LandRover'<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u0430\u0433\u0438 \u0432 <strong>TDD<\/strong>: \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u044b, \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u0434, \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>phpspec<\/code> \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u044d\u0442\u0438 \u0442\u0435\u0441\u0442\u044b \u0432 \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435 (\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u043c\u0435\u043d\u0443\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439), \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u043c\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f! <code>phpspec<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u0445 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">vendor\/bin\/phpspec run --format=pretty<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">MarsRover\\Navigation\\LandRover    13   has x coordinate   24   cannot have non integer x coordinate   37   has y coordinate   48   cannot have non integer y coordinate   61   has an orientation   72   cannot have a non cardinal orientation  1 specs 6 examples (6 passed) 10ms<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>: <code>navigation<\/code>-\u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u0437 MonoRepo:  <\/p>\n<pre><code class=\"bash\">cd ..\/..\/ composer update --optimize-autoloader vendor\/bin\/phpspec run<\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"chto-dalshe\">\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043c \u0446\u0438\u043a\u043b <strong>TDD<\/strong> \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u043e\u043c <code>LandRover<\/code>: \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043c <code>x<\/code> \u0438 <code>y<\/code> \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\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:\/\/habrahabr.ru\/post\/314958\/\"> https:\/\/habrahabr.ru\/post\/314958\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/habrahabr.ru\/post\/314958\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/147\/222\/882\/1472228826b441d2b4bc5a64978d996f.png\"\/><\/a><\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u0430 \u0432 <a href=\"https:\/\/habrahabr.ru\/post\/314536\/\">\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438<\/a>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>Monolithic Repositories \u2014 <strong>MonoRepo<\/strong> <em>(\u041c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438)<\/em><\/li>\n<li>Command\/Query Responsibility Segregation \u2014 <strong>CQRS<\/strong> <em>(\u0421\u0435\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c)<\/em><\/li>\n<li>Event Sourcing \u2014 <strong>ES<\/strong> <em>(\u0421\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a)<\/em><\/li>\n<li>Test Driven Development \u2014 <strong>TDD<\/strong> <em>(\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435)<\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><a href=\"https:\/\/habrahabr.ru\/post\/314536\/\">\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a><br \/>  <a href=\"https:\/\/habrahabr.ru\/post\/314544\/\">\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/a><br \/>  \u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434, \u041f\u043e\u0441\u0430\u0434\u043a\u0430<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/314544\/\">\u043f\u0430\u043a\u0435\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438<\/a>, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<blockquote><p>\u041c\u0430\u0440\u0441\u043e\u0445\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0437\u0435\u043c\u043b\u0438\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 (<code>X<\/code> \u0438 <code>Y<\/code>, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438) \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>north<\/code>, <code>east<\/code>, <code>west<\/code> \u0438\u043b\u0438 <code>south<\/code>).<\/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-280929","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280929","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=280929"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280929\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}