<?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 Rajmani Kushwaha on Medium]]></title>
        <description><![CDATA[Stories by Rajmani Kushwaha on Medium]]></description>
        <link>https://medium.com/@rajmanikush?source=rss-758b17791919------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*SFMxG9o-GaTX6JpCm2kzmg.jpeg</url>
            <title>Stories by Rajmani Kushwaha on Medium</title>
            <link>https://medium.com/@rajmanikush?source=rss-758b17791919------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 13:00:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajmanikush/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[Demystifying GCD Queues and Tasks in iOS Development]]></title>
            <link>https://medium.com/@rajmanikush/demystifying-gcd-queues-and-tasks-in-ios-development-7dc2c21d9365?source=rss-758b17791919------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dc2c21d9365</guid>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[gcd]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Rajmani Kushwaha]]></dc:creator>
            <pubDate>Sun, 28 Apr 2024 04:50:37 GMT</pubDate>
            <atom:updated>2024-04-28T04:58:04.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Photo by &lt;a href=”https://unsplash.com/@dnevozhai?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash&quot;&gt;Denys Nevozhai&lt;/a&gt; on &lt;a href=”https://unsplash.com/photos/aerial-photography-of-concrete-roads-7nrsVjvALnA?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash&quot;&gt;Unsplash&lt;/a&gt;" src="https://cdn-images-1.medium.com/max/1024/1*GLWD21CAdM61KaGn9MRvkw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@dnevozhai?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Denys Nevozhai</a> on <a href="https://unsplash.com/photos/aerial-photography-of-concrete-roads-7nrsVjvALnA?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>Grand Central Dispatch (GCD) ensures smooth concurrency within iOS applications. Understanding its core concepts, particularly regarding queues and tasks, is crucial for efficient app development. Let’s highlight the fundamentals of GCD queues and tasks.</p><h3>GCD Queues: Serial vs. Concurrent</h3><p>GCD operates with two primary types of queues: serial and concurrent.</p><p><strong>Serial Queue</strong>: Associated with a single thread, a serial queue ensures that tasks are executed sequentially, one after the other. This guarantees thread safety but may lead to performance bottlenecks if tasks are time-consuming.</p><p><strong>Concurrent Queue</strong>: A concurrent queue leverages the system’s multiple threads to execute tasks simultaneously on different threads. However, it doesn’t guarantee parallel execution due to resource contention, potentially resulting in tasks executing sequentially.</p><blockquote>When we start the app, the system automatically creates a serial main Queue (DispatchQueue.main) and assigns the main thread. Later, we can use the queues to utilise as many threads as our OS supports but avoid managing the threads explicitly.</blockquote><h3>Understanding Tasks: Async vs. Sync</h3><p>Tasks within GCD can be categorised into two types: asynchronous (async) and synchronous (sync).</p><p><strong>Asynchronous Tasks</strong>: These tasks return control to the calling thread immediately after initiation, allowing the app to continue executing other tasks concurrently. Asynchronous tasks are essential for non-blocking operations, ensuring responsiveness and smooth user experience.</p><p><strong>Synchronous Tasks</strong>: Unlike asynchronous tasks, synchronous tasks block the current run loop until they are completed. This can lead to thread lock and unresponsiveness, especially when executed on the main thread, which handles UI updates and interactions.</p><p>Example: if we add three async tasks to a serial queue, each task must be finished before starting the next tasks because they are executed on a single thread.</p><h3>Best Practices and Considerations</h3><ol><li><strong>Queue Selection</strong>: Choose the appropriate type of queue based on your application’s requirements. Serial queues are ideal for ensuring data consistency and avoiding race conditions, while concurrent queues enhance performance for independent tasks.</li><li><strong>Async vs. Sync</strong>: Use asynchronous tasks for operations that don’t require immediate results and synchronous tasks sparingly, considering their potential to block threads and impact app responsiveness.</li><li><strong>Main Thread Consideration</strong>: Avoid adding synchronous tasks to the main thread’s serial queue, as this can freeze or block the UI, rendering the app unresponsive. Opt for asynchronous tasks or offload synchronous operations to background queues.</li></ol><h3>Conclusion</h3><p>In iOS development, a solid understanding of GCD queues and tasks is indispensable for building responsive and efficient applications. We can optimise concurrency by effectively leveraging serial and concurrent queues and distinguishing between asynchronous and synchronous tasks while maintaining a seamless user experience.</p><p>You can reach out to me at :</p><p><strong>Linkedin: </strong><a href="https://www.linkedin.com/in/rajmanikush/">Rajmani Kushwaha</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dc2c21d9365" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bare essentials to become a Pragmatic Programmer]]></title>
            <link>https://medium.datadriveninvestor.com/bare-essentials-to-become-a-pragmatic-programmer-5077bbd5b965?source=rss-758b17791919------2</link>
            <guid isPermaLink="false">https://medium.com/p/5077bbd5b965</guid>
            <category><![CDATA[pragmatic-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pragmatism]]></category>
            <dc:creator><![CDATA[Rajmani Kushwaha]]></dc:creator>
            <pubDate>Mon, 11 May 2020 09:17:07 GMT</pubDate>
            <atom:updated>2020-05-13T15:44:39.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJvJNdRebaQXCNyuZoXKCw.png" /><figcaption>Pragmatic Programmer</figcaption></figure><p>If you have ever encountered the term Pragmatic, you might be aware of this book <em>The Pragmatic Programmer </em>written<em> </em>by Andrew Hunt and David Thomas.</p><p>Although it seems to be technical, the content is very philosophical and applicable to anyone who wants to adhere to the Pragmatic Mindset. Here, I’ll try to explain the term Pragmatism and what I learned from this book.</p><h3>Don’t live with broken windows</h3><p>If the window of a building was broken and left unrepaired for a long time, It gives a sense of abandonment. People start littering and making graffiti, and in no time, severe damages may happen.</p><p>The same thing applies to the software. <em>Bad code attracts more bad code.</em> If we encounter such bad design, wrong decisions and poor code, we should take the right actions so that it could prevent further damages.</p><p><a href="https://www.datadriveninvestor.com/2020/02/26/surviving-in-a-digital-age-of-instability/">Surviving In A Digital Age of Instability | Data Driven Investor</a></p><p><strong>Care About Your Craft<br></strong>As a Software Engineer, we spend our whole life developing and maintaining software. We’d be responsible for our product and take ownership of the code we write.</p><p><strong>Provide Options, Don’t Make Lame Excuses<br></strong>We all make mistakes and if any issues found, give options rather than making excuses and pointing to others.</p><h3>The Stone soup and Boiled frog</h3><p>Let’s go through an interesting philosophy in the field of programming, named as ‘Stone soup and boiled frog’</p><p><a href="https://www.youtube.com/watch?v=9KejHBhTuPM">https://www.youtube.com/watch?v=9KejHBhTuPM</a></p><h3>Knowledge Portfolio</h3><p>Technologies keep on changing nowadays. If we don’t update our knowledge, It might obsolete with time, so invest in it regularly as a habit. If you are comfortable with a new language or technology, move on and learn another one. Different styles solve the same problems in different ways, and by learning several different approaches, you can help broaden your thinking about the issues and avoid them. Search for exciting courses online, local and global meetups/conferences. The Internet has lots of online resources, make use of that! Try to look outside of your company to know what people are doing.</p><h4>Communicate</h4><p>Communication is required to have great ideas floating. If we don’t communicate with the people around, then there is no point in having great ideas. Know what we want to say and plan them. Know your audience too and what they want. Involve your audience: Get their feedback by encouraging people to talk by asking questions.</p><h4><a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*BGzh2WUfWU6BowAwLCS3vg.gif" /></figure><p>We should not duplicate our code, As simple as that. Duplicate codes lead to poor refactoring and maintenance. But let’s understand why we duplicate things.</p><ul><li>We duplicate codes by getting lazy</li><li>It seems more comfortable for us</li><li>We work in such a big team that we duplicate things in lack of knowledge</li><li>Due to the lack of architectural knowledge developer feels that duplicating things are the only choice they have.</li></ul><h4>Orthogonality</h4><p>As per geometry definition, two vectors are called <strong>orthogonal</strong> if they are perpendicular, i.e.<em> </em>they form a right angle.</p><p>If we design a system in such a way that two systems are only connected at only one point. It’ll increase productivity and reduces risks. Such systems are easier to test.</p><p><strong>Be prepared for changes.<br></strong>There are no Final Decisions and or cast in stone. Good designs are easier to change compared to the bad design.</p><h4>Tracer Bullets</h4><p>New project requirements may be vague. Uses of new algorithms, techniques, languages, or libraries unknowns will come, and the environment will change over time.</p><p>Tracer bullets show what we’re hitting. It will not always be hitting the target, but then we adjust it accordingly to achieve the goal.</p><p>Advantages:</p><ul><li>Users get to see something working early.</li><li>Developers build a structure to work.</li><li>You have something to demonstrate.</li></ul><h3>Tools</h3><p>Any good craftsman knows that once we have got a plan, we don’t quickly start working. First, we need to prepare for our environment and tools. Just like a woodcutter who uses dull saw, takes more time to finish the same job but if we sharpen the tools first, then we can finish the same job early and effectively.</p><p>Coding is no exception. Getting our tools and environment ready will increase productivity. We need to have good experience of a single editor, terminals and plain texts. Source Code Control, like git, is must-have tools to make collaboration, rollback, and sharing easy.</p><h3>Debugging</h3><blockquote><em>Fix the Problem, Not the Blame</em></blockquote><p>Never waste a single amount of energy to prove that it can’t happen as it’s already happened. Try to know the root cause of the problem. These debugging strategies can help</p><ul><li>Make it reproducible</li><li>Visualise Your Data</li><li>Trace it to understand what happens before and after.</li><li>Explain the bug to someone</li><li>If suspect code passes unit tests, Are tests complete enough?</li></ul><p>No one can write the perfect software. Pragmatic Programmers don’t trust themselves, either.</p><h4>Assertive Programming</h4><p>Uses of assertion help us to detect errors early. All errors give us information, and if there are any errors, it means something has been broken and need to be taken care of early. Use assertions to prevent our assumption that it can’t happen.</p><h4>Program by Coincidence</h4><p>Keep an eye on what we are making to avoid doing it by coincidence.<br>Always proceed with a plan and document our assumptions. Don’t just test our code, but test our assumptions as well.</p><p>Pragmatic Programmers estimate the resources that algorithms use — time, processor, memory, and so on using big O Notation. Be pragmatic about choosing appropriate algorithms — the fastest one is not always the best, but need to consider the use case.</p><h4>Refactor our Code</h4><p>Our requirements keep changes with time and so the need to refactor our code to fix it. We need to move functionality to improve the performance of the system. If we encounter duplication of the code or violation of the DRY principle, then it’s a good time to refactor it. Coupling is another essential factor to refactor our code or if there is any chance to make it more loosely coupled.</p><blockquote>Refactor Early, Refactor Often</blockquote><h4>Unit Testing</h4><p>We all write code, but how can we be confident about it. Unit testing is a better way to detect errors in the first place. We can even practice the Test Driven Development(TDD) which says that — Build your tests before you implement the code and let your tests drive the development.</p><blockquote>Test Your Software, or Your Users Will</blockquote><h3>Requirements</h3><p>Don’t Gather Requirements — Dig for Them, this is what pragmatic programmers do and making documentations of the use cases. It becomes tough when the users and developers refer to the same thing by different names or refer to the various things by the same name. Publish documents to internal websites for easy access by all partners.</p><h3>Pragmatic Teams</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*bhtkxYxHa3odrleg3kMeoQ.png" /></figure><p>Practical techniques that are applicable for individual works well for teams too. Teams should not tolerate broken features, all those small glitches and it can only be improved from individual contributions. Quality is always a team issue. People assume that someone else is looking to solve this issue, or someone is assigned to solve this. Break this thought and make sure everyone actively monitors the environment for changes, issues and crashes. Automate things as much as we can. It avoids duplication and improves the efficiency of the team. Also, automating stuff helps to maintain consistency throughout the team.</p><h4>Testing</h4><p>Pragmatic Programmers are motivated to find out bugs early so that we don’t have to face bugs later. As a general practice, Tests should run before we finish any feature. Coding is never complete until all the tests pass successfully.</p><blockquote>Test Early. Test Often. Test Automatically.</blockquote><h4>Sign our Work</h4><p>Artisans of old age were proud to sign their work. As Pragmatic Programmers, We should be, too by putting the comments in code and our name in the starting of the file. It gives the authenticity that I have written this, and the quality would be much higher. Comments should justify its purpose. Remember that we would be reading the code many more times, but only writing it a few times.</p><h3>Where To Go From Here</h3><p>I hope you enjoyed this and you might want to read more about this. I strongly suggest reading <a href="https://www.amazon.in/Pragmatic-Programmer-journey-mastery-Anniversary/dp/0135957052">The Pragmatic Programmer: your journey to mastery, 20th Anniversary Edition</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5077bbd5b965" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/bare-essentials-to-become-a-pragmatic-programmer-5077bbd5b965">Bare essentials to become a Pragmatic Programmer</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>