<?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 Mohhamad Hasham on Medium]]></title>
        <description><![CDATA[Stories by Mohhamad Hasham on Medium]]></description>
        <link>https://medium.com/@Mohammad_Hasham123?source=rss-f46545aa9feb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*R5bLvXFJ9w-HRaIG.</url>
            <title>Stories by Mohhamad Hasham on Medium</title>
            <link>https://medium.com/@Mohammad_Hasham123?source=rss-f46545aa9feb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:47:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Mohammad_Hasham123/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[Redis 101: Foundation and Core Concepts]]></title>
            <link>https://medium.com/@Mohammad_Hasham123/redis-101-foundation-and-core-concepts-41f32c2bf021?source=rss-f46545aa9feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/41f32c2bf021</guid>
            <dc:creator><![CDATA[Mohhamad Hasham]]></dc:creator>
            <pubDate>Mon, 14 Oct 2019 19:58:09 GMT</pubDate>
            <atom:updated>2019-10-14T19:59:12.214Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i1d88Q8NNrRv6kjf7Ssw4g.png" /><figcaption>Google Images</figcaption></figure><p>Redis has been in the database game for quite a while now. The popularity has been increasing due to various factors that are discussed below. But before starting we should understand what is Redis actually.</p><p><em>So as per the docs state,</em></p><blockquote>Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lRAAu4ztCpoY0Iim9gJctg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@benwhitephotography?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ben White</a> on <a href="https://unsplash.com/search/photos/confused?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Now to be honest, the definition is difficult to understand. But I am quite sure that by the end of this article you would comprehend it properly.</p><p>Let’s start by understanding what are <strong>NoSQL Databases</strong> in general. NoSQL databases are used to store data in any other format than rows and columns. These are widely used to store data that is non relational in nature.</p><p>For example, consider two tables <strong>Person </strong>and <strong>Mobile_Phones</strong>, the two tables tend to have a relation (A person can have one or many mobile phones). So in scenarios where we need to relation among data SQL Databases are preferred.</p><p>Consider another scenario where the data to be stored has entries for two schemas such as <strong>Furniture </strong>and <strong>Mobile_Phones</strong>. It is quite evident that there is no such relation in above data. So storing this type of data in NoSQL database may increase overall performance.</p><p>Examples for relational databases consist of MySQL,PostgreSQL. On the other hand, MongoDB,Redis,Neo4j etc are examples for NoSQL databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AbmNmFHTOmIUA1Vw_JFv_w.png" /><figcaption>Google Images</figcaption></figure><p>Redis has different data structures to store data. Let’s explore them one by one.</p><h3>Strings</h3><p>This is the base type of all the types. Every single value can be stored as strings.</p><pre>SET name “fido”</pre><p>We are storing the string as a key value pair.</p><h3>Key-Value Pair</h3><p>The most easy and used data structure for Redis is storing string in <em>key-value </em>pair.</p><pre><br>SET name “fido”</pre><pre>GET name</pre><pre>// fido</pre><p>If you are familiar with Javascript objects or Python dictionaries. You can think of it as:</p><pre>{<br>  name: &quot;fido&quot;<br>}</pre><h3>Lists</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*mMN5zxOZo1XjHNGgyirKxg.png" /></figure><p>Lists are actually lists of strings stored in a particular order. Lists are also good when we want just to create a collection of N items where <em>usually</em> we access just the top or bottom items, or when N is small. Because random access is slow and takes O(N) time to complete.</p><p>Lists have several commands such as <strong>RPUSH, LPUSH, LLEN, LRANGE, LPOP, and RPOP.</strong> These commands help to perform specific operations lists.</p><pre># <a href="https://try.redis.io/#help">RPUSH</a> puts the new value at the end of the list.</pre><pre>RPUSH friends &quot;Alice&quot;</pre><pre># LPUSH puts the new value at the start of the list.</pre><pre>LPUSH friends &quot;Bob&quot;</pre><p><strong>LRANGE</strong> gives a subset of the list. It takes the index of the first element you want to retrieve as its first parameter and the index of the last element you want to retrieve as its second parameter.</p><pre>LRANGE friends 0 -1</pre><p><strong>LLEN</strong> returns the length of linked list</p><pre>LPUSH friends &quot;Alice&quot;<br>LPUSH friends &quot;Bob&quot;</pre><pre>LLEN friends  # =&gt; 2</pre><p><strong>LPOP</strong> and <strong>RPOP</strong> removes (pops) elements from start and end respectively.</p><pre># <a href="https://try.redis.io/#help">R</a>POP pops the value from the end of the list.</pre><pre>RPOP friends</pre><pre># LPOP pops the value at the start of the list.</pre><pre>LPOP friends &quot;Bob&quot;</pre><h3>Sets</h3><p>Among differences between sets and lists is that sets store unique elements unlike lists.</p><p>Sets are an unordered data collection. Sets perform fast iteration than lists across elements.</p><p>Sets support complex operations like intersections, unions, and so forth, so this is a good data structure for using Redis in a “computational” manner, when you have data and you want to perform transformations on that data to obtain some output.</p><p>In sets adding, removing and lookup for an element takes O(1) constant time.</p><p>Small sets are encoded in a very efficient way.</p><p>Among many commands for Sets we will discuss <a href="https://try.redis.io/#help">SADD</a>, <a href="https://try.redis.io/#help">SREM</a>, <a href="https://try.redis.io/#help">SISMEMBER</a>, <a href="https://try.redis.io/#help">SMEMBERS</a>.</p><p><strong>SADD </strong>adds a member to a set</p><pre>  SADD superpowers &quot;flight&quot;</pre><p><strong>SREM </strong>removes a member from a set</p><pre>  SREM superpowers &quot;flight&quot;</pre><p><strong>SISMEMBER</strong> tests if the given value is in the set. It returns <em>1</em> if the value is there and <em>0</em> if it is not.</p><pre>SISMEMBER superpowers &quot;flight&quot;  # =&gt; 1<br>SISMEMBER superpowers &quot;height&quot;  # =&gt; 0</pre><p><strong>SMEMBERS </strong>returns all elements from a set.</p><pre>SMEMBERS superpowers # =&gt; &quot;flight&quot;, &quot;height&quot;</pre><h3>Sorted Sets</h3><p>Sorted sets are the <em>only other data structures, besides lists, to maintain ordered elements</em>.</p><p>Sorted sets are like more powerful lists where inserting, removing, or getting ranges from the the middle of the list is always fast. But they use more memory, and are O(log(N)) data structures.</p><p><strong>ZADD </strong>command is used to add all the specified members with the specified scores to the sorted set stored at key. <strong>ZRANGE </strong>displays all elements within the set <strong>-1 </strong>indicates<strong> </strong>the last index of set</p><pre>ZADD mycolorset 1 white<br>ZADD mycolorset 2 black</pre><pre>ZRANGE mycolorset 0 -1</pre><pre>#white<br>#black</pre><p>Suppose if we insert another element at index <strong>2.</strong> The element placed at index 2 will be shifted to the next index and the new element would take the place.</p><pre>ZADD mycolorset 2 yellow<br>ZRANGE mycolorset 0 -1</pre><pre>#white <br>#yellow<br>#black</pre><p>To remove an element, we can use <strong>ZREM </strong>as:</p><pre>ZREM mycolorset yellow</pre><p>This would remove the element from the sorted set.</p><h3>Hashes:</h3><p>Hashes are used to store collective information about something. Let’s discuss an example to get better understanding.</p><p>They act as maps between the string fields and the string values. Hence, they are the perfect data type to represent objects.</p><p>In Redis, every hash can store up to more than 4 billion field-value pairs.</p><pre>HMSET person name &quot;John Doe&quot; <br>designation &quot;Backend Engineer&quot; likes 20 shares 23</pre><p>In the above code snippet, we are using <strong>HMSET </strong>to store a hash. As we can see there are different fields associated with <strong>person.</strong></p><p>Let’s retrieve all the data with <strong>HGETALL</strong> as</p><pre>HGETALL person </pre><pre>1) name<br>2) John Doe<br>3) designation<br>4) Backend Engineer<br>5) Likes<br>6) 20<br>7) shares<br>8) 23</pre><p>Now that we have covered the basic data types. Let’s discuss the use cases for Redis.</p><p>Apart from it’s many use cases, there are some popular use cases for Redis such as</p><ul><li>Caching Layer Database</li><li>Pub/Sub</li><li>Get top analysis for something</li><li>Message Queues</li></ul><p>Let’s discuss each of them briefly,</p><h4>Caching Layer Database:</h4><p>Redis being an in-memory store can be used as cache for storing user session or other relevant details. Redis is highly performant to read data, which is one of the reasons of using it as a caching layer database on top of the main database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*JMiqEDklGtz5_L2mFB-zNg.png" /><figcaption>Google Images</figcaption></figure><h4>Pub/Sub:</h4><p>Redis Pub/Sub implements the messaging system where the publishers sends the messages while the subscribers receive them. The link by which the messages are transferred is called <strong>channel</strong>. A subscriber can subscribe to multiple publishers bases on scenario.</p><pre>PUBLISH chat “Hi there”<br>SUBSCRIBE chat</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*SbYWnSywngh8z_UpM_FiEQ.png" /><figcaption>Google Images</figcaption></figure><h4>Get top analysis for something:</h4><p>We can get top users, top trends or anything on edges. By edges, that means anything that lies on top or bottom of our list.</p><p>For example suppose we have some users and they have some scores. So we can easily store this in a sorted set and query as:</p><pre>ZRANGE user_scores 0 10 WITHSCORES</pre><p>The above query would return top 10 users with their scores respectively. In scenarios like this Redis is the go to database.</p><h4>Message Queues:</h4><p>Redis has the same concept of queues as in general programming. Message queues can be implemented with push and pop if there are multiple processes running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*WVxrzV6O4tAtipIV8p7PGA.png" /><figcaption>Google Images</figcaption></figure><p>There are many libraries that provide ease and enhanced functionalities to work with Redis queues.</p><p>This was a brief introduction to the world of Redis there is a lot to <a href="https://redis.io/documentation">explore</a>. I would highly recommend to give a shot to <a href="https://try.redis.io/">this</a>.</p><p>Good luck and don’t forget to share and hit that 👏🏼 button.</p><p>Just in case you want to say Hi! DM or tweet me @MohammadHasham_</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41f32c2bf021" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shifting towards a better boilerplate — React Native]]></title>
            <link>https://medium.com/@Mohammad_Hasham123/shifting-towards-a-better-boilerplate-react-native-887ec237ae40?source=rss-f46545aa9feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/887ec237ae40</guid>
            <category><![CDATA[boilerplate]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohhamad Hasham]]></dc:creator>
            <pubDate>Sat, 22 Jun 2019 15:00:08 GMT</pubDate>
            <atom:updated>2019-06-22T15:00:08.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*4BYW9mg5rswKVU2XfcpX8g.jpeg" /></figure><h3>Shifting towards a better boilerplate — React Native</h3><p>I was dabbling with ReactJS for quite a while, but there came a point where I wanted to develop a mobile application📱. I knew straight which framework to pick (React-Native). Being a React developer myself I knew the pros of using it for cross-platform application development.</p><blockquote><strong>Note:</strong> this article is not about why you should/ shouldn’t use the boilerplate I used. It is about what I used and was not disappointed and I think works great in more aspects.</blockquote><blockquote>To view the repo, click <a href="https://github.com/react-pakistan/react-native-boilerplate">here</a></blockquote><p>This curated collection of boilerplate not only helps in fast and easy development but provides with the essentials to choose from React ecosystem. React being a library has many packages to be installed in order to get the full advantage of it. Thankfully, this collection of boilerplates helps to choose the best which suits your needs. The collection currently has 10 boilerplates to use.</p><p>Feel free to check them out 👉</p><ul><li><a href="https://github.com/react-pakistan/react-native-boilerplate/tree/RN01">RN-01 RN-REDUX-REACTNAVIGATION</a></li><li><a href="https://github.com/react-pakistan/react-native-boilerplate/tree/RN02">RN-02 RN-REDUX-THUNK-REACTNAVIGATION</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN03">RN-03 RN-REDUX-SAGA-REACTNAVIGATION</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN04">RN-04 RN-REDUX-THUNK-RESELECT-REACTNAVIGATION</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN05">RN-05 RN-REDUX-SAGA-RESELECT-REACTNAVIGATION</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN06">RN-06 RN-REDUX-REACTNAVIGATION-STYLEDCOMPONENTS</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN07">RN-07 RN-REDUX-THUNK-REACTNAVIGATION-STYLEDCOMPONENTS</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN08">RN-08 RN-REDUX-SAGA-REACTNAVIGATION-STYLEDCOMPONENTS</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN09">RN-09 RN-REDUX-THUNK-RESELECT-REACTNAVIGATION-STYLEDCOMPONENTS</a></li><li><a href="https://github.com/Taimoormk/react-native-boilerplate/tree/RN10">RN-10 RN-REDUX-SAGA-RESELECT-REACTNAVIGATION-STYLEDCOMPONENTS</a></li></ul><h3>Code Formatting:</h3><p>Each boilerplate comes with pre-installed <a href="https://eslint.org/">ESLint</a> to maintain code consistency and <a href="https://prettier.io/">Prettier</a> to automatically format the code on the pre-commit hook level. It gives the leverage to choose between Redux ecosystem, such as the option to choose between <a href="https://github.com/reduxjs/redux-thunk">Redux-Thunk </a>or <a href="https://github.com/redux-saga/redux-saga">Redux-Saga</a>. Redux has its own ecosystem and is widely used for store management and optimization for complex state applications. I couldn’t find anything better with Redux ecosystem well integrated as used in this curated collection of boilerplates.</p><h3>UI/UX:</h3><p>When it comes to a mobile cross-platform application, UI/UX matters a lot. It is a general impression to the user about the application. These boilerplates take care of that as well, popular libraries such as <a href="https://github.com/oblador/react-native-vector-icons">React-Native vector icons</a><strong><em> </em></strong>and<strong><em> </em></strong><a href="https://github.com/callstack/react-native-paper">React-Native paper UI<strong><em> </em></strong></a><strong><em>.</em></strong> These libraries<strong><em> </em></strong>unleashes the power of React Native.</p><h3>Navigation:</h3><p>React Navigation is a native navigation implementation, not a JavaScript based implementation. This means that the library will have better performance &amp; would have smoother interactions &amp; screen transitions than some other solutions that are not native implementations. This collection of boilerplates provide great end to end navigation with <a href="https://reactnavigation.org/">React Navigation</a> which is easy to use, completely customizable and an extensible platform.</p><p>I would encourage everyone to start your project with this boilerplate as it is scaleable and would provide ease if you are working in a team or as a solo developer.</p><h3>Complete Unit Testing:</h3><p>All boilerplates have their unit tests written. This makes it really stable. <a href="https://app.codacy.com/project/Taimoormk/react-native-boilerplate/dashboard">Codacy</a> has been used for automated code reviews and code analytics. <a href="https://www.bitrise.io/">Bitrise</a> has been used for continuous integration. Keeping these tests in view there is no doubt that the project is quite stable and encourages FOSS contributions.</p><h3>Suggestions:</h3><p>The curated list of boilerplates is pretty awesome and you should definitely give it a try as a developer. It will certainly increase your productivity and would provide you with industry best practices right in there to use. However, I would suggest to have a CLI for these boilerplates. The CLI would pick it for the user upon their inputs for different libraries.</p><p>👉 Check this out: <a href="https://github.com/react-pakistan/react-native-boilerplate">Collection of curated boilerplates for React Native</a>.</p><p>I would encourage everyone to star, fork, clone or follow to add more features or anything you think is still lacking.</p><p>🙌 Peace!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=887ec237ae40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Hooks — An Introduction]]></title>
            <link>https://medium.com/@Mohammad_Hasham123/react-hooks-an-introduction-a0f939a89340?source=rss-f46545aa9feb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0f939a89340</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Mohhamad Hasham]]></dc:creator>
            <pubDate>Wed, 30 Jan 2019 15:57:28 GMT</pubDate>
            <atom:updated>2019-01-30T16:03:58.146Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Hooks — An Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a94fPzg_Zj8-xV6I2JbZ7w.jpeg" /><figcaption>React Hooks — An Introduction</figcaption></figure><p>Before starting with anything further:</p><p><strong>Hooks are still an experimental proposal. They’re currently in React v16.7.0-alpha and are not released. For details check the </strong><a href="https://reactjs.org/hooks"><strong>official documentation</strong></a><strong>.</strong></p><p>This is a series of articles on React Hooks. We will discuss the following:</p><ul><li>Why React Hooks</li><li>How can we use them</li><li>What is the added advantage with React Hooks</li></ul><p>Before moving any further, we need to know that there will be <strong>no breaking changes. </strong>So you don’t have to worry about your codebase at all.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxHMIDAy1qkzNS%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxHMIDAy1qkzNS%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxHMIDAy1qkzNS%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="321" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fd7bfc47a16c80fbc4a0e131ef54beb/href">https://medium.com/media/3fd7bfc47a16c80fbc4a0e131ef54beb/href</a></iframe><h3>Why React Hooks:</h3><p>This was the first question that was the first question that would come in your mind. I’ll try to answer that.</p><p>⚡I bet you would have used <em>render props or higher order components</em> if you have used React. The two above mentioned patterns are used to pass props down the hierarchy. But these patterns makes code difficult to read and interpret. If your code has a dense tree hierarchy, it forms a “wrapper hell”. So this concludes to the fact <strong>React needs a better primitive for sharing stateful logic</strong>.</p><p>Hooks allow us to extract stateful logic of a component. This allows leverage to test this code and use it independently.</p><p>⚡You might have observed while writing React components there often comes a point where the state grows into an unmanageable mess of stateful logic. Also, lifecycle methods contain unrelated logic which kills the idea of abstraction. Each lifecycle method often contains a mix of unrelated logic. For example, components might perform some data fetching in componentDidMount. However, the same componentDidMountmethod might also contain some unrelated logic that sets up event listeners. It ends up combining unrelated code in a single method. This makes the code verbose and increases the chances of bugs and inconsistencies.</p><p>To solve this, <strong>Hooks let you split one component into smaller functions</strong>, This would allow only tightly coupled logic to reside in one method and would allow abstraction.</p><p>⚡Classes act as a learning barrier for new developers as well as a debatable discussion for seasoned developers as well. Also without unstable syntax proposals, the code is very verbose.</p><h3>Conclusion:</h3><p>React Hooks do not propose a new design pattern altogether. It is an approach of moving towards functional (stateless) components. React Hooks are facing great appreciation across the React community. I’ll be writing the next chapter of this series until then</p><p>Happy Reading 🤞</p><p>P.S: If you think it is a good article make sure to give me some claps 👏</p><p>Feel free to message me <a href="https://twitter.com/MohammadHasham_">@MuhammadHasham</a>_</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0f939a89340" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>