<?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 Faiz Hameed on Medium]]></title>
        <description><![CDATA[Stories by Faiz Hameed on Medium]]></description>
        <link>https://medium.com/@faizhameed?source=rss-f798ccd007d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*WA67h9OKl43Lxp5AP2TU1g.jpeg</url>
            <title>Stories by Faiz Hameed on Medium</title>
            <link>https://medium.com/@faizhameed?source=rss-f798ccd007d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 12:59:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@faizhameed/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[How I Built My Reputation as a Software Engineer: 3 Key Steps That Led to Google]]></title>
            <link>https://faizhameed.medium.com/how-i-built-my-reputation-as-a-software-engineer-3-key-steps-that-led-to-google-2c7caa24a3a5?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c7caa24a3a5</guid>
            <category><![CDATA[getting-hired]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[reputation]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 09:55:13 GMT</pubDate>
            <atom:updated>2024-08-15T10:03:29.804Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Built My Reputation as a Software Engineer: 3 Key Steps That Led to Google — A Beginner’s Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HexXnHH5x1Lx9IqxoNAU4A.jpeg" /></figure><p>Personally, these steps were key in helping me land a software engineering role at Google. Im talking about the visibility you need to stand out to land an interview. In addition, I dedicated significant time to practising Data Structures, Algorithms, and System Design more about it in my <a href="https://medium.com/@faizhameed/how-i-cleared-google-interviews-being-a-self-taught-software-developer-1bf77e3301b2">other post</a>. No lengthy post — just three points that I believe are most effective.</p><ol><li><strong>Build awesome projects</strong>. There are plenty of quality projects available for free on YouTube. Moreover, purchase courses specific to your liking and build projects but make sure you’re not just cloning others’ work. Build something different with the knowledge</li><li><strong>Market yourself well.</strong> Talk about software engineering and new technology. More importantly, the projects you have built. And dont boast online, it can come across as arrogant. Be humble and ask for feedback. Talk about what you are learning and things you find out. Reach out to experts for opinions on subjects</li><li><strong>Contribute to open-source projects</strong>. Hard for beginners, but once you have strong fundamentals, you can search for good open-source projects to contribute to</li></ol><p>If it helped consider sharing with your friends and family who might be aspiring to become a great software engineer<br>Follow me @<a href="https://www.linkedin.com/in/faizhameed/">LinkedIn</a> and <a href="https://github.com/faizhameed">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c7caa24a3a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Mechanical Engineering to Google: A Self-Taught Engineer’s Guide to Cracking the Google…]]></title>
            <link>https://faizhameed.medium.com/how-i-cleared-google-interviews-being-a-self-taught-software-developer-1bf77e3301b2?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bf77e3301b2</guid>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Sun, 23 Apr 2023 09:16:03 GMT</pubDate>
            <atom:updated>2023-07-21T05:02:06.169Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Mechanical Engineering to Google: A Self-Taught Engineer’s Guide to Cracking the Google Interview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z1wYmDyLefdgR5hm" /><figcaption>Photo by <a href="https://unsplash.com/@joshuaearle?utm_source=medium&amp;utm_medium=referral">Joshua Earle</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This piece of writing to respond to the numerous inquiries I receive regarding my preparation approach on social media, particularly <a href="https://www.linkedin.com/in/faizhameed">Linkedin</a>. I don’t mean to be disrespectful, but it’s difficult to respond to each of you individually. And many times, similar questions are asked by different people.</p><h3><strong>My Journey as a software developer</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*LV2UETtbcqWWG38gE2FeXg.jpeg" /><figcaption>Image by <a href="https://pixabay.com/users/joshuaworoniecki-12734309/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4891499">Joshua Woroniecki</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=4891499">Pixabay</a></figcaption></figure><p>I did have some background in Computer Science from my 11th and 12th standards. Math and computer science were actually my favourites since they were so simple.</p><p>I pursued Mechanical Engineer, but I had a hard time during my course, I had to take supplementary exams multiple times since I failed my first attempt. However, I cleared all my papers before the graduation period.</p><p>After graduation, I took a couple of courses in HVAC etc and joined as a sales engineer. I was paid around 5000 rupees (61$) per month, so yea I couldn’t meet my expenses. Later I joined a company in Dammam, Saudi Arabia as a Mechanical Engineer, that&#39;s the time when I realized, this path is not for me. And I started learning web development and coding again after my work hours because I knew I wanted to make some shift to doing something I love or am happy doing. You can read about the rest <a href="https://medium.com/zerotomastery/how-i-transitioned-from-mechanical-engineering-into-web-developer-full-time-3e7ddc236388"><strong>here</strong></a></p><p>This is now, after 4 years in software engineering. And it was my third company as a software engineer when I finally thought about joining a FAANG / MAANG. I did build a good reputation on LinkedIn. So I do get approached by top companies like, Amazon, Paypal, Uber etc. And I knew I am not ready for them yet. I should start preparing Data Structures and Algorithms as I have no background in these.</p><h3>My Preparation Strategy</h3><p>I didn&#39;t specifically prepare for Google. It sounded like too far to reach, for folks like me. I prepared for Amazon and gave my first interview. I failed and knew I did so poorly with the initial coding assessment. The recruiter gives a callback and says, you can give it another try after 6 months. I said ok, let&#39;s start learning seriously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*qmKpQLdlZgm4sy-md6arwg.jpeg" /></figure><p>Over the duration of 4 years, I became more proficient with Javascript. So I learning new languages and then practising Data Structures and Algorithms could be time-consuming, so I decided to continue with javascript alone. But from my experience, Google and Amazon tend to favour candidates with good experience with any of the languages like Python, Java, Go and C++. Although I just studied Javascript, I am familiar with Python, but I have never used it for interviews.</p><p>Two courses that I took to learn Data Structures and Algorithms</p><p><a href="https://www.udemy.com/share/1013ja3@Vx3FSYQUx99AdVT54Xs5WKP3B1LMb1fKAvUcrMYAAQgsD5r4QhelshUBmKlp66Rs/">Master the Coding Interview: Data Structures + Algorithms</a></p><p><a href="https://www.udemy.com/share/103J2K3@i88XZxqy-6TScwGNusoA7MP5q97cbh2wHR-dmznRaD931oS6ZGK_vKj6Eg73nggP/">Master the Coding Interview: Big Tech (FAANG) Interviews</a></p><p>The book I purchased</p><p><a href="https://amzn.to/41yk7J6">Cracking the Coding Interview by Gayle Laakman</a>: This book has good topic-wise coverage though explained in Java but it&#39;s understandable and all the solutions in Javascript can be found <a href="https://github.com/careercup/CtCI-6th-Edition-JavaScript">here</a></p><p>The place where I practised a lot of problems: <a href="https://www.leetcode.com/">Leetcode</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*C3AhUOVEF-vujXxAbuiD_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*aHwl76g_bDTOPJ42eqwq7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*1_Zle5d9jXTtioHeqqR9Rg.png" /></figure><p>Most of the problems I practised are from medium difficulty, they are the core of your preparation. Moreover, I try to do multiple ways to solve the same problem, which really helps me engrave patterns in my brain.</p><p>Another thing I focused on after doing the aforementioned course is <a href="https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions">the blind 75</a>. Nearly all of the patterns are touched by the issues in Blind 75. Solve every one of these problems, and if there are multiple ways to do so, understand that as well.</p><blockquote>This is where I made it habitual to start with one problem per day to do 3 problems per day. It got into my daily rituals, so I didn&#39;t have to think about it, I just do it.</blockquote><p>You can also read more about patterns at <a href="https://hackernoon.com/14-patterns-to-ace-any-coding-interview-question-c5bb3357f6ed">Hackernoon</a></p><p><strong>System Design</strong></p><p>I prepared system design specifically for Amazon SDE2 position, Google at L4 there is an option to opt for system design, while I opted for another coding round.</p><p><a href="https://github.com/donnemartin/system-design-primer">GitHub - donnemartin/system-design-primer: Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.</a></p><p><a href="https://www.educative.io/module/r0w3pLt442qp9oAEq/10370001/4985807845982208">Grokking System Design from educative.io</a></p><p>If you wanted to deep dive and learn more, you can have a look at <a href="https://amzn.to/3Ak0850">Designing Data-Intensive Application</a>. I personally only read few pages from the book. I prepared from the course above and read the github resource.</p><h3>My Google interview experience</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*mqIlSgnyQHnMYSZGeEQcjg.jpeg" /></figure><p>I will try to keep this short and share only the essentials here.</p><p>I was approached by a recruiter from Google through LinkedIn. At this point, I am about three months after my failed Amazon interview. I reasoned that because it would help me gain additional interviewing experience, why not give it a shot. Recuriter gave me a month to get ready, which was quite kind of her. I was working on four to five problems per day.</p><p>I attended 4 coding interviews, including initial phone interview which is also coding round. Cleared all them averaging a rating of Good. I pretty felt I answered well on all of them. <br>Since I was a Javascript developer at the time, there weren’t many teams at Google that needed one. Finding a team initially became a minor issue for me, and I had to participate in an additional round of Javascript coding. In the end, I was able to select a team that genuinely wanted me.</p><h4>Front-end vs Back-end</h4><p>For Google, both front-end and back-end interviews are the same. You are expected to work either of them as needed, and I believe this is also true for Amazon. However, interviews for front-end and back-end are conducted differently at companies like Microsoft and Uber.</p><h4>Which coding language to pick?</h4><p>If a language is front-end or backend neutral, it should work for your coding interviews. However, I still believe that Python, Java, Go, and C++ would be the best option here, particularly for Google. Being a front-end developer with a focus on Javascript, I personally found it challenging to join a team after the interview.</p><h4>How to apply or get interviews</h4><p>Apply to job portels of the target company is one strategy. Remember if the companies are too popular there might be plenty of people applying to the same position. <a href="https://www.pathmatch.com/blog/the-pathmatch-guide-to-getting-hired-at-google">Around 3 million application per year for google per year</a></p><p>Therefore better and long strategy is to make good connections with people working in the target companies, understand about the work they do, share if you have done something similar, this way they might be interested and may refer you directly. Linkedin is the best platform for this. And there is higher chance recruiter might see your profile being recommended in their timeline.</p><h3>Final Thoughts</h3><p>Absolutely, working at Google is exciting. I, however, have no strong emotional ties to any company, while always trying to do my best wherever I go. I consider myself to be an individual owner here, any subpar effort can damage my reputation. In addition, luck also contributes. The question you get, you mental health on the day of the interview etc. So don’t focus on a single company, focus on doing the best.</p><p>Everywhere there are layoffs, and applying to these companies can be challenging since they are becoming pickier about who they hire</p><p>hopefully things will change. However, nothing should stop you from becoming the best.</p><p>I am a football lover. I play football every day, this is something that keeps me healthy as well. Playing sports or exercising refreshes the mind. I don&#39;t miss more than two days without any physical activity. Remove every other distraction and you will be successful.</p><p>Since you have read till here, I feel you could also be thinking the same as me. Now it’s time to get started with your journey and be excited. Please share your thoughts in the comments. I would highly appreciate if you could support me by clicking the clap button at the bottom.</p><p>If it helped consider sharing with your friends and family who might be aspiring to become a great software engineer<br>Follow me @ <a href="https://www.linkedin.com/in/faizhameed/">LinkedIn</a> and <a href="https://github.com/faizhameed">GitHub</a></p><p>Disclaimer: Although the links I’ve provided may be affiliates, I genuinely am not endorsing anything that I haven’t personally used on this journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf77e3301b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open the lock problem with JavaScript]]></title>
            <link>https://faizhameed.medium.com/open-the-lock-problem-with-javascript-1893d043aef6?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1893d043aef6</guid>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[graph]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Wed, 17 Nov 2021 14:17:00 GMT</pubDate>
            <atom:updated>2021-11-17T14:17:00.453Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: </strong><strong>&#39;0&#39;, &#39;1&#39;, &#39;2&#39;, &#39;3&#39;, &#39;4&#39;, &#39;5&#39;, &#39;6&#39;, &#39;7&#39;, &#39;8&#39;, &#39;9&#39;. The wheels can rotate freely and wrap around: for example we can turn </strong><strong>&#39;9&#39; to be </strong><strong>&#39;0&#39;, or </strong><strong>&#39;0&#39; to be </strong><strong>&#39;9&#39;. Each move consists of turning one wheel one slot.</strong></p><p><strong>The lock initially starts at </strong><strong>&#39;0000&#39;, a string representing the state of the 4 wheels.</strong></p><p><strong>You are given a list of </strong><strong>deadends dead ends, meaning if the lock displays any of these codes, the wheels of the lock will stop turning and you will be unable to open it.</strong></p><p><strong>Given a </strong><strong>target representing the value of the wheels that will unlock the lock, return the minimum total number of turns required to open the lock, or -1 if it is impossible.</strong></p><p><a href="https://leetcode.com/problems/open-the-lock/">Link to leetcode</a></p><p>This problem can be solved by shortest path problem on a graph. We start at 0000 for each step there is 8 possible directions we can take. for example for</p><p>0000 next connections are 1000, 9000, 0100, 0900, 0010, 0090, 0001, 0009</p><p>Similarly if we take next step as 1000 the combinations are 1001, 9001, 0101, 0901, 0011, 0091, 0002, 0000 here if we notice 0001 will lead to 0000 again. So we have to keep track of these combinations in a separate data structure to avoid taking this as next step.</p><p>So we will be having two functions one to loop through each step in a bread first search fashion and the other to generate the next possible combinations</p><p>Here is the javascript implementations</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6ba11b55e56b0c3366ce48515b29b25/href">https://medium.com/media/c6ba11b55e56b0c3366ce48515b29b25/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1893d043aef6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redux-Saga with React -  Fetching from Geolocation API]]></title>
            <link>https://faizhameed.medium.com/redux-saga-with-react-fetching-from-geolocation-api-1ec8bf59d7cd?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ec8bf59d7cd</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[geolocation]]></category>
            <category><![CDATA[redux-saga]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Thu, 29 Oct 2020 16:12:28 GMT</pubDate>
            <atom:updated>2020-10-29T16:12:28.756Z</atom:updated>
            <content:encoded><![CDATA[<h3>Redux-Saga with React - Fetching from Geolocation API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E30eXZaY0QxMZr_KPOvugA.png" /></figure><p>Geolocation works just as an asynchronous call. It&#39;s fairly simple to fetch it and store it in the component state with react. With redux-saga, you can easily do it by the following method</p><blockquote>actions.js</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5f2adfe7b3107534dd2ef7477148b70/href">https://medium.com/media/a5f2adfe7b3107534dd2ef7477148b70/href</a></iframe><blockquote>geoSaga.js</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fe94eb9d10c90b1493daff5cad458c8/href">https://medium.com/media/9fe94eb9d10c90b1493daff5cad458c8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ec8bf59d7cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redux with React for Complete Beginners]]></title>
            <link>https://faizhameed.medium.com/redux-with-react-for-complete-beginners-2dad3ec9632b?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dad3ec9632b</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Sun, 17 May 2020 11:45:04 GMT</pubDate>
            <atom:updated>2020-05-17T11:45:04.469Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3IdTLOktQ-eXg30W5A9znw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@umby?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Umberto</a> on <a href="https://unsplash.com/s/photos/technology?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When I was beginning with react it was a little bit hard to get around with redux state management. I failed interviews because I couldn’t explain well how this works. And so later I learnt this by building apps and trying tutorials on redux. It took some time to actually get a grasp on it. But when I understood the concepts behind it was never that hard.</p><p>Here, I wanted to explain the concepts and setups as easy as possible, so a beginner with react knowledge can understand it.</p><h3>Why state management is Important</h3><p>When you build your application which has many components, it becomes difficult to subscribe to state changes. You might need to keep lifting the state up to the parent component then passing it down the tree as props for other components to use it. Which is not ideal for large applications. Code becomes less readable and a lot of repetition occurs. That’s why redux comes to rescue. There are alternatives to redux like mobx, rxjs(usually used with angular)</p><p>So let&#39;s start here with the diagram below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wN-NJrGApH4i-I6Amf9dhg.png" /><figcaption>Application without redux</figcaption></figure><p>Here is an app diagram without redux. Consider all the circles as components. A worst-case would be a component down at the tree level initiate an update to a state which in turn initiate change in the parent component and from parent component other components may need to subscribe to this changes. But in practice, this is quite overwhelming. The state will be needed to be lifted to the top parent level where the changes can be drilled into other components.</p><p>With state management library Redux you can easily solve this problem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRzktJ3N8kCf91jOMM7QVg.png" /><figcaption>Application with Redux</figcaption></figure><p>Here a change is initiated and the store gets the update with the actions you dispatch to make the change. In redux, you dispatch actions to update the state. You should not directly mutate the state otherwise the components will not subscribe to the changes and thus re-rendering will not happen.</p><h4>Redux Data Flow</h4><p>It&#39;s important to understand the basic structure of how redux works. Redux follows the unidirectional data flow. It means that your application data will follow in a one-way binding data flow. It reduces the complexity of code on when to update the state with new changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EBxo6Fjzz2GJUAQ6xFo2pA.png" /></figure><p>Action is created when a user interacts with the view, then this action is dispatched to root reducer function. Now the root-reducer function is called with the current state and dispatched action.</p><p>The reducer may divide the action among its child reducers and a new state returns after executing the actions. Now the store notifies the view about the new changes. The view now can retrieve the changes and re-render again.</p><h3>Let’s create a basic app with react and redux</h3><pre>npx create-react-app react-redux-tutorial</pre><p>Let’s move into your created folder now</p><pre>cd react-redux-tutorial</pre><p>Now let’s install react-redux and redux. If you are using npm its <em>npm install</em> command to install the dependencies</p><pre>yarn add redux react-redux</pre><p>or</p><pre>npm install redux react-redux</pre><p>Redux is the main library that helps to create a store, make actions and listen to state updates. Basically utilizing Redux with any UI layer requires the equivalent predictable arrangement of steps:</p><ol><li>Make a Redux store</li><li>Buy into refreshes</li><li>Inside the membership callback:<br>i. Get the present store state<br>ii. Concentrate the information required by this bit of UI<br>iii. Update the UI with the information</li><li>Render the UI with starting state</li><li>React to UI contributions by dispatching Redux actions</li></ol><p>That&#39;s just the concept behind adding Redux library with installation, now to bind redux to react you can do it by hand-coding, but it&#39;s not ideal for performance and to keep it <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> and readable. So instead you have the right tool react-redux which help us to do all the redux bindings with react.</p><p>Ok now lets set up redux in working mode with your app.</p><p>Let&#39;s add a folder name <strong>redux </strong>inside the <strong>src folder</strong> of your project and create two files one named as <strong>root-reducer.js</strong> and the other as <strong>store.js</strong></p><p>Setup for <strong>root-reducer.js</strong> as follows:</p><pre>import { combineReducers } from  &quot;redux&quot;;<br>const  initialState  = {<br>    books: [],<br>};<br>function  bookReducer(state  =  initialState, action) {<br>    return  state;<br>}</pre><pre>const  rootReducer  =  combineReducers({<br>    bookReducer,<br>});</pre><pre>export  default  rootReducer;</pre><p>You are creating an Initial state here with a field book as a sample data and also a function bookReducer to help with updating the state of book in your initial state. Later you can move this Initial state of the book and bookReducer function into a separate folder and just import them to rootReducer that’s usually done when you are having a lot of state data and you wanted to classify them separately</p><p>And you could simply write all the reducers in a single pure function, buts it&#39;s not ideal for debugging purpose when you plan for a large application. What you do is import combineReducers which basically helps us to combine several reducer functions together.</p><p>Setup for <strong>store.js</strong></p><pre>import { createStore } from  &quot;redux&quot;;<br>import  rootReducer  from  &quot;./root-reducer&quot;;<br>export  const  store  =  createStore(rootReducer);</pre><p>Here you are actually creating the store and connecting your reducer to the store so that your app can successfully subscribe to the changes in the state.<br>The createStore just creates a Redux <a href="https://redux.js.org/api/store">store</a> that holds the complete state tree of your app. There should only be a single store in your app.</p><p>Then you are just importing your root reducer and connecting it to the createStore function, this createStore( ) function returns the store for your app which you are assigning to a constant variable store<br>Let’s connect the store to your app. Right now you only created some files you are not doing anything to make your app read the state. So let’s go to index.js that is your root component.<br>At <strong>index.js</strong> you import provider fromreact-redux. The &lt;Provider /&gt; makes the Redux store available to any nested components that are wrapped with the connect function. The connect function is just a function that takes the component as a parameter and connects the redux store to it. That&#39;s how the redux works when the state changes the component gets rerendered.</p><p>Setup at index.js</p><pre>import  React  from  &quot;react&quot;;<br>import  ReactDOM  from  &quot;react-dom&quot;;<br>import  &quot;./index.css&quot;;<br>import  App  from  &quot;./App&quot;;<br>import { Provider } from  &quot;react-redux&quot;;<br>import { store } from  &quot;./redux/store&quot;;<br>import  *  as  serviceWorker  from  &quot;./serviceWorker&quot;;</pre><pre>ReactDOM.render(<br> &lt;Provider  store={store}&gt;<br>  &lt;React.StrictMode&gt;<br>   &lt;App  /&gt;<br>  &lt;/React.StrictMode&gt;<br> &lt;/Provider&gt;,<br>document.getElementById(&quot;root&quot;)<br>);<br>serviceWorker.unregister();</pre><p>Now if you wanted to change the state of your app, the only way to do is by dispatching actions.<br>Ok now let&#39;s create actions! Let&#39;s create two more files in the redux folder and name it as types.js and actions.js<br><strong>Note:</strong> Here you are actually creating two files in the same folder, but when your app is large its best to create new folders with the appropriate name and add the related actions, types and reducers files to it, so that classification is much easier. You will thank yourself for doing this later.</p><p><strong>Setup for types.js</strong></p><pre>export  const  actionTypes  = {<br>  ADD_BOOK: &quot;ADD_BOOK&quot;,<br>};</pre><p>Types are nothing but signalling the type of actions you are doing. Actually its perfectly fine to go without this, by writing the action names directly to your actions and reducers. But this is not much recommended since you can miss type names, so the state updation doesn&#39;t happen since this won&#39;t throw any errors, for us to debug properly.</p><p><strong>Setup for actions.js</strong></p><pre>import { actionTypes } from  &quot;./types&quot;;<br>export  const  addBooksToState  = (data) =&gt; ({<br>type:  actionTypes.ADD_BOOK,<br>payload: data,<br>});</pre><p>Now you need to make the reducer aware of this action type so you can modify your root-reducer.js as follows</p><pre>import { combineReducers } from  &quot;redux&quot;;<br>import { actionTypes } from  &quot;./types&quot;;<br>const  initialState  = {<br>books: [],<br>};<br>function  bookReducer(state  =  initialState, action) {<br>switch (action.type) {<br>case  actionTypes.ADD_BOOK:<br>        return {<br>           ...state,<br>	    books: [...state.books,  action.payload],<br>        };<br>default:<br>	break;<br>}<br>	return  state;<br>}</pre><pre>const  rootReducer  =  combineReducers({<br>	bookReducer,//you can add more reducers here<br>});</pre><pre>export  default  rootReducer;</pre><p>Now the important concepts here are map state to props and map dispatch to props you can declare both of them as functions. Map state to props is just simply as what it says. It allows your component to know what states are you going to subscribe and use.<br>Similarly, the dispatch lets the component to update the state by actions from your actions file.<br>for example, this is how you define it with the redux store and actions you created</p><pre>const  mapStateToProps  = (state) =&gt; ({// you can do destructuring<br>//here<br>   books:state.bookReducer.books <br>})</pre><pre>const  mapDispatchToProps  =(dispatch)=&gt;( {<br>      addBooksToState:(book)=&gt;dispatch(addBooksToState(book))<br>// you have to import the actions<br>})</pre><p>Now you have basically completed the setup of your redux store along with actions.<br>You can find the code up to now, <a href="https://github.com/faizhameed/react-redux-boilerplate">here</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F11sBLVxNs7v6WA%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fcheer-cheering-11sBLVxNs7v6WA&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2F11sBLVxNs7v6WA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="196" frameborder="0" scrolling="no"><a href="https://medium.com/media/15da6c7091d4b74051f58f021932647a/href">https://medium.com/media/15da6c7091d4b74051f58f021932647a/href</a></iframe><h3>Optional Section: A fully functional app with the redux setup</h3><p>Let&#39;s explore more with your complete app.<br>So in the src folder lets create another folder <strong>components</strong> and inside let&#39;s create a file with name as <strong>books.jsx</strong></p><pre>import  React  from  &quot;react&quot;;<br>import { connect } from  &quot;react-redux&quot;;<br>const  Books  = ({ books }) =&gt; {<br>return (<br>     &lt;div&gt;<br>        &lt;h1&gt;Books List&lt;/h1&gt;<br>      &lt;ul&gt;<br>        {books.map((book, index) =&gt; (<br>           &lt;li  key={index}&gt;{book}&lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>     &lt;/div&gt;<br>);<br>};<br>const  mapStateToProps  = (state) =&gt; ({<br>     books:  state.bookReducer.books,<br>});<br>export  default  connect(mapStateToProps)(Books);</pre><p>ok now that&#39;s done let&#39;s create another file <strong>books-input.jsx</strong> in the same folder. Here you add books to the store</p><pre>import  React  from  &quot;react&quot;;<br>import { connect } from  &quot;react-redux&quot;;<br>import { addBooksToState } from  &quot;../redux/actions&quot;;</pre><pre>const  BooksInput  = ({ addBooksToState }) =&gt; {<br>const  handleKeyPress  = (e) =&gt; {<br>if (e.key  ===  &quot;Enter&quot;) {<br>	addBooksToState(e.target.value);<br>	document.getElementById(&quot;book-input&quot;).value  =  &quot;&quot;;<br>}<br>};<br>return (<br>	&lt;div&gt;<br>	   &lt;h2&gt;Add your books here&lt;/h2&gt;<br>	   &lt;input  id=&quot;book-input&quot;  <br>                   type=&quot;text&quot;  <br>                   onKeyUp={handleKeyPress}  /&gt;<br>	&lt;/div&gt;<br>);<br>};<br>const  mapDispatchToProps  = (dispatch) =&gt; ({<br>	addBooksToState: (book) =&gt;  dispatch(addBooksToState(book)),<br>});<br>export  default  connect(null, mapDispatchToProps)(BooksInput);</pre><p>Now let&#39;s plug these components to your App.js.</p><pre>import  React  from  &quot;react&quot;;<br>import  &quot;./App.css&quot;;<br>import  Books  from  &quot;./components/books&quot;;<br>import  BooksInput  from  &quot;./components/books-input&quot;;</pre><pre>function  App() {<br>return (<br>  &lt;div  className=&quot;App&quot;&gt;<br>     &lt;Books  /&gt;<br>     &lt;BooksInput  /&gt;<br>  &lt;/div&gt;<br>);<br>}</pre><pre>export  default  App;</pre><p>Now your application is running with redux state management. You can now add more features. For example, to avoid adding new books if its already in the state, you can do the following in your root-reducer.js<br>Replace the corresponding snippet with this</p><pre>case  actionTypes.ADD_BOOK:<br>if (!state.books.includes(action.payload)) {<br>return {<br>	...state,<br>	books: [...state.books,  action.payload],<br>};<br>}  <br>return  state;</pre><p>You can find the final app <a href="https://github.com/faizhameed/books-app"><strong>here</strong></a></p><p>And the rest is up to you to go and try out. You can do a lot to improve the app. Since it&#39;s beyond the scope of my article.</p><ul><li>Add an edit button to edit the added books</li><li>Delete a book</li><li>Improve design</li><li>Configure a database with Express and MongoDB (maybe PostgreSQL)</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o85xtLX7zCyeeWGLC%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fgq-inspiration-shia-labeouf-do-it-3o85xtLX7zCyeeWGLC&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2F3o85xtLX7zCyeeWGLC%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="243" frameborder="0" scrolling="no"><a href="https://medium.com/media/27afda174cb00b14cde7888ff50879f2/href">https://medium.com/media/27afda174cb00b14cde7888ff50879f2/href</a></iframe><p>Please let me know if this tutorial helped you.</p><p>You can follow me at <a href="https://twitter.com/faiz_hameed1993">Twitter</a> and <a href="https://www.linkedin.com/in/faizhameed/">Linkedin</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dad3ec9632b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript solution for odd occurrences in an array]]></title>
            <link>https://faizhameed.medium.com/javascript-solution-for-odd-occurrences-in-an-array-eab4ece8bc97?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/eab4ece8bc97</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Thu, 29 Aug 2019 04:56:04 GMT</pubDate>
            <atom:updated>2021-10-01T06:25:25.589Z</atom:updated>
            <content:encoded><![CDATA[<h3>JavaScript solution for Odd Occurrences In an Array</h3><p>This is the codility problem in Lesson #2.1</p><p>A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired.</p><p>For example, in array A such that:</p><p>A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9</p><ul><li>the elements at indexes 0 and 2 have value 9,</li><li>the elements at indexes 1 and 3 have value 3,</li><li>the elements at indexes 4 and 6 have value 9,</li><li>the element at index 5 has value 7 and is unpaired.</li></ul><p>Write a function:</p><blockquote><em>function solution(A);</em></blockquote><p>that, given an array A consisting of N integers fulfilling the above conditions, returns the value of the unpaired element.</p><p>For example, given array A such that:</p><p>A[0] = 9 A[1] = 3 A[2] = 9 A[3] = 3 A[4] = 9 A[5] = 7 A[6] = 9</p><p>the function should return 7, as explained in the example above.</p><p>Write an efficient algorithm for the following assumptions:</p><ul><li>N is an odd integer within the range [1..1,000,000];</li><li>each element of array A is an integer within the range [1..1,000,000,000];</li><li>all but one of the values in A occur an even number of times.</li></ul><p>Solution</p><pre>function solution(A){</pre><pre>let N=[…A];</pre><pre>N.sort(function(a, b){return b-a}) /* sorting array in descending order*/</pre><pre>for(let i=0;i&lt;N.length;i++){</pre><pre>if(N[i]==N[i+1]){</pre><pre>N.splice(i,2);</pre><pre>i=-1;</pre><pre>}</pre><pre>if(N[i+1]==undefined){</pre><pre>return parseInt(N.join(‘’))</pre><pre>}</pre><pre>}</pre><pre>}</pre><p>I am Getting time complexity of O(n**2) any better solutions?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eab4ece8bc97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I transitioned from Mechanical Engineering into Web Developer Full Time]]></title>
            <link>https://medium.com/zerotomastery/how-i-transitioned-from-mechanical-engineering-into-web-developer-full-time-3e7ddc236388?source=rss-f798ccd007d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e7ddc236388</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mastery]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Faiz Hameed]]></dc:creator>
            <pubDate>Mon, 29 Jul 2019 04:00:26 GMT</pubDate>
            <atom:updated>2023-01-27T04:14:42.208Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NlqpTTAM8DbGl4paBmjE_g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Christopher Gower</a> on <a href="https://unsplash.com/search/photos/web-development?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Unarguably Mechanical Engineering is one of the best fields of engineering to pursue. But the taste and passion can be different for people. But every decision you take in your life may not be right. Sometimes you may end up taking courses that may not bring the best in you.</p><p>So if you are like me who finished mechanical engineering or any other degree or a field unrelated to Computer Science then this article is for you.</p><p>So how did I make that shift? There is no magic pill, you need to be ready to commit at least 4hrs per day learning and doing projects. I started by working with a WordPress website. I created about 4 websites lol!!. And I didn’t commit much to build it and one of them was for a social community. That’s how I started as part-time work.</p><p>Later, I wanted to learn how to create websites without WordPress or any other tools. We have youtube, twitter, Instagram, Netflix, Amazon etc. These kinds of websites require to be built from scratch by using more complex frameworks and libraries. That’s how I started to shift to web development. So let’s see how this journey started.</p><h3>How to begin…</h3><p>The first course I took was <a href="https://academy.zerotomastery.io/p/complete-web-developer-zero-to-mastery">Andrei’s Complete Web Developer course</a>. It is very comprehensive and easy to understand. This course helped me a lot on taking that 20% to give you 80% of the results, including the latest framework used and best practices. After this course, you will be well good to go with a full-stack project. This is very impressive, to begin with, you can show this in your portfolio and resume.</p><p>After this, I mainly focused on applying what I learned. You should get your hands dirty by doing as many as projects you can think of. You learn more when you do projects because that’s where you apply your skills.</p><h3>Master JavaScript</h3><p>No matter what frameworks may come and go. This language is going to stay for long. It’s now the <a href="http://enter%20urlhttps//insights.stackoverflow.com/survey/2019#technology">most popular language</a> on the internet. Mastering this should be your priority, then any frameworks will be a cakewalk for you. Moreover, it’s an easy language to understand. No compiler is needed since JavaScript doesn’t require compilation process. The browser interprets JavaScript as it HTML tags.</p><p>Another set of books that so popular with Javascript and this can make you advanced JavaScript Developer is <a href="https://www.amazon.in/gp/product/9352136268/ref=as_li_ss_tl?ie=UTF8&amp;tag=&amp;linkCode=ll1&amp;tag=faizhameed-21&amp;linkId=94ad7e2dbf0e8e1fd185f9fb84eaa1a9&amp;language=en_IN">You Don’t Know JS series</a>. I am currently reading and learning this one. And it’s really exciting to get to know the tricky parts of JavaScript</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PqGSiAfVF4hCeDd0JseACA.jpeg" /></figure><p>Also, you can join Freecodecamp which is one of the best online platforms where you can practice plenty of JavaScript. You can learn most fundamentals on this site. The site is built in such a way that you are given a brief description of the methods or syntax used and after that, you do it by yourself.</p><p><a href="https://www.freecodecamp.org/">freeCodeCamp.org</a></p><h3>Tutorial Hell…</h3><p>Be aware of this, you could end up signing in plenty of courses and you end up not doing much and confused. In my honest opinion sign up for the courses that would make a difference that makes you learn a new skill well. The important thing is to practice more by solving problems, creating new projects and also submitting to open source projects.</p><p>When you meet a problem by yourself and find the solution, then the idea is stamped on your brain. Because creating something from scratch requires you to know about the technology well and be able to place everything together. While sticking with tutorials will only give you comfort, once you know something start digging deep by applying it however you can.</p><p>You can join <a href="http://www.leetcode.com/">leetcode</a>, <a href="http://www.hackerearth.com/">hackerearth</a> to practice plenty of problems, These platforms have coding challenges running periodically which can even get you hired with a good package.</p><h3>Landing a Job</h3><p>Linkedin is your best friend here. I got a lot of call through this platform, though I couldn’t land a job anywhere in the first two months of trying, and moreover, I was in a beginner stage without a really meaningful project on my resume ( highly recommended).</p><p>And after that, I started to update my profile on other major career websites like Naukri(Indian based), indeed etc and soon I started getting a lot of calls from different companies and I failed in most of the interviews that time, but I got a real knowledge of how the interview is going to be like and what kind of question I can expect. I started getting a lot more confident after that and by this time I had two good projects from Andrei’s courses. One evening I got a call from a company in Bangalore and the hiring manager was interested in my resume and asked me if I am confident in ReactJs and what salary am I expecting. I replied confidently to him. The very next day to my surprise I received an offer letter from the company without a technical interview. It was really surprising and also created some kind of doubts that why would someone hire me without really testing my skills. Anyway, I decided to go for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pUniZKqeWFZkgecm" /><figcaption>Photo by <a href="https://unsplash.com/@benwhitephotography?utm_source=medium&amp;utm_medium=referral">Ben White</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I packed items just for a week and traveled to the location. Yes, the job was real, I introduced myself to my colleagues and it went fine. Honestly, the pay cut was too much to think of in the beginning, but I was confident it would change in the future.</p><h3>Benefits of being a Web Developer</h3><h3>Entrepreneurship</h3><p>This is a big thing in the field of Web Development. They have a few advantages compared to other types of business. They don’t need to own a physical shop, for one. Creating a complete digital franchise has its difficulties, but it eliminates the major cost involved in finding a property to do business from. Web design is an overcrowded industry.</p><p>However, it’s also the fastest-growing industry with a need for designers who know what they’re doing. Proper plan, filling the gap in the market, gathering essential resources and more importantly staying committed will pay you off.</p><h3>Freelance</h3><p>Freelancing is another career path web developers can take. But its less recommended at the beginning. It’s better to start working for other firms and get acquainted first and starting freelance part-time and slowly moving it to full time. There are several websites to start your freelancing websites <a href="https://www.truelancer.com/">Truelancer</a>, <a href="https://www.freelancer.com/">Freelancer</a>, <a href="https://www.upwork.com/">upwork</a> <a href="http://fiverr.com/">Fiverr</a> etc…</p><h3>Good Career. Endless progress…</h3><p>If you are not into entrepreneurship or freelancing, definitely web development has an endless career path. The more you sharpen your skills the more you can grow in this area. The salary is very competitive compared to other industries. From my experience, if you have an updated profile on LinkedIn, Indeed, Naukri etc. job sites that are popular in your locality, you start getting calls even though if you didn’t apply to any company directly. This show you how demanded the area is.</p><h3>Conclusion</h3><p>The first day of work to be honest, when the real work came I was so worried and frustrated. I called my friends who work in the same field, and I googled for solutions. Honestly, this happened only for two days, the third day I was on track and I could deliver more than expected. I expect this to happen for everybody too, but no worries, Stackoverflow is there to rescue you. Rest of the worries are due to the imposter syndrome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X-Yub7e-1ePrutXq" /><figcaption>Photo by <a href="https://unsplash.com/@workshopand?utm_source=medium&amp;utm_medium=referral">Workshop&amp;</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now when I get a project my rule of thumb is to slice it into tiny pieces, each piece representing specific tasks. So this way I can track my progress and testing also becomes easier. I use <a href="http://www.trello.com/">trello</a> for each project and make several cards for each section. I make several lists for each card that directed me to complete the respective section.</p><p>If you are really up to becoming a software or web developer, the path is clear, just you need to give some effort in building yourself. If you are excited about constantly learning and building new things, this path is very exciting. Once you decide that don’t look back just do whatever it takes. I was discouraged at first by my relatives and friends when I decide to leave my job to pursue Web development full time. But now they are happy as I made it. And remember if you are already working in other unrelated industries and looking for a career shift, be ready to embrace the massive pay cut. But when you keep on sharpening your skills things start to get extremely rewarding.</p><p>Since you have read till here, I feel you could also be thinking the same as me. Now it&#39;s time to get started with your journey and be excited. Let me know your opinions in the comments.<br>Follow me @ <a href="https://www.linkedin.com/in/faizhameed/">LinkedIn</a>, and <a href="https://github.com/faizhameed">GitHub</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e7ddc236388" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zerotomastery/how-i-transitioned-from-mechanical-engineering-into-web-developer-full-time-3e7ddc236388">How I transitioned from Mechanical Engineering into Web Developer Full Time</a> was originally published in <a href="https://medium.com/zerotomastery">Zero To Mastery</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>