<?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 Mike Mulev on Medium]]></title>
        <description><![CDATA[Stories by Mike Mulev on Medium]]></description>
        <link>https://medium.com/@mulev?source=rss-d3f09e182d4d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*PlUMsLxyxY-X0pQ3kqR-qw.jpeg</url>
            <title>Stories by Mike Mulev on Medium</title>
            <link>https://medium.com/@mulev?source=rss-d3f09e182d4d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:48:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mulev/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[Digesting React Native one piece at a time: infinite scroll]]></title>
            <link>https://medium.com/@mulev/digesting-react-native-one-piece-at-a-time-infinite-scroll-1b18a15c556?source=rss-d3f09e182d4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b18a15c556</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Mike Mulev]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 19:27:03 GMT</pubDate>
            <atom:updated>2020-07-01T20:26:00.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0dCl_EY3wUc1sjdBXGCaw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Fabian Grohs</a> on <a href="https://medium.com/s/photos/code?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>React Native is without any doubt a strong and powerful solution. It opens the world of cross-platform app development for a much wider audience of software engineers who aren’t familiar with native technologies. But it might at the same time be quite difficult to implement complex things when you’ve just started learning.<br>In this short tutorial, I want to give a step-by-step guide on how to implement one of them — infinite scroll.</p><h3>The Preparation</h3><p>Ok, so let’s begin. For the purposes of this short tutorial, I’ll use the Expo library — it’s quite handy when it comes to building simple React Native applications. So, make sure the following is installed on your machine:</p><ul><li>Node.js — I’d just go with the latest stable version. To manage Node versions I prefer <a href="https://github.com/nvm-sh/nvm">nvm</a></li><li>Expo.io — install it following their <a href="https://expo.io/learn">official installation guide</a></li></ul><p>First of all, open the console and create a basic minimal app using the expo executable: expo init infinite_scroll. It offers to choose a template from which the application will be created — just go with the blank option, that’s enough to achieve our today’s goal.</p><figure><img alt="A console window with the Expo app initializing process" src="https://cdn-images-1.medium.com/max/1024/1*-1D2hxHGtRiH7mwHx4g1Ig.png" /></figure><p>Now we need to wait a tiny bit while expo is preparing our app and installing all the underlying libraries. Once it’s done we have a fully functional React Native application that we can launch by calling expo start .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMnMfNdLZJciok3IfiNRdQ.png" /></figure><p>Expo offers a very handy option — to run your application in the iOS simulator. That’s how our app looks like when we launch it for the first time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*l86OTaAqfZx62v6EV8mg7A.png" /></figure><h3>The Promising Start</h3><p>Now we’re all set for development — let’s write some code. Open the app directory in your favorite code editor and find there in the root a file named App.js. App.js is the entry point of the application, and that’s how it looks like at the very beginning:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e926b3d417cd8bb7acd655a247f43fd/href">https://medium.com/media/1e926b3d417cd8bb7acd655a247f43fd/href</a></iframe><p>Our goal is to implement an infinite scroll. One of the easiest ways is to display a long list of simple elements and make them properly scrollable. Further in development, you could connect your app to a data source, like an external API, or a local data storage, but we will go with a simple array of elements right in the app code:</p><pre>const data = [<br>  {id: 1, text: &#39;One&#39;}<br>]</pre><p>The second thing we should define is how we will display each of the elements. Since we are working with React Native, we have all the powers of React at our service, so we need to define a new view, that will represent a single element. For that, we’ll define a new const Item and use the functional approach to return a &lt;View&gt; component with a &lt;Text&gt; component inside:</p><pre>const Item = ({item}) =&gt; {<br>  return (<br>    &lt;View&gt;<br>      &lt;Text&gt;{item.text}&lt;/Text&gt;<br>    &lt;/View&gt;<br>  );<br>}</pre><p>Those are all just standard React Native components, so you don’t need to connect any third-party libraries to your project.<br>It’s also a good idea to style our element a bit to make it look nicer, for example as a white rectangle with a shadow so it’ll look like it’s levitating on top of the background.<br>Here’s the final code with the styling applied:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3dc98bca7930a9670d057660a7549ddc/href">https://medium.com/media/3dc98bca7930a9670d057660a7549ddc/href</a></iframe><p>After that, we’re almost all set to see the first list element gently floating over the background of our iOS Simulator. And the last thing due is actually the core thing to make our list infinitely scrollable — the &lt;FlatList&gt; component. You can find more about it in the <a href="https://reactnative.dev/docs/flatlist">official documentation</a>.<br>On a short note, it takes three basic input arguments to do its job:</p><ul><li>data, where the data source should be passed. In our case, it’s a constant with the same name that we’ve defined on an earlier step;</li><li>renderItem, to which we pass the defined earlier Item constant and which makes sure to render each of the data;</li><li>keyExtractor that is responsible for finding unique keys in your data set — they’re required for proper rendering of elements.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ce90adf44c771323fb7dc90ecc03739/href">https://medium.com/media/5ce90adf44c771323fb7dc90ecc03739/href</a></iframe><p>After applying those changes to the App.js, we can see first satisfying and encouraging results in the Simulator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*AbsQkyaR2SWWzlKUoaYmCA.png" /></figure><h3>The Mighty Eighteen</h3><p>Now that we have everything in place for multiple list elements, let’s just add them — The Mighty Eighteen items that will take all the Simulator screen and even more. And that’s exactly what we need to test our implementation of the infinite scroll.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/403f1ec5516968d96bdb71ca2a3a470f/href">https://medium.com/media/403f1ec5516968d96bdb71ca2a3a470f/href</a></iframe><p>The last thing that will wrap it all up is the &lt;SafeAreaView&gt; React Native component that ensures its enclosed content will not conflict with any other components around it. Please see more in the <a href="https://reactnative.dev/docs/safeareaview">official documentation</a>.</p><p>Here’s the final state of the App.js:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00923c34f71aef8dd6d4f2751c9a8229/href">https://medium.com/media/00923c34f71aef8dd6d4f2751c9a8229/href</a></iframe><p>And that’s how the scrolled down feed in the app looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*etmVmKRj_VoKN7KX8cyLJw.png" /></figure><p>In the next tutorial, we’ll add a button floating on top of our items list and make that button adding even more items to the list.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b18a15c556" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to solve programming interview tasks]]></title>
            <link>https://medium.com/@mulev/how-to-solve-programming-interview-tasks-fa2f74001a00?source=rss-d3f09e182d4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa2f74001a00</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <dc:creator><![CDATA[Mike Mulev]]></dc:creator>
            <pubDate>Fri, 08 Jun 2018 15:25:58 GMT</pubDate>
            <atom:updated>2019-07-04T11:19:18.937Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever attended a software engineer interview as an applicant? Then, I bet, you know that most of them need you to solve various coding tasks heavily detached from reality.</p><p>It looks like a time waste on first sight, most of us felt angry at least once after such interviews. But hold on a bit and try to imagine yourself hiring software engineers — how can you be sure that an applicant will be a good problem solver in the real world? Yes, that’s a common problem and many companies solve it by using coding tasks. Because if you can design and implement an efficient algorithm in fifteen-twenty minutes than there are high chances that you’ll be able to make proper decisions when something will go wrong in production with the real product.</p><p>So, how to solve coding tasks effectively? Of course, you need to practice a lot. But we are developers and we know that it isn’t enough, we need an algorithm that will increase our chances to solve most of the tasks without pain. I spent at least 3 months preparing for different interviews and I figured out several rules that could be really helpful:</p><ul><li>questions are important</li><li>decomposition is a mother of success</li><li>first success must force you to verify your solution two times more</li></ul><p>Let’s take a closer look at these rules. To be more concrete I’ll use Codility’s “TapeEquilibrium” task as an example interview coding task. All code examples I’ll give in Ruby, but all pieces of advice in that article are applicable to any programming language you prefer to use. Task description can be found here (Codility prohibits its users from copying task descriptions): <a href="https://app.codility.com/programmers/lessons/3-time_complexity/tape_equilibrium/">TapeEquilibrium coding task — Learn to Code — Codility</a>.</p><h3>Questions are important</h3><p>Imagine yourself in an interview in one of the giants — Google, Apple or Amazon. They all give candidates a lot of different coding tasks during the interview process. One of the questions might sound like “Let’s build new Netflix”. You’ve been just asked to design new Netflix, really. A slightly huge app, isn’t it? ;) One hour interview definitely isn’t enough to design it carefully.</p><p>But what you should do then? Correct, you need to ask as many questions as you can to reduce the given problem to something small and solvable. Like one important component — movies library storage system, search, streaming or, probably, billing. When you’ll have one small component it’ll be much easier to show interviewer all your skills and knowledge.</p><h3>Decomposition is a mother of success</h3><p>Decomposition is one of the fundamental principles in software development (and problem-solving in general). And it can help you split given task into smaller and simpler steps.</p><p>Let’s do it with “TapeEquilibrium”. After reading the task description we see that it can be split into several steps:</p><ul><li>identify all possible dividers — Any integer P, such that 0 &lt; P &lt; N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A[N − 1]</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c3300df0a8d1191e4bbc6fdcddd40f2/href">https://medium.com/media/5c3300df0a8d1191e4bbc6fdcddd40f2/href</a></iframe><ul><li>calculate all possible differences — The difference between the two parts is the value of: |(A[0] + A[1] + ... + A[P − 1]) − (A[P] + A[P + 1] + ... + A[N − 1])|</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/844b79e2a04947b25ae9f1de262c6f91/href">https://medium.com/media/844b79e2a04947b25ae9f1de262c6f91/href</a></iframe><ul><li>take the lower one</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce55cbe9a288fe93c9c7a8849bdab44e/href">https://medium.com/media/ce55cbe9a288fe93c9c7a8849bdab44e/href</a></iframe><h3>First success must force you to verify your solution two times more</h3><p>Okay, let’s submit our solution. But wait, what is it? Our solution is correct, but low performant — zero percents for performance score because Codility identified our solution as O(n * n). And the maximum allowed complexity was O(n). So, what we should improve?</p><p>Taking a more precise look at our code we can notice that each iteration of our loop contains an iterative calculation of array elements sum:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d9d81c1fb1b29bbb5c49b044a8a62c7/href">https://medium.com/media/1d9d81c1fb1b29bbb5c49b044a8a62c7/href</a></iframe><p>Yes, each time we call .inject we iterate over the given part of the array to calculate the sum of elements. And that is exactly the root cause of the increased time complexity of our solution. To fix it we should remove iterative calculations, or extract into a higher level of our method. A good idea will be to calculate all possible sums of elements before all other operations:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86ab842c82cb527775b2311140a88443/href">https://medium.com/media/86ab842c82cb527775b2311140a88443/href</a></iframe><p>After that, we can simply get needed sums from the sums array to calculate our difference:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1618020ecddef31e85d4554ea801300/href">https://medium.com/media/a1618020ecddef31e85d4554ea801300/href</a></iframe><h3>Full solution</h3><p>After some other minor improvements our solution, giving us 100% of correctness and 100% percent of performance will look like that:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1bd61d59add59e229a5f3a561afc9d1/href">https://medium.com/media/b1bd61d59add59e229a5f3a561afc9d1/href</a></iframe><h3>As a conclusion</h3><p>IMO, the most important thing about any coding interviews is practice. Practice a lot, use different platforms such as Codility, HackerRank, and many others, to master your skill. And don’t be afraid of failures, they definitely identify the road to success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa2f74001a00" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>