<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bohdan Balov 🇺🇦 on Medium]]></title>
        <description><![CDATA[Stories by Bohdan Balov 🇺🇦 on Medium]]></description>
        <link>https://medium.com/@balovbohdan?source=rss-f7d6abaaa99b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Pnx-e_vxp6pOfiN8dJBKjA.jpeg</url>
            <title>Stories by Bohdan Balov 🇺🇦 on Medium</title>
            <link>https://medium.com/@balovbohdan?source=rss-f7d6abaaa99b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 00:44:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@balovbohdan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why I Decided to Learn Back-End]]></title>
            <link>https://medium.com/@balovbohdan/why-i-decided-to-learn-back-end-aea92a661503?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/aea92a661503</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Mon, 15 Aug 2022 05:31:58 GMT</pubDate>
            <atom:updated>2022-08-15T05:31:58.607Z</atom:updated>
            <content:encoded><![CDATA[<h4>Aloud thoughts. Trying to convince myself that I’m not paying enough effort to learn new things.</h4><figure><img alt="A bunch of students with raised hands" src="https://cdn-images-1.medium.com/max/1024/1*C61K41WqA0Wee3AKwrxmuA.jpeg" /><figcaption>Photo from <a href="https://unsplash.com/photos/4V1dC_eoCwg">Unsplash</a> by <a href="https://unsplash.com/@theunsteady5">Edwin Andrade</a></figcaption></figure><p>This is not a regular technical piece in my blog. For this reason, I will not send it to a publisher. The main aim of this one is to convince me that I’m not paying enough effort to learn tech things around me.</p><p>As you may already know from my articles, I’m a Software Engineer. And at the moment of writing these words, I’m covering a Lead position in EPAM Systems. My main scope is front-end with React and everything around it. I’ve been working with the front-end for near 5 years. Before this, I was a PHP developer for some time.</p><p>So, what’s the problem with it, you may ask? Near 7 years of experience, knowledge of different techs and conceptual things. Everything that you have to have to live and work happily in a big company.</p><p>Happily… I guess this is the biggest concern of guys like me. I’m always looking for problems that I’m expected to solve. Otherwise, life is so boring and colourless!</p><p>Let me describe how I understood that I didn’t see a big progression in my career for the last half a year. Now I’m working on a project that doesn’t have tech problems I can’t solve. It doesn’t mean that I already know everything in the world — this is impossible. This means that I can take any problem and solve it in the estimated time. It may require some learning, investigations, discussions… But every time the problem comes to a solution that I can easily implement.</p><p>It’s not the first time I faced such a situation. Some time ago I decided to follow my engineering curiosity and started playing around the <a href="https://elm-lang.org/">Elm</a>. Appeared, it’s an awesome functional language I enjoyed learning and applying. I even started creating a <a href="https://balovbohdan.github.io/">personal blog</a> with it — it was a nice experience!</p><p>But at the same time, it is from the “exotic techs” world, and there are not many projects that want to use it. For this reason, I started losing interest in it as I didn’t see I’m doing something useful. And another problem was that I understood I could learn any front-end techs I want as concepts are very similar to what I already know.</p><p>There is a regular solution to such problems in EPAM Systems — Solution Architecture title. Shortly, this is when you are learning a lot of new things on some sufficient level and can build tech solutions for projects. This is an important role in projects that are going to have success. As a Solution Architect has a global/strategic technical vision of things and can help to build reliable systems and avoid problems on a scale.</p><p>Then, sorted! After several 1–2–1 sessions with my manager, it was decided that I’m going to learn Solution Architecture. At the current point, I’m even not sure that I’m going to be an Architect, but this is a good chance to learn something new and grow my understanding of what I want in my storing mind!</p><p>And yes, I’m a student at the Solution Architecture School now.</p><p>Let me describe to you shortly what you need to have to grow to the Solution Architecture level. It’s heavy baggage of different things, you know!</p><p>Firstly, you should be an excellent engineer. It means you are always learning new things. There is a huge ability and desire of your brain to keep knowledge about different techs. Not easy. Yeah?</p><p>Secondly, you should have deep expertise in 2–3 nitches. E.g., React, Angular and NodeJS. Knowledge of at least 2 clouds is considered by default.</p><p>Thirdly, you should be a good communicator. This is important for convincing others that your solution is suitable for the current state of things. And engineers are not easy buddies to change minds, as you should know from your experience.</p><p>I’m not going to proceed further with this list. There are a lot of items that should be added… But the specified ones are major IMHO.</p><p>I hope, you already see why I’m going to learn the back-end. The main reason for it is to gain more engineering experience not related to my everyday stuff. To break my brain and form it again with a wider vision of the world.</p><p>I’m thinking about NodeJS. I’ve already had some experience with it in the past, and it is a rather common thing for modern app development.</p><p>The back-end is not sufficient knowledge for me to think about the Solution Architecture title. As I’ve already mentioned, clouds are also required. I’m thinking about learning AWS or Azure, or even both.</p><p>Wish me good luck!</p><p>What about the <a href="https://balovbohdan.github.io/">personal blog</a> developed with Elm… Maybe I will rethink and restart this project in the future. I love this idea and want to fully implement it for a long time. But there are always some obstacles. But not sure about the Elm. <a href="https://medium.com/geekculture/elm-vs-react-brief-thoughts-7f1f3fbbff10">I’ve already described the problem here</a>. Maybe I will choose <a href="https://www.gatsbyjs.com/">Gatsby</a> or something similar. Still not sure.</p><p>That is it for today. Hope you enjoyed this light reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aea92a661503" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything You Should Know About Effects in React]]></title>
            <link>https://javascript.plainenglish.io/everything-you-should-know-about-effects-in-react-6d824549f598?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d824549f598</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 14:18:32 GMT</pubDate>
            <atom:updated>2022-08-01T14:18:32.720Z</atom:updated>
            <content:encoded><![CDATA[<h4>Considerations on how to deal with effects in React. Tips and tricks you maybe didn’t hear about.</h4><figure><img alt="Forrest ans sunshine" src="https://cdn-images-1.medium.com/max/1024/1*rX1amQvTo8i7DrRmMrbH8w.jpeg" /><figcaption>Image by <a href="https://unsplash.com/@jadhav24omkar">Omkar Jadhav</a> from <a href="https://unsplash.com/photos/s5xNLPMxHZU">Unsplash</a></figcaption></figure><p>This is not a tutorial about how React effects work under the hood. The primary purpose of this paper is to describe best practices, tips, and tricks concisely. If you need detailed information on how React Effects/Hooks work under the hood, you may find the following links useful:</p><ul><li><a href="https://stackoverflow.com/questions/53729917/react-hooks-whats-happening-under-the-hood">StackOverflow Thread about React hooks</a></li><li><a href="https://eliav2.github.io/how-react-hooks-work/">Nice reading about React hooks by Eliav Louski</a></li><li><a href="https://overreacted.io/how-does-setstate-know-what-to-do/">Paper about </a><a href="https://overreacted.io/how-does-setstate-know-what-to-do/">useState by Dan Abramov</a></li></ul><h3>About React Effects in General</h3><p>You maybe already seen discussions about whether React follows <a href="https://gist.github.com/staltz/868e7e9bc2a7b8c1f754">Reactive Programming</a> principles or not. To be short here, let me answer right now. <a href="https://dev.to/this-is-learning/how-react-isn-t-reactive-and-why-you-shouldn-t-care-152m">React doesn’t follow</a> fundamental Reactive Programming principles. But at the same time, we can say that <a href="https://stackoverflow.com/questions/71855096/reactive-programming-in-react">React is “reactive”</a>. The main point here is that “Reactive Programming” and “Reactivity” are not about the same. More details may be found <a href="https://gist.github.com/sw-yx/9bf1fad03185613a4c19ef5352d90a09">here</a>.</p><p>I started this section with Reactivity because it’s important to understand React&#39;s Effects. Essentially, Effects are possible thanks to Reactivity.</p><p>Let’s explore a simple piece of code below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e0f5f9f49711f4807a6247f531b6bcd/href">https://medium.com/media/0e0f5f9f49711f4807a6247f531b6bcd/href</a></iframe><p>Let’s try to understand what this code does line by line.</p><ul><li>1 — This is the state piece definition. We want to have a counter value that should be dynamic and observable. It’s changeable by setCounter function. But how do observe its changes?</li><li>2 — To observe changeable values in React we can use the useEffect hook. I.e., when the counter value changes the callback is being called. This is <a href="https://stackoverflow.com/a/53730788/8097218">how React handles this</a> under the hood.</li><li>3 — This is how we arrange changes to the observable entity. Again, we need one more useEffect to set it up. Why? Well, this is because of how React renders. As you can see, the dependency list is empty here, and this means that this action happens only once, and subsequent renders don’t trigger it again. When interval callback is called, counter is updated, then effect callback (2) is called, and from start again.</li><li>4 — We want to render nothing. Then the null is returned.</li></ul><p>Actually, this is not correct to say that counter an observable value. It is not observable at all! We can see its changes thanks to React rendering internals (see references above). Then, how to describe React Effect term in simple words? Let’s try.</p><p><em>React Effect is a mechanism of scheduling a change of a value, and then observing this change and reacting to it.</em></p><p>And once again about Reactivity.</p><p><em>React Effects don’t follow Reactive Programming fundamental principles. The main distinction lies in the implementation details. But we can think that Effects rely on a special type of Reactivity.</em></p><h3>Use ESLint to Validate Dependencies</h3><p>I encourage you to use <a href="https://eslint.org/">ESLint</a> to validate your (and your teammates&#39;) code. The best indicator of your ESLint config’s quality is how you are doing Code Review. If you need to check only business logic and patterns, it is a high-quality ESLint config. But if you are always forced to check code style, such config should be definitely improved…</p><p>There is a bunch of standard ESLint rules you may use out of the box. But most probably that they will not suffice for the fast-growing project. Then <a href="https://github.com/dustinspecker/awesome-eslint">ESLint plugins</a> come on the scene. This topic is worth a separate article to describe in detail. Now we are interested only in the <a href="https://www.npmjs.com/package/eslint-plugin-react-hooks">eslint-plugin-react-hooks</a> plugin. It forces you and your team to follow the <a href="https://reactjs.org/docs/hooks-rules.html">Rules of Hooks</a>.</p><p>There are ways to <a href="https://flaviocopes.com/how-to-disable-eslint-rule/">disable the ESLint rule</a>. And there are a lot of situations when a developer thinks that he really knows how his code should work and doesn’t want to follow the Rules of Hooks. In such a case developer the most probably does the following.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c3ec3ff5f8b434ee07a62731c7b8046/href">https://medium.com/media/0c3ec3ff5f8b434ee07a62731c7b8046/href</a></iframe><p>Just remember the following:</p><p><em>If you don&#39;t want to follow the Rules of Hooks, this doesn’t mean that you know your code better. This means that you don’t understand how React Effects work and just trying to hack the system!</em></p><p>Below we will a look at ugly hooks like useComponentDidMount. In most cases, they are using such disabling statements. And this is one more reason why such hooks are just hacks.</p><p>Below we will see how we can have a legal workaround and avoid using some dependencies in the deps list.</p><h3>Gotchas</h3><p>The React’s Reactivity system is based on the approach that the developer knows what dependencies should trigger an Effect. And there are some gotchas that can’t be checked by the eslint-plugin-react-hooks.</p><h4>1. Memoize Functions In Custom Hooks</h4><p>Let’s take a look at the following example. And imagine that we are following all the Rules of Hooks.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/045ccfcfddd0e1eec55efddee20292f8/href">https://medium.com/media/045ccfcfddd0e1eec55efddee20292f8/href</a></iframe><p>Do you see the problem here? Let me describe. The problem is in the incrementCounter function. The component uses it in the deps list for useEffect. But this function was not memorized in the useCounter custom hook. And this means that every render of the Component generates a new reference to the incrementCounter function, and it causes an Effect to happen again!</p><p>Actually, this is not a big problem here as we care about events and clearing the interval before killing the Effect. This is an important thing I want you to remember once and forever.</p><p><em>Always clear events in </em><em>useEffect s. Avoiding this leads to hardly fixable issues.</em></p><p>The only legal option to resolve this problem is to memoize the incrementCounter function in the useCounter hook.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e181cd62fd9362d460a4b48669247c36/href">https://medium.com/media/e181cd62fd9362d460a4b48669247c36/href</a></iframe><h4>2. Be Careful With Input Functions</h4><p>This is not an obvious situation. And I faced a bunch of problems related to it that were hardly catchable. Let’s take a look at it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e372d85f0c5aa50ad6e585faa07ba50/href">https://medium.com/media/8e372d85f0c5aa50ad6e585faa07ba50/href</a></iframe><p>There is the same problem as with the previous example. When the Component renders, a new link to the inlined function (*) gets generated. Then it causes unexpected Effects in the useCounter custom hook.</p><p>There are two ways to fix it. The first way is to rid of that inline function and memoize it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03150f3659a6327e3cfe3a57eb90c78a/href">https://medium.com/media/03150f3659a6327e3cfe3a57eb90c78a/href</a></iframe><p>This works fine. But I don’t like this approach at this is a bit verbose.</p><ul><li>You are always forced to memoize the input function.</li><li>You should be sure that everyone will do this memoization, and this is the biggest problem.</li></ul><p>Let me show you the second way. It’s a legal workaround that allows to rid of dependency and still conform to the Rules of Hooks. Please, be careful with this approach and use it only when there are no other ways to solve the problem.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54900ba81be1a4d5ac58463ddecded1a/href">https://medium.com/media/54900ba81be1a4d5ac58463ddecded1a/href</a></iframe><p>Let’s explore this code line by line.</p><ul><li>1 — We save the input function as a React Ref. This is a legal way of having access to this function and not being forced to specify it in the deps list.</li><li>2 — This is an important part of this approach. When the input function changes, we should update the reference to the input function.</li><li>3 — Then, when we want to use the input function (onChange), we use the reference to it instead (onChangeRef.current).</li><li>4 — For now, as we use React Ref under the hood, the input function’s memoization is redundant, and we can freely inline it.</li></ul><p>Looks good. Right?</p><p>You may ask how this hell is actually working. There is a simple principle. Functions in JavaScript are objects. Then, when we pass an inline function as a parameter, we essentially pass a reference to the function instead of the function itself. When the reference is updated, useEffect just uses the updated input function.</p><p>If you don’t know this concept, I recommend you look at <a href="https://javascript.info/object-copy">this page</a>. If you are in a hurry, the following diagram describes this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3yAzLbdduapWTubv8fnBg.png" /><figcaption>Picture 1. Dynamic reference to the function</figcaption></figure><h3>Considerations about Class Component Lifecycle Methods</h3><p>I guess you have some experience with React class components. There is a set of <a href="https://reactjs.org/docs/react-component.html#the-component-lifecycle">Lifecycle Methods</a>. (You may find <a href="https://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/">this diagram</a> useful as well.) Sometimes developers like to mix functional components and class components’ lifecycle principles. I mean custom hooks like useComponentDidMount, useComponentWillUnmount and others.</p><p>I had a lot of discussions about such a mixing of principles. Also, I thought a lot about it and tried to create for myself a clear justification for whether this is correct or not. And even tried to convince me this is good, as such a code works fine in most cases.</p><p>Emm… Mabe in some edge cases this mixing may be useful. And this surely should work fine if the app has the rule to consider this as an acceptable approach to building Effects. But I still believe such a code is ugly and violates Reactivity principles of React! And even leads to hardly reproducible issues if you are not a proficient React hacker.</p><p>Let’s try to understand what’s wrong.</p><p>Firstly, as we have already discussed above, in most cases such solutions don’t follow the Rules of Hooks. This means the Reactivity is broken — it works semi-correctly and leads to hardly fixable bugs.</p><p>But you may say here that there is a legal workaround with React Refs, and we may build these custom Hooks with this! You’re right. But it doesn’t change the state of things a lot. The Reactivity remains broken regardless you use a legal or non-legal solution.</p><p>Secondly, this is a huge misconception to mix these 2 different worlds: class-based and function-based components. When React Team was designing class components years ago, it was an acceptable solution for the past few days. But now we are living in a completely different world. The front-end is slowly moving to the functional concepts as they allow to build of more runtime-reliable and performant solutions. For this reason, the React Team was forced to introduce one more modern way of describing components — functional components.</p><p>Just try to build this picture in your head. React provides you with a modern API that is much more flexible and powerful than old class-based components. And you still can’t rebuild your mind and proceed with using obsolete concepts. Do you see what I mean?</p><p>Stop sticking to old React concepts built around the class-based components. Refresh your mind and build React apps based on Effects! And without compulsive attempts to hack the system and introduce custom ugly API like useComponentDidMount.</p><h3>Why Should We Destructure Functions</h3><p>There is one more topic I’d like to discuss with you. This is related to the Rules of Hooks. If you have already used eslint-plugin-react-hooks, you probably faced the situation when the Rules of Hooks don’t allow you to use a function right from the “props”(like props.onChange). You are always forced to destructure it before adding it to the deps list. In most cases, a developer just disables this warning with the ESLint disabling statement. And this is wrong.</p><p>This code violates the Rules of Hooks:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23a0e3c591a599da23f0ecc7716ab419/href">https://medium.com/media/23a0e3c591a599da23f0ecc7716ab419/href</a></iframe><p>This code conforms with the Rules of Hooks:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e777cb6fbc64d9a178bc2f62b4b3c614/href">https://medium.com/media/e777cb6fbc64d9a178bc2f62b4b3c614/href</a></iframe><p>Let’s try to understand why the Rules of Hooks force us to destructure functions from “props” before adding them to the deps list. And the best answer you can find <a href="https://github.com/facebook/react/issues/16265#issuecomment-517518539">here in the React Issue discussion</a>, where <a href="https://medium.com/u/a3a8af6addc1">Dan Abramov</a> described the problem in detail.</p><p>I highly recommend reading that discussion. But if you want to go through this quickly, I will provide you with a short answer.</p><p>The problem is in purity. React wants to see the pure function in the deps list. The props.onChange() call can’t be considered as pure because props object is this for onChange.</p><p>But why is it important? This is because changes should be observable. Remember our discussion about Reactivity above?</p><p>Actually, that is it! There are a lot of interesting things to say about React Effects. But they are the topics for the next papers. Hope you enjoyed this reading.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><strong><em> </em></strong><em>and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Check out our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Community Discord</em></strong></a><em> and join our </em><a href="https://inplainenglish.pallet.com/talent/welcome"><strong><em>Talent Collective</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d824549f598" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/everything-you-should-know-about-effects-in-react-6d824549f598">Everything You Should Know About Effects in React</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Financial Amateur about Money and Savings]]></title>
            <link>https://medium.com/@balovbohdan/financial-amateur-about-money-and-savings-79a5b2c81b09?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/79a5b2c81b09</guid>
            <category><![CDATA[savings-tips]]></category>
            <category><![CDATA[financial-planning]]></category>
            <category><![CDATA[wellbeing]]></category>
            <category><![CDATA[saving-money]]></category>
            <category><![CDATA[financial-freedom]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Sun, 26 Jun 2022 13:12:37 GMT</pubDate>
            <atom:updated>2022-08-01T04:58:54.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Old counting machine" src="https://cdn-images-1.medium.com/max/1024/1*2LW5JhV8dSDhf8bi3tV49w.jpeg" /><figcaption>Image from <a href="https://unsplash.com/photos/MQ8-4HYTgOc">Unsplash</a> by <a href="https://unsplash.com/@dmey503">Dan Meyers</a></figcaption></figure><p>Hey! I’m a Software Engineer in a big tech company. And today I’m going to describe all the things around money and savings I know and practice.</p><p>Please note that this paper is about my personal experience, thoughts and approaches to money. I’m not a professional investor — I’m a financial amateur, as I’ve already said. Things from this one may be wrong and not working for you.</p><p>So, please be careful and think twice before accepting what I’m describing here. Think of it as a stimulus to think about money the modern way and prepare savings for your future.</p><h4>How to Think about Money</h4><p>I’m following a simple rule:</p><blockquote>Think about money as pieces of paper. And these papers may be burnt out in a moment!</blockquote><p>This rule motivates me to convert my income into different forms. And the best option is when this form provides some passive income, even not much. Yeah, I’m saying about investments…</p><p>Not every form of money can give you a passive income. And these forms still stay helpful as this is a kinda protection from different catastrophes that may happen in our lives:</p><ul><li>War (I’m from Ukraine, and I know what a terrible thing war is)</li><li>Natural disasters (e.g., an earthquake can destroy your home)</li><li>Health problems (they come suddenly, just believe me 😁)</li></ul><h4>Some Thoughts about the Passive Income</h4><p>To be honest, I’m not very successful in this field. And this is mostly because I’m paying a huge credit for real estate for the last 3 years, and I don’t have enough free money to invest. But I have some small investments that give me not a big but a stable income.</p><p>What am I telling you about? Options are very simple:</p><ul><li>Deposits (they give a very small income that covers inflation).</li><li>Securities (I plan to try ones from <a href="https://en.wikipedia.org/wiki/S%26P_500">S&amp;P 500</a>).</li><li>Blog articles (like mine on Medium, but I still don’t have plans to monetize it).</li><li>Any type of business that doesn’t require your direct involvement. But this is out of scope. I know nothing about this type of income.</li></ul><h4>Are Credits Good?</h4><p>There are thoughts that credit is a bad thing. But I believe it’s a nice thing when:</p><ul><li>You have a more or less clear finance plan</li><li>You are going to buy a thing that will give you a profit</li><li>Also, if you are buying a thing that will give you stability (real estate)</li></ul><p>Just imagine such a situation. You want to buy a car, and you have all the required amount of money. And there is an option to have a credit for the car for a small percentage (e.g., 2% per year). Sometimes there are such interesting suggestions from car dealers. What would you choose: pay all the amount, or pay credit in one year with 2% (and other related fees)? I would choose the second option to have money accessible.</p><p>This is what I’ve chosen buying the real estate. I decided to pay a 3 years credit and have a flat right now. And it was a good decision, as the real estate market has grown, and now my flat is even more expensive than 2 years ago.</p><p>But it was before the russian invasion. Not sure what will be later. I only hope that russian terrorists will be fully destroyed in the nearest future.</p><h4>Is It OK to Buy Estate?</h4><p>It’s a big thing to have your own home! I know that this idea sounds strange for Americans who are not sure they want to leave in the same place for a long time. I and my family some time ago strongly decided to stay in Ukraine, as it is a nice country. We have chosen a city and bought a small flat in an awesome place I’d like to live long and happily.</p><p>So, if you know when you want to live, it’s a good option to have your own home. But, if you are not sure — maybe it’s fine to rent a place and move from time to time.</p><p>If you’ve already strongly decided to buy real estate, you will be surprised by the costs! It’s really huge if you want to leave in a modern and comfortable place. And here a credit/mortgage will be a good decision, as saving so huge amount of money will take a long time, and you will be forced to pay for a rented place as well.</p><p>I don’t want to discuss here how to earn on real estate. As for me, it’s almost impossible to earn enough if you don’t have at least one million dollars to invest.</p><h4>Spend Consciously</h4><p>You may hear around you: “Don’t be concerned about spending, just earn more if you need”. It’s stupid! Most probably most of us have a top point of income amount that is almost impossible to break through, at least with applying an adequate effort.</p><p>Money is not the best thing in the world, and it sounds very strange to me to work days and nights just to buy a super expensive thing. This inevitably leads to health problems. Isn’t it better just to postpone buying this expensive thing? Or maybe not to buy it at all?</p><p>In Ukraine people like buying too expensive cars. But guys from my generation think it may not be a good decision! Please, don’t buy expensive things just to surprise folks around you. Think about a thing’s practicality and buy it consciously.</p><p>What about cars, I once heard a rule of thumb. I followed this rule, and it works very well for me. Here it is:</p><blockquote>Car should not cost more than your incomes during 3 months.</blockquote><p>Actually, that is it! Money is a big topic, and I can talk about it for a long time. But I’d like to stop here to give you a place for your own thoughts. Reach me out in the comments or on <a href="https://twitter.com/balov_bohdan">Twitter</a> if you want to discuss some points from this article.</p><p>Good luck! Save money, hate russian killers and <a href="https://www.comebackalive.in.ua/donate">support Ukraine</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79a5b2c81b09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Notes #2. Gradual Improvement. Part 2]]></title>
            <link>https://medium.com/geekculture/system-design-notes-2-gradual-improvement-part-2-874447785c6c?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/874447785c6c</guid>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Tue, 17 May 2022 07:11:13 GMT</pubDate>
            <atom:updated>2022-05-17T07:36:51.155Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to scale a System from single to millions of active users. Part 2: CDN, Web Tier Architectures, Async Data Processing and Shared State Storage.</h4><figure><img alt="Complex road junction, top view" src="https://cdn-images-1.medium.com/max/1024/1*yZQ-yh2LrfvSOw3_WbPUTA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@ed259">Ed 259</a> from <a href="https://unsplash.com/photos/xcrI6CPkkJs">Unsplash</a></figcaption></figure><p><a href="https://medium.com/geekculture/system-design-notes-1-gradual-improvement-part-1-e138a407dc4d">PREVIOUS</a></p><p>This is the second piece of the System Design series. Today we are going to take a look at CDN, Web Tear architectures, Async Data Processing and other topics.</p><p>This is where we stop in the previous article:</p><figure><img alt="Picture 1. System Design Diagram" src="https://cdn-images-1.medium.com/max/1024/1*3x3H4VndvFZxR74AgIO9xA.png" /><figcaption>Pic. 1. System Design Diagram</figcaption></figure><p>Let’s go on and improve this System!</p><h3>CDN</h3><p>CDN stands for Content Delivery Network. We can think of it as geographically sparsed Caches for a Web Server. This is a useful thing for delivering static content like images, audio tracks or even JavaScript and HTML. Below you can find a picture describing the main principle of CDN.</p><figure><img alt="Picture 2. CDN Principle Diagram" src="https://cdn-images-1.medium.com/max/1024/1*oVe3t0caZGq9nGhhLfIhoQ.png" /><figcaption>Pic. 2. CDN Principle</figcaption></figure><p>As you may find above, there are multiple CDNs all over the globe and a single Server (that contains the original static content). When a user fetches some content item for the first time, it gets saved in the CDN for some time. Then, the next requests are processed by the CDN and a user doesn’t need to wait too long again. I.e., this is like a <a href="https://medium.com/geekculture/system-design-notes-1-gradual-improvement-part-1-e138a407dc4d">Cache</a>.</p><p>Let’s take a look at one more example showcasing this cache nature of CDN.</p><figure><img alt="Picture 3. CDN Principle" src="https://cdn-images-1.medium.com/max/1024/1*yG-_42BeSYVj43ACXKTdrw.png" /><figcaption>Pic. 3. CDN Principle</figcaption></figure><p>This is the description of the Pic. 3:</p><ul><li>User 1 requests “index.html”.</li><li>As User 1 is the first user who requests this file, the System fetches it from the Web Server, saves in CDN for some time and sends it back to the requester.</li><li>User 2 requests the same “index.html”. And this user is in the same region as User 1.</li><li>As this file is already saved in CDN, the file is quickly delivered to the requester.</li></ul><p>There are some points you need to consider using CDN:</p><ul><li>CDN is an expensive thing. The balance between cost and profit should be found.</li><li>It may be rather complex to find the right <em>expiry policy</em> and <em>expiry timeout</em>.</li><li>When CN is broken, content should stay available.</li></ul><h3>Stateful Web Tier</h3><p>Stateful Web Tier stores some data between requests. In most cases, it means storing session data. Maybe you remember “$__SESSION” from PHP? 😅</p><p>This is how we may represent a stateful Web Tier:</p><figure><img alt="Picture 4. Stateful Web Tier Diagram" src="https://cdn-images-1.medium.com/max/1024/1*L2Hq2z6Sv6TTU9oblQRLRw.png" /><figcaption>Pic. 4. Stateful Web Tier</figcaption></figure><p>As you may already know, stateful architecture is not a good solution. This is hardly supportable and error-prone.</p><h3>Stateless Web Tier</h3><p>In this architecture, there is no inter-requests data in a Web Tier. Such a System is robust and scalable. In a case when some state data is required, it should be moved out of a Web Tier. As a good example — to a separate NoSQL storage. Below you can find an appropriate diagram describing it.</p><figure><img alt="Picture 5. Web Tier with a Shared State Storage" src="https://cdn-images-1.medium.com/max/1024/1*6dqRuxnxpegb61Fz3CAYQA.png" /><figcaption>Pic. 5. Web Tier with a Shared State Storage</figcaption></figure><p>Now our System can easily scale Web Tier and Shared State Storage independently. It is a good approach for fast-growing systems or systems with accidental traffic growth.</p><h3>Data Centers</h3><p>In the previous article, we discussed how Load Balancer may help us balance the traffic. In this section, we are going to add to our System a geoDNS routing. This allows balancing the traffic considering a user’s geolocation. Below you can see it on a diagram.</p><figure><img alt="Picture 6. GeoDNS Routing Diagram" src="https://cdn-images-1.medium.com/max/1024/1*V1oKlqoJNh7FGX0Eh7A3DQ.png" /><figcaption>Pic. 6. GeoDNS Routing</figcaption></figure><p>There are some gotchas:</p><ul><li>GeoDNS routing is a complex thing from a tech perspective.</li><li>Data sync between multiple regions may be a real pain.</li><li>Deployment to several Data Centers is not trivial stuff.</li></ul><p>But if your System operates across multiple regions, it is a worthy approach. Moreover, the complexity is mitigated if you are using services like AWS.</p><h3>Async Tasks</h3><p>Just imagine a situation when your System has the feature of processing a huge amount of goods selling statistics and generating profit predictions for the nearest future. A rather heavy task, isn’t it? How would you design this feature?</p><p>A good idea here is to use a Message Queue. It is an element that allows async communications between a Producer (who requests data processing) and Consumer (who processes data and builds predictions). Let’s take a look at the diagram.</p><figure><img alt="Picture 7. Data Processing Queue Diagram" src="https://cdn-images-1.medium.com/max/1024/1*vlcsk6jAStgqeXByk4erWg.png" /><figcaption>Pic. 7. Data Processing Queue</figcaption></figure><p>We are not going to deep dive into this approach. There are some cons and pros that you can find on the web for your specific problem.</p><h3>Intermediate Summary</h3><p>This is the final System Diagram until now. We have GetDNS, Data Centers, Async Data Processing Microservice, CDN and Shared State Storage. Looks very good! This System is able to scale partially and gradually, depending on the type of requests and evolution vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LE6veoVkxaMxW5bJpFgjdA.png" /><figcaption>Pic. 8. Intermediate System Design</figcaption></figure><p>This was the second part of the “Gradual Improvement” paper. In the next article, we are going to take a look at the System Metrics and DB scaling approaches.</p><p>To be continued…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=874447785c6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/system-design-notes-2-gradual-improvement-part-2-874447785c6c">System Design Notes #2. Gradual Improvement. Part 2</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Notes #1. Gradual Improvement. Part 1]]></title>
            <link>https://medium.com/geekculture/system-design-notes-1-gradual-improvement-part-1-e138a407dc4d?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e138a407dc4d</guid>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[system-scaling]]></category>
            <category><![CDATA[softare-development]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Wed, 11 May 2022 12:00:02 GMT</pubDate>
            <atom:updated>2022-05-17T07:15:45.252Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to scale a System from single to millions of active users. Part 1: Load Balancer, Web Server scaling, DB replication and caching.</h4><figure><img alt="Complex road junction, top view" src="https://cdn-images-1.medium.com/max/1024/1*D7ZKQHGLEDSgopFKHNEmyQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@darshan394">Deva Darshan</a> from <a href="https://unsplash.com/photos/Jt9syHEhrPE">Unsplash</a></figcaption></figure><p>This is a series of notes about system design. The main motivation to make these notes for me is to better understand the system design topics. You may also find them useful if you need to refresh some common topics or to get an outline of the subject.</p><h3>Single Server</h3><p>This is the point some software projects should use as a starting point. A single server system assumes that you have the only Web Server, even w/o a Database.</p><figure><img alt="Picture 1. Single Sever System Diagram" src="https://cdn-images-1.medium.com/max/1024/1*lStUgHFNnyRRxE7DH2ZurA.png" /><figcaption>Pic. 1. A Single Server System</figcaption></figure><p>This is how this system works:</p><ol><li>A user wants to reach the “mrbalov.io” web page. The browser goes to DNS and retrieves the appropriate IP address.</li><li>DNS responds with the IP address for the “mrbalov.io” domain.</li><li>Then browser uses an IP address to reach the Web Server.</li><li>The Web Server responds with the HTML page or JSON data.</li></ol><h3>Database</h3><p>The previous system doesn’t have stored data. The only it does is respond with static data: HTML of JSON. To store data (e.g., users, welsh corgis, etc.), we need to add a Database to our system. Let’s do it!</p><figure><img alt="Picture 2. System with Database Diagram" src="https://cdn-images-1.medium.com/max/1024/1*j-uSWdOKeCDb2tHB6zoS0g.png" /><figcaption>Pic. 2. A System with Database</figcaption></figure><p>There are 2 types of available databases:</p><ul><li>Relational(MySQL, PostgreSQL)</li><li>Non-Relational, or NoSQL (Redis, Memcached, MongoDB)</li></ul><p>Relational databases are useful for structured data that may have relations with each other. For instance, table “users” may have a “corgiId” field to point to a certain entity in the “corgis” table.</p><p>Non-Relational databases are useful for unstructured data. Also, they are useful when low latency is required. Or when an amount of data is huge.</p><h3>Scaling</h3><p>There are 2 types of scaling:</p><ul><li>Vertical (scale-up)</li><li>Horizontal (scale-out)</li></ul><p><strong>Vertical scaling</strong> means that you add more power to an existing server: CPU, RAM, and so on. There are several major drawbacks to this approach:</p><ul><li>High cost</li><li>Hard scaling limit</li><li>Single point of failure (if a server goes down, nothing can replace it)</li><li>Lack of redundancy (no “empty” space for a case of growing pressure</li></ul><p><strong>Horizontal scaling</strong> is about adding more servers that are working simultaneously. This approach solves the problems specified above. But it may be rather complex to set up. The first problem we need to address is routing to the right servers.</p><h3>Load Balancer</h3><p>The purpose of a Load Balancer is to distribute connections between Web Servers.</p><figure><img alt="Picture 3. System with Load Balancer Diagram" src="https://cdn-images-1.medium.com/max/1024/1*FEWdPzm28xdwx-Bwu-I0Fg.png" /><figcaption>Pic. 3. A System with Load Balancer</figcaption></figure><p>Make note that for a sake of security the Load Balancer uses private IPs.</p><p>This is how the Load Balancer can help our imagined System:</p><ul><li>If one of the Web Servers goes down, the Load Balancer will route traffic to the alive Server.</li><li>When traffic increases suddenly, more Web Servers may be added to the pool.</li></ul><p>So, now the Web Tier has the following properties:</p><ul><li>Failover — this is an ability to recover from a situation when a Web Server goes down.</li><li>Redundancy — this is something like “empty space” that allows dealing with suddenly increased traffic.</li></ul><p>The next step is to improve the Web Tier.</p><h3>Database Replication</h3><p>Database replication means having multiple copies of a database. The purpose of replication is to separate read operations from mutating operations (insert, delete, update). This is helpful as most systems have a big number of reading operations and much fewer mutating operations.</p><p>The master/slave approach is the most common. This is described in the diagram below.</p><figure><img alt="Picture 4. System with Database Replication" src="https://cdn-images-1.medium.com/max/1024/1*XwRBLOts3_28IK_OTO3EUw.png" /><figcaption>Pic. 4. A System with Database Replication</figcaption></figure><p>There are advantages of Database replication:</p><ul><li>Performance (because of high read ratio over mutations)</li><li>Reliability (if one of the DBs dies, there are other operational ones)</li><li>Availability (when replicated DBs are in different locations)</li></ul><h3>Caching</h3><p>This is a common technique for decreasing response time. We are going to add Cache Tear to our imagined System to improve the response time for reading data from Database.</p><figure><img alt="Picture 5. Cache Tier" src="https://cdn-images-1.medium.com/max/1024/1*oOK-T55xhhU6MaY3n2fLFg.png" /><figcaption>Pic. 5. Cache Tier</figcaption></figure><p>There are some useful considerations for adding Cache Tier to the System.</p><ul><li>The cache is useful when data is read frequently.</li><li>Think about the <strong>expiration policy</strong>. This is a time data is cached. This should not be either too short or too long.</li><li>When the Cache Tier is distributed, there may be problems with consistency.</li><li>The Cache Tier may be a <strong>Single Point of Failure</strong> (SPOF). As an option to avoid this, the Cache Tier has to be distributed.</li><li>The <strong>eviction policy</strong> should be considered. This means removing redundant data when storage is full. Some popular eviction policies: Least Frequently Used (LFE), First In First Out (FIFO).</li></ul><h3>Intermediate Summary</h3><p>This is the System diagram we have now. This is not the final solution. And, actually, the process of improving any System is endless! In the next chapters, we are going to improve the current state of things.</p><figure><img alt="Picture 6. Intermediate System Diagram. This will be improved soon!" src="https://cdn-images-1.medium.com/max/1024/1*3x3H4VndvFZxR74AgIO9xA.png" /><figcaption>Pic. 6. Intermediate System Diagram. This will be improved soon!</figcaption></figure><p>This was the first part of the “Gradual Improvement” paper. In the next part, we will take a look at the CDN, StatefulStateless Web Tier, Data Centers, DB scaling, and other topics.</p><p><a href="https://medium.com/@balovbohdan/system-design-notes-2-gradual-improvement-part-2-874447785c6c">To be continued…</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e138a407dc4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/system-design-notes-1-gradual-improvement-part-1-e138a407dc4d">System Design Notes #1. Gradual Improvement. Part 1</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Speak English (Almost) Like a Pro]]></title>
            <link>https://medium.com/@balovbohdan/how-to-speak-english-almost-like-a-pro-a61952cd66fd?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a61952cd66fd</guid>
            <category><![CDATA[self-education]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[english]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Tue, 03 May 2022 06:55:15 GMT</pubDate>
            <atom:updated>2022-05-03T06:55:15.271Z</atom:updated>
            <content:encoded><![CDATA[<h4>My journey from B2 to C1 English level</h4><figure><img alt="School bus with graffiti on the windshield" src="https://cdn-images-1.medium.com/max/1024/1*Np7TPwhfJZQoltJ8VkMzcw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@gogostevie">Stephen Harlan</a> from <a href="https://unsplash.com/photos/Q-89oREHayk">Unsplash</a></figcaption></figure><p>I’m a software engineer. And I’m communicating with folks all over the globe. English is the best way to exchange thoughts.</p><p>I’m from Ukraine. Every mature software development company here requires speaking and writing English from its employees at least at the B1 level. This is the minimal level to be able to:</p><ul><li>read tech documentation and adequately understand it</li><li>communicate in distributed teams</li><li>handle software demos</li><li>write tech documentation</li></ul><p>When I joined EPAM Systems, my English was of B2 level. I joined one awesome project from the United Kingdom. Guys from that project had an incredibly cool English pronunciation… And it was an intense stimulus to work on my level too.</p><p>It took me 3 years to jump from B2 to C1. My C1 English level was confirmed recently on an internal assessment. Read on to see what steps I’ve taken to achieve C1. Also, make note that this is not something unique: these are standard steps that look very natural and obvious. But this may be something like confirmation that you are on the right way.</p><h4>Surround Yourself with English</h4><p>This was rather easy for me as now I’m a software engineer in an international tech company. But that was not always — just (almost) last 3 years. Before the current position, I’d been working for a company that didn’t require a high English level — just level enough for understanding and writing tech documentation. To speed up my learning process I joined the local tech community with the following rule: only English! This was “Code &amp; Coffee Kyiv”.</p><p>When I joined EPAM Systems, it was a huge growth! English is constantly around you, it overwhelms every aspect of the company. As for me, this is the main thing that allowed me to improve my English.</p><h4>Listen to the English Speakers</h4><p>This is the second place on my list. I’m a very active listener of Ukrainian and English podcasts/speakers. Listening allows me to concentrate on the meaning and not distract by something visual. But you can also add watching movies to this list if you like it.</p><p>The best time for listening is a long walk in the morning. This is a time when you are gaining inspiration for the upcoming workday. Why not combine it with listening?</p><h4>Non-Tech Books</h4><p>I’m reading tech books. This is an important part of my self-education. But after 3 years of doing it, it doesn’t look to me like a good way of learning “everyday English”. As a tech person, you are quickly getting adopted to the technical terminology. For this reason, you will definitely fail in everyday English communication if your bookshelf contains only boring tech books.</p><p>My solution for this problem is — Captain Obvious — non-tech books! I’m just starting this journey. But there are already some visible improvements in my small talks. It would be so nice if I started this earlier… Don’t repeat my mistake.</p><h4>Writing Blog Posts</h4><p>At the moment the main reason I’m writing blog posts — improving my English. Sorry for that, if you feel like a guinea pig... Hope my English writing skills are not so bad that you are already thinking about leaving this blog. 😅</p><p>The second thing why I need a blog: make notes/thoughts during my self-education. This is a good way of understanding some new material and maybe giving value to someone who is looking for this material written shortly and without complications.</p><p>This recommendation is important. Try writing! And do it for yourself rather than others. It should not be ideal. It should give you joy and a feeling that you are getting better. As an example, try to look at any famous blogger; I believe he also started by making a blog for himself.</p><p>Okey-dokey, that is it. Hope your journey of learning English is as interesting as mine. Or even better, hope so!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a61952cd66fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Design Patterns #2 — Patterns Classification]]></title>
            <link>https://medium.com/@balovbohdan/object-oriented-design-patterns-2-patterns-classification-76cb2a9f40d2?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/76cb2a9f40d2</guid>
            <category><![CDATA[object-oriented-concepts]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <category><![CDATA[object-oriented-software]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 09:48:24 GMT</pubDate>
            <atom:updated>2022-04-23T09:56:00.060Z</atom:updated>
            <content:encoded><![CDATA[<h3>Object-Oriented Design Patterns #2 — Patterns Classification</h3><h4>Object-oriented design patterns series — Patterns Classification. Short notes in plain English, use cases and live examples.</h4><figure><img alt="Strange creatures graffiti on the brick wall" src="https://cdn-images-1.medium.com/max/1024/1*eo5fytrErjllVkZ89Nnp-A.jpeg" /><figcaption>Picture from <a href="https://unsplash.com/photos/WKQt_X-SKFI">Unsplash</a> by <a href="https://unsplash.com/@alpancell">Alp Ancel</a></figcaption></figure><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-series-of-notes-1f22cb07b5ed">MAIN</a></p><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-series-of-notes-1f22cb07b5ed">PREVIOUS</a></p><p>There are a lot of OO design patterns. For this reason, you should know a bunch of patterns to be able to choose the right one for a specific situation. But in a lot of cases, there is no “right” solution: you may have several suitable options that differ by complexity, scalability, elasticity, and so forth. You should know your system to find the final solution, and no article on the internet will help you with this to the full extent.</p><p>We are going to follow a traditional OO design patterns <a href="https://refactoring.guru/design-patterns/classification">classification — “by purpose”</a>. This classification divides patterns into 3 groups by functional cases they may be used in.</p><p>You will find a lot of high-level information in this series that will allow you to generally understand what design pattern may be useful for your problem. Then I highly recommend you <strong>use provided references to find an in-depth explanation</strong> of the patterns you’re gonna use.</p><h4>Creational</h4><p>This group of patterns is about creating instances of classes in a flexible way. There are approaches that improve code reusability and extensibility.</p><ul><li><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-3-factory-method-32c27b50b1bf">Factory Method</a></li><li>Abstract Factory</li><li>Builder</li><li>Prototype</li><li>Singleton</li></ul><h4>Structural</h4><p>This group of patterns provides ways of building structures of related objects w/o mess and in an elastic manner.</p><ul><li>Adapter</li><li>Bridge</li><li>Composite</li><li>Decorator</li><li>Facade</li><li>Flyweight</li><li>Proxy</li></ul><h4>Behavioural</h4><p>This group of patterns is about solutions for building tolerant communications between objects.</p><ul><li>Chain of Responsibility</li><li>Command</li><li>Iterator</li><li>Mediator</li><li>Memento</li><li>Observer</li><li>State</li><li>Strategy</li><li>Template Method</li><li>Visitor</li></ul><h3>References</h3><ul><li><a href="https://refactoring.guru/design-patterns/classification">Refactoring Guru</a></li><li><a href="https://www.dofactory.com/javascript/design-patterns">dofactory.com</a></li></ul><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-3-factory-method-32c27b50b1bf">NEXT</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76cb2a9f40d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Design Patterns #3 — Factory Method]]></title>
            <link>https://medium.com/@balovbohdan/object-oriented-design-patterns-3-factory-method-32c27b50b1bf?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/32c27b50b1bf</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[object-oriented-software]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 08:59:14 GMT</pubDate>
            <atom:updated>2022-04-23T09:57:18.713Z</atom:updated>
            <content:encoded><![CDATA[<h3>Object-Oriented Design Patterns #3 — Factory Method</h3><h4>Object-oriented design patterns series — Factory Method. Short notes in plain English, use cases and live examples.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WbTzsFwGUVyVbO-6YnXpkA.jpeg" /><figcaption>Picture from <a href="https://unsplash.com/photos/yiVFSP0Sr4g">Unsplash</a> by <a href="https://unsplash.com/@matt_stropp">Matteo Stroppaghetti</a></figcaption></figure><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-series-of-notes-1f22cb07b5ed">MAIN</a></p><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-2-patterns-classification-76cb2a9f40d2">PREVIOUS</a></p><p>Factory Method is a creational OO design pattern. It is useful when a program should flexibly operate with several classes following the same interface. Classes of the same interface are called “Products”. The key point here is that a client code knows only about the “Product” interface and nothing about the specific implementations.</p><p>Just imagine a situation when you want to change your bicycle for a newer one. You are not concerned about the implementation details thinking about how to ride it — you already know how to spin pedals and steer it! (See the “D” principle from <a href="https://stackoverflow.blog/2021/11/01/why-solid-principles-are-still-the-foundation-for-modern-software-architecture/">SOLID</a>.)</p><h3>Use Cases</h3><ul><li>Multiplatform UI components library</li><li>A set of different Employee classes: Admin, Writer, Reviewer…</li></ul><h3>UML Diagram</h3><figure><img alt="UML Diagram of Factory Method Design Pattern" src="https://cdn-images-1.medium.com/max/1024/1*sagvTu600AnqM8lHYzwSQQ.png" /><figcaption>UML Diagram of Factory Method Design Pattern</figcaption></figure><h3>Example</h3><p>TypeScript code example may be found in my <a href="https://github.com/balovbohdan/oop-crib/tree/main/visualization/src/patterns/creational/factory-method">GitHub repo</a>.</p><p>Also, there is a visualization of how this pattern may be used on my <a href="https://balovbohdan.github.io/oop-crib/">GitHub page</a>. This is a contrived example, so, don’t judge too strong, please.</p><h3>References</h3><ul><li><a href="https://refactoring.guru/design-patterns/factory-method">Refactoring Guru</a></li><li><a href="https://www.patterns.dev/posts/factory-pattern/">patterns.dev</a></li><li><a href="https://www.dofactory.com/javascript/design-patterns/factory-method">dofactory.com</a></li><li><a href="https://stackoverflow.blog/2021/11/01/why-solid-principles-are-still-the-foundation-for-modern-software-architecture/">SOLID</a></li></ul><p>NEXT (coming soon…)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32c27b50b1bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Design Patterns — Series of Notes]]></title>
            <link>https://medium.com/@balovbohdan/object-oriented-design-patterns-series-of-notes-1f22cb07b5ed?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f22cb07b5ed</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <category><![CDATA[object-oriented-software]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Sat, 23 Apr 2022 07:41:04 GMT</pubDate>
            <atom:updated>2022-04-23T09:53:46.562Z</atom:updated>
            <content:encoded><![CDATA[<h3>Object-Oriented Design Patterns #1 — Series of Notes</h3><h4>Series of notes about object-oriented design patterns. In plain English and with live examples.</h4><figure><img alt="Graffiti on a concrete wall" src="https://cdn-images-1.medium.com/max/1024/1*BY-3Mw3eTQ9crOCI06ybQA.jpeg" /><figcaption>Picture from <a href="https://unsplash.com/photos/o9RLeUVowG8">Unsplash</a> by <a href="https://unsplash.com/@sunyu">Sunguk Kim</a></figcaption></figure><p>I’m a software engineer. And this is a series of my notes about object-oriented design patterns. I have experience with both object-oriented and functional programming. This is why I can provide a critical vision of these programming paradigms w/o a blind passion for one of them.</p><p>This series consists of articles about popular design patterns and “live” examples.</p><p>Example code is written with TypeScript; this language looks like the best option for making a general concepts overview.</p><p>“Live” examples may be found on a special <a href="https://balovbohdan.github.io/oop-crib/">GitHub page</a>. I used the awesome <a href="https://github.com/epam/UUI">@epam/uui</a> React components library to develop them.</p><p>See my <a href="https://github.com/balovbohdan/oop-crib">GitHub repo</a> for more details.</p><h3>Why you may need this series?</h3><ul><li>Quickly refresh OO design patterns.</li><li>Remember patterns using “live” examples.</li><li>Understand use cases for different patterns.</li></ul><h3>In-depth info</h3><p>I’m referencing the following resources developing these series. They may be useful to find in-depth information about a topic you are interested in.</p><ul><li><a href="https://refactoring.guru/">Refactoring Guru</a></li><li><a href="https://www.patterns.dev/">patterns.dev</a></li><li><a href="https://www.dofactory.com/javascript/design-patterns">dofactory.com</a></li></ul><h3>Contents</h3><ul><li><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-2-patterns-classification-76cb2a9f40d2">Patterns Classification</a></li><li><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-3-factory-method-32c27b50b1bf">Factory Method</a></li><li>Abstract Factory</li><li>…coming soon…</li></ul><p><a href="https://medium.com/@balovbohdan/object-oriented-design-patterns-2-patterns-classification-76cb2a9f40d2">NEXT</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f22cb07b5ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Reuse Code in React]]></title>
            <link>https://medium.com/better-programming/how-to-reuse-code-in-react-40637747125f?source=rss-f7d6abaaa99b------2</link>
            <guid isPermaLink="false">https://medium.com/p/40637747125f</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Bohdan Balov ]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 14:19:15 GMT</pubDate>
            <atom:updated>2022-02-11T19:04:28.643Z</atom:updated>
            <content:encoded><![CDATA[<h4>Techniques that will help you share React code in a right way</h4><figure><img alt="A bookstore" src="https://cdn-images-1.medium.com/max/1024/1*jEOacbJ4tAIDyjJTvVKKiA.jpeg" /><figcaption>Image by <a href="https://unsplash.com/@noemieke">Noémi Macavei-Katócz</a> on <a href="https://unsplash.com/photos/Zsiuja6HQCU">Unsplash</a></figcaption></figure><p>Hi! I’m a lead software engineer at EPAM Systems, and today I want to write down my thoughts and experience about reusing code in React projects.</p><p>I’m working on a cool project with a very big frontend codebase, and most of it is React. I face code reusability problems every day, and there are some techniques that I widely and successfully use. This is why I have all rights to consult you on this subject.</p><p>Maybe you already know some or all techniques and principles from this writing. Anyway, I hope this will give you some useful information that will help you increase the quality of your codebase.</p><p>Let’s go!</p><h3>A Tale of Confronting DRY and AHA</h3><p>You should already know this design principle — Don’t Repeat Yourself. Right? This sounds absolutely clear and reasonable: code duplications must be avoided. But where are boundaries? Should we avoid every code duplications we face? What is the minimal code size that should be made shared and reusable?</p><p>It’s a tricky question, you know. And I would suggest you be careful with the DRY principle as it can make your code unsupportable at all. But what is the problem here?</p><p>Have you ever heard about the AHA design principle? This abbreviation stands for Avoid Hasty Abstractions. <a href="https://kentcdodds.com/blog/aha-programming">There is a great article</a> by <a href="https://medium.com/u/db72389e89d8">Kent C. Dodds </a>about this principle. In short, it warns you on using a lot of abstractions. But what is abstraction? This is a shared and reusable piece of code that was hidden under the unified interface to prevent code duplications!</p><p>But, where is the truth, you may ask? From one side you hear that you should avoid duplicated code, and from another — that you should avoid abstractions (i.e., shared code). To answer this question, we need to dive deeper…</p><h3>A Tale of Harmonious DRY and AHA</h3><p>In this section, we are going to look for a balance. Because this is the main thing in the debates about reusability and supportability. Let’s start with a green light for sharing a piece of code.</p><p><strong>Step 1: a new feature.</strong> Just imagine that you are in the middle of developing a new “awesome-feature-1” for your project. And as a part of this feature, you add file uploading functionality: this consists of the “FileDropArea” React component and the “FileUploader” helper class. Implementation details are not interesting for us in this context — just conceptual things.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca4f039989879e56b6146c64d1047bab/href">https://medium.com/media/ca4f039989879e56b6146c64d1047bab/href</a></iframe><p>It is obvious in this step that making any code shared is not a good idea. So, we can move on.</p><p><strong>Step 2: one more new feature.</strong> And now you are in the middle of developing the “awesome-feature-2” after some time. And you need to have a file drop area here as well as in the previous. What are your actions! In most similar situations, folks are going to make the “file-drop-area” component shared. And in my opinion, it is completely wrong! This is a good example of a hasty abstraction — when you don’t know all possible use cases and try to share a piece of code.</p><p>So, what to do in this case? Please, just make a copy of the file-drop-area component for the “awesome-feature-2.” This copy may have some differences from the initial example, and this is absolutely OK — you don’t need to share anything on this step.</p><p><strong>Step 3: and one more new feature.</strong> And the same again: new “awesome-feature-3” with file-drop-area. Let me be concise. This is that desired moment to make the file-drop-area shared. You need to develop a unified API for this shared React component and reuse it in all features containing this functionality.</p><p>How would you organize it? This is my suggestion.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80c4129b8fd418df94751ec41a07ab42/href">https://medium.com/media/80c4129b8fd418df94751ec41a07ab42/href</a></iframe><h3>Wrong Abstractions</h3><p>And now you may ask how to recognize hasty abstractions and avoid them. You should look at that article by <a href="https://medium.com/u/db72389e89d8">Kent C. Dodds</a> for details. And there are my points from the top of my head.</p><p><strong>Avoid abstractions on abstractions.</strong> Fewer words and useful examples. Let’s imagine that we have a function to check whether a user is of some type.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2da1e9e55c1c8077c03009666431ab86/href">https://medium.com/media/2da1e9e55c1c8077c03009666431ab86/href</a></iframe><p>This is an example of correct usage:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c79a30c66764dfe380b2f69da7220a69/href">https://medium.com/media/c79a30c66764dfe380b2f69da7220a69/href</a></iframe><p>And this is an example of the wrong usage, that represents abstraction on abstraction.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/107f6a6b10d9131afc4f1ae8da5f9ab8/href">https://medium.com/media/107f6a6b10d9131afc4f1ae8da5f9ab8/href</a></iframe><p>Definitely, there are cases where we need to have abstractions on abstractions. But in most cases, such low-level functions like getIsUserOfType should not have such abstractions.</p><p><strong>Keep duplicated code under control</strong>. You should know how to duplicate code in the right way. Most probably it’s a good idea to have a clear policy about code duplications in your project.</p><p>There are two types of duplicated code:</p><ul><li>Duplicated code that provides flexibility to the feature/app.</li><li>Duplicated code that’s waiting for its time to be made universal and shared.</li></ul><h3>How to Share Code?</h3><p>I don’t want to write a lot of words about React techniques to share code. Why? Just because there are a lot of articles on this topic! There are items you should pay attention to.</p><p><strong>HOC.</strong> This is a standard and the most widely used technique before React hooks were introduced. There are still a lot of useful libs that expose HOCs. You can create your custom ones as well. But consider using hooks.</p><p><strong>React hooks.</strong> This is the best thing you can use to reuse code. I widely use it nowadays.</p><p><strong>Shared components.</strong> The easiest option. We looked at it in the “Step 3: and one more new feature” section. It goes very well in companion with <a href="https://storybook.js.org/">Storybook</a> and <a href="https://bit.dev/">Bit</a>.</p><p>That’s it!</p><p>I started this article during two days in a hospital. It looks more like a set of thesis you can use for diving deeper and adjusting to your needs. Hope this was helpful for you.</p><p>Let’s keep in touch.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40637747125f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/how-to-reuse-code-in-react-40637747125f">How To Reuse Code in React</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>