{"id":289201,"date":"2018-09-10T16:55:02","date_gmt":"2018-09-10T12:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289201"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289201","title":{"rendered":"\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Kotlin"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e1b\/49f\/066\/e1b49f066308c07843dbacdad08ffa40.jpg\" alt=\"\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Kotlin\"><\/p>\n<p>  <\/p>\n<p>\u0413\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u00ab\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0431\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb. \u0421\u0430\u043c\u043e\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u044d\u0442\u043e <a href=\"http:\/\/norvig.com\/design-patterns\/\">\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043a\u0438 Lisp \u0438 Scheme<\/a>, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e, \u043f\u043e\u0445\u043e\u0436\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u044f\u0437\u044b\u043a\u0430 Kotlin \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u043b\u0438 \u044d\u0442\u043e \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u0441\u0435\u0440\u0434\u0446\u0443.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"odinochka-singleton\">\u041e\u0434\u0438\u043d\u043e\u0447\u043a\u0430 (Singleton)<\/h3>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u043c, \u2014 \u041e\u0434\u0438\u043d\u043e\u0447\u043a\u0430. \u0418 \u043e\u043d \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u044f\u043c\u043e \u0432 \u044f\u0437\u044b\u043a \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <strong>object<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code>object JustSingleton {     val value : String = \"Just a value\" }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0435 <code>JustSingleton.value<\/code> \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0418 \u043d\u0435\u0442, \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u043b\u0435 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<p>  <\/p>\n<pre><code>object SlowSingleton {     val value : String     init {         var uuid = \"\"         val total = measureTimeMillis {             println(\"Computing\")             for (i in 1..10_000_000) {                 uuid = UUID.randomUUID().toString()             }         }         value = uuid         println(\"Done computing in ${total}ms\")     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043b\u0435\u043d\u0438\u0432\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435:<\/p>\n<p>  <\/p>\n<pre><code>@org.testng.annotations.Test fun testSingleton() {     println(\"Test started\")     for (i in 1..3) {         val total = measureTimeMillis {                 println(SlowSingleton.value)         }         println(\"Took $total ms\")     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">Test started Computing Done computing in 5376ms \"45f7d567-9b3e-4099-98e6-569ebc26ecdf\" Took 5377 ms \"45f7d567-9b3e-4099-98e6-569ebc26ecdf\" Took 0 ms \"45f7d567-9b3e-4099-98e6-569ebc26ecdf\" Took 0 ms<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 0 \u043c\u0441, \u0445\u043e\u0442\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<pre><code>val total = measureTimeMillis {   \/\/println(SlowSingleton.value) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">Test started Took 0 ms Took 0 ms Took 0 ms<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"dekorator\">\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0438\u0434\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Decorator_pattern\">\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440<\/a>. \u042d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0414\u0430, IntelliJ \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0437\u0430 \u0432\u0430\u0441. \u041d\u043e Kotlin \u043f\u043e\u0448\u0451\u043b \u0435\u0449\u0451 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 HashMap, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c?<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0432\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0435\u0442\u0435 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <strong>by<\/strong>.<\/p>\n<p>  <\/p>\n<pre><code>\/**  * Using `by` keyword you can delegate all but overridden methods  *\/ class HappyMap&lt;K, V&gt;(val map : MutableMap&lt;K, V&gt; = mutableMapOf()) : MutableMap&lt;K, V&gt; by map{     override fun put(key: K, value: V): V? {         return map.put(key, value).apply {             if (this == null) {                 println(\"Yay! $key\")             }         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043d\u0430\u0448\u0435\u0439 \u043c\u0430\u043f\u044b \u0447\u0435\u0440\u0435\u0437 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 HashMap.<\/p>\n<p>  <\/p>\n<pre><code>@org.testng.annotations.Test fun testDecorator() {     val map = HappyMap&lt;String, String&gt;()     val result = captureOutput {         map[\"A\"] = \"B\"         map[\"B\"] = \"C\"         map[\"A\"] = \"C\"         map.remove(\"A\")         map[\"A\"] = \"C\"     }     assertEquals(mapOf(\"A\" to \"C\", \"B\" to \"C\"), map.map)     assertEquals(listOf(\"Yay! A\", \"Yay! B\", \"Yay! A\"), (result)) }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"fabrichnyy-metod\">\u0424\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/h3>\n<p>  <\/p>\n<p><strong>Companion object<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/Factory_method_pattern\">\u0424\u0430\u0431\u0440\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/a>. \u042d\u0442\u043e \u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0432\u043e\u0435\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f.<\/p>\n<p>  <\/p>\n<pre><code>class SecretiveGirl private constructor(val age: Int,                                         val name: String = \"A girl has no name\",                                         val desires: String = \"A girl has no desires\") {     companion object {         fun newGirl(vararg desires : String) : SecretiveGirl {             return SecretiveGirl(17, desires = desires.joinToString(\", \"))         }         fun newGirl(name : String) : SecretiveGirl {             return SecretiveGirl(17, name = name)         }     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e\u0437\u0440\u0430\u0441\u0442 SecretiveGirl:<\/p>\n<p>  <\/p>\n<pre><code>@org.testng.annotations.Test fun FactoryMethodTest() {     \/\/ Cannot do this, constructor is private     \/\/ val arya = SecretiveGirl();     val arya1 = SecretiveGirl.newGirl(\"Arry\")     assertEquals(17, arya1.age)     assertEquals(\"Arry\", arya1.name)     assertEquals(\"A girl has no desires\", arya1.desires)     val arya2 = SecretiveGirl.newGirl(\"Cersei Lannister\", \"Joffrey\", \"Ilyn Payne\")     assertEquals(17, arya2.age)     assertEquals(\"A girl has no name\", arya2.name)     assertEquals(\"Cersei Lannister, Joffrey, Ilyn Payne\", arya2.desires) }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"strategiya\">\u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u2014 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Strategy_pattern\">\u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/a>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 Kotlin \u0435\u0441\u0442\u044c <a href=\"https:\/\/kotlinlang.org\/docs\/reference\/lambdas.html\">\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0442\u043e\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code>class UncertainAnimal {     var makeSound = fun () {         println(\"Meow!\")     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code>@org.testng.annotations.Test fun testStrategy() {     val someAnimal = UncertainAnimal()     val output = captureOutput {         someAnimal.makeSound()         someAnimal.makeSound = fun () {             println(\"Woof!\")         }         someAnimal.makeSound()     }     assertEquals(listOf(\"Meow!\", \"Woof!\"), output) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0421\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f, \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435\u043b\u044c\u0437\u044f (\u043f\u0440\u0438\u0432\u0435\u0442, JS!)<\/p>\n<p>  <\/p>\n<pre><code>\/\/ Won't compile! someAnimal.makeSound = fun (message : String) {    println(\"$message\") }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"http:\/\/github.com\/alexeysoshin\/KotlinDesignPatterns\">\u043c\u043e\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e Kotlin \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u043a\u043d\u0438\u0433\u0430 <a href=\"https:\/\/www.manning.com\/books\/kotlin-in-action\">\u00abKotlin in Action\u00bb<\/a>. \u0412\u0430\u043c \u043e\u043d\u0430 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c (\u0445\u043e\u0442\u044f \u043d\u0435\u0442 \u043f\u0440\u0438\u0447\u0438\u043d \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c).<\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/421873\/\"> https:\/\/habr.com\/post\/421873\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e1b\/49f\/066\/e1b49f066308c07843dbacdad08ffa40.jpg\" alt=\"\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Kotlin\"><\/p>\n<p>  <\/p>\n<p>\u0413\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u00ab\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0431\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb. \u0421\u0430\u043c\u043e\u0435 \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u044d\u0442\u043e <a href=\"http:\/\/norvig.com\/design-patterns\/\">\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043a\u0438 Lisp \u0438 Scheme<\/a>, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e, \u043f\u043e\u0445\u043e\u0436\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u044f\u0437\u044b\u043a\u0430 Kotlin \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u044f\u043b\u0438 \u044d\u0442\u043e \u0432\u044b\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u0441\u0435\u0440\u0434\u0446\u0443.<\/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-289201","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289201","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=289201"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289201\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}