{"id":39071,"date":"2019-10-31T22:27:41","date_gmt":"2019-10-31T19:27:41","guid":{"rendered":"https:\/\/prohoster.info\/blog\/pochemu-polezno-izobretat-kolyosa\/"},"modified":"2019-10-31T22:27:41","modified_gmt":"2019-10-31T19:27:41","slug":"pochemu-polezno-izobretat-kolyosa","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/news\/pochemu-polezno-izobretat-kolyosa","title":{"rendered":"Why it is useful to reinvent the wheel","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><img decoding=\"async\" alt=\"Why it is useful to reinvent the wheel\" src=\"\/wp-content\/uploads\/2019\/10\/1067abfe7a3cdf764c49bbb0d5dd6d1b.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nRecently, I conducted an interview with a JavaScript developer applying for a senior position. A colleague, who was also present at the interview, asked the candidate to write a function that would make an HTTP request and, in case of failure, retry several times.<\/p>\n<p>He was coding directly on the board, so it would have been enough to depict something approximate. If he had just shown that he understood the essence of the task, we would have been quite satisfied. But, unfortunately, he struggled to find a successful solution. So, attributing this to nerves, we decided to ease the task a bit and asked him to convert the callback function into a promise-based function.<\/p>\n<p>But alas. Yes, it was clear that he had encountered such code before. He had a general idea of how it all worked. A rough sketch of a solution demonstrating his understanding of the concept would have sufficed. However, the code he wrote on the board was complete nonsense. He had a very vague notion of what promises are in JavaScript and could not adequately explain their purpose. For a junior developer, this might have been forgivable, but for a senior position, it was not acceptable. How could this developer fix bugs in a complex promise chain and explain to others what he had done?<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h4>Developers consider the finished code self-evident.<\/h4>\n<p>\nDuring development, we constantly encounter reproducible materials. We copy code snippets so that we don't have to rewrite them from scratch each time. Accordingly, focusing all our attention on the key parts, we view the finished code we work with as something obvious \u2013 we simply assume that everything will work as it should.<\/p>\n<p>And usually it does work, but when difficulties arise, understanding its mechanics pays off immensely.<\/p>\n<p>Thus, our candidate for the senior developer position considered promise objects to be self-evident. He probably knew how to manage them when they appeared in someone else's code, but he did not grasp the overall principle and was unable to reproduce it during the interview. Perhaps he memorized a snippet by heart \u2013 it's not that difficult:<\/p>\n<pre><code class=\"javascript\">return new Promise((resolve, reject) =&gt; {\n  functionWithCallback((err, result) =&gt; {\n   return err ? reject(err) : resolve(result);\n  });\n});<\/code><\/pre>\n<p>\nI did that too \u2013 and we all probably did it at some point. We just memorized a piece of code to use it later at work, having only a general idea of how everything was structured. But if a developer truly understood the concept, they wouldn't have to memorize anything \u2013 they would just know how to do it and effortlessly reproduce everything necessary in the code.<\/p>\n<h4>Go back to the sources<\/h4>\n<p>\nIn 2012, when frontend frameworks had not yet taken over, the world was ruled by jQuery, and I read a book <noindex><a rel=\"nofollow\" href=\"https:\/\/www.manning.com\/books\/secrets-of-the-javascript-ninja\">Secrets of the JavaScript Ninja<\/a><\/noindex>, authored by John Resig, the creator of jQuery.<\/p>\n<p>The book teaches the reader how to create their own jQuery from scratch and offers a unique opportunity to understand the thought process that led to the library's creation. In recent years, jQuery has lost its former popularity, but I still highly recommend the book. What struck me the most was the persistent feeling that I could have thought of all this myself. The steps outlined by the author seemed so logical and so clear that I genuinely felt like I could easily create jQuery if I just set my mind to it.<\/p>\n<p>Of course, in reality, I would never have managed anything like that \u2013 I would have decided it was impossibly difficult. My own solutions would have seemed too simple and naive to work, and I would have given up. I would have viewed jQuery as something obvious, whose correct operation needs to be accepted blindly. Subsequently, I would hardly have spent time delving into the mechanics of this library, but would have simply used it as some sort of black box.<\/p>\n<p>But my acquaintance with this book changed me. I began to delve into the source code and discovered that the implementation of many solutions is actually very clear, even obvious. Of course, coming up with something like that on my own is a different story. But it's precisely the study of someone else's code and reproducing existing solutions that helps us come up with our own ideas. <\/p>\n<p>The inspiration you draw and the patterns you start to notice will change you as a developer. You'll discover that the beautiful library you constantly use, which you\u2019ve come to think of as a magical artifact, operates not on magic, but simply solves a problem in a concise and ingenious way.<\/p>\n<p>Sometimes you have to toil over the code, breaking it down step by step, but it is through these small, incremental steps that you can retrace the author's path to a solution. This will allow you to dive deeper into the coding process and give you more confidence in finding your own solutions.<\/p>\n<p>When I first started working with promises, it felt like pure magic. Then I learned that they are based on the same callbacks, and my programming world turned upside down. So, a pattern designed to free us from callbacks is itself implemented with callbacks?!<\/p>\n<p>This helped me view things from a different perspective and realize that what was before me were not some abstract pieces of code with an complexity I would never grasp. They are simply patterns that can be understood with curiosity and deep engagement. This is how people learn to program and grow as developers.<\/p>\n<h4>Reinvent the wheel<\/h4>\n<p>\nSo feel free to reinvent wheels: write your own code for data binding, create a homemade promise, or even build your own state management solution. <br \/>\nIt doesn\u2019t matter that no one will ever use this \u2013 now you know how to do it. If you later have the opportunity to apply these developments in your own projects, that\u2019s just great. You\u2019ll be able to build on them and learn even more.<\/p>\n<p>The point here is not to deploy your code to production, but to master something new. Implementing an existing solution by yourself is an excellent way to learn from the best programmers and hone your skills.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/digital-ecosystems\/blog\/472006\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0430 JavaScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u0435\u043d\u0438\u043e\u0440\u0430. \u041a\u043e\u043b\u043b\u0435\u0433\u0430, \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0432\u0448\u0438\u0439 \u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438, \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430 HTTP \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437. \u041e\u043d \u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0434\u043e\u0441\u043a\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b \u0431\u044b\u043b\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435. \u0415\u0441\u043b\u0438 \u0431\u044b \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":29315,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-39071","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0430.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/news\/pochemu-polezno-izobretat-kolyosa\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0451\u0441\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0430.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/news\/pochemu-polezno-izobretat-kolyosa\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:27:41+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:27:41+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Why it\u2019s useful to invent wheels | ProHoster","description":"The other day I was interviewing a developer.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/news\/pochemu-polezno-izobretat-kolyosa","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0451\u0441\u0430 | ProHoster","og:description":"\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0430.","og:url":"https:\/\/prohoster.info\/en\/blog\/news\/pochemu-polezno-izobretat-kolyosa","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:27:41+00:00","article:modified_time":"2019-10-31T19:27:41+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"39071","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 00:37:21","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 23:16:10","updated":"2026-01-24 00:37:21","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/39071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=39071"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/39071\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/29315"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=39071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=39071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=39071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}