<?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"><channel><title><![CDATA[art-of-software-engineering]]></title><description><![CDATA[art-of-software-engineering]]></description><link>https://tech.radhakrishnan-s.co.uk</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 14:36:13 GMT</lastBuildDate><atom:link href="https://tech.radhakrishnan-s.co.uk/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Swift Combine ZIP]]></title><description><![CDATA[The Zip operator buffers values from each publisher until a complete set is available, then emits them in order. The key difference with latest is that combineLatest: Emits whenever any publisher changes, using most recent values“ wheras ZIP emits wh...]]></description><link>https://tech.radhakrishnan-s.co.uk/swift-combine-zip</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/swift-combine-zip</guid><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 27 Nov 2024 12:30:42 GMT</pubDate><content:encoded><![CDATA[<p>The Zip operator buffers values from each publisher until a complete set is available, then emits them in order. The key difference with latest is that combineLatest: Emits whenever any publisher changes, using most recent values“ wheras ZIP emits when all publishers provide new values. (it follows the sequence)</p>
<p>ZIP buffers values until matching pairs are available</p>
<p>CombineLatest - picks up the latest value from the upstream.</p>
<h3 id="heading-combinelatest">CombineLatest:</h3>
<ul>
<li><p>One buffer slot per publisher</p>
</li>
<li><p>Only keeps most recent value</p>
</li>
<li><p>Example: <code>a.send(1), a.send(2)</code> - only <code>2</code> is buffered -The buffering is done by the combineLatest</p>
</li>
</ul>
<h3 id="heading-zip">Zip:</h3>
<ul>
<li><p>Unlimited buffer per publisher</p>
</li>
<li><p>Keeps values in sequence</p>
</li>
<li><p>Example: <code>a.send(1), a.send(2)</code> - both <code>1</code> and <code>2</code> are buffered - The buffering is done by the ZIP</p>
</li>
</ul>
<p>This is a reason Zip is good for sequential operations while CombineLatest is better for state/UI updates.</p>
<p>Here is a visual representation of how ZIP can be used for password validation</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732686417500/01681e36-71a2-47ec-b02d-d1b85fa04417.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-do-you-think-of-it-is">What do you think of it is?</h2>
<p>It is a buggy implementation as a change in user name or password will require another change in the other publisher as well. A combineLatest is an appropriate candidate here.</p>
<h2 id="heading-whats-a-good-use-case">Whats a good use case?</h2>
<p>File Upload with Thumbnail</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Fileuploader</span> </span>{
    <span class="hljs-keyword">let</span> fileData: <span class="hljs-type">AnyPublisher</span>&lt;<span class="hljs-type">Data</span>, <span class="hljs-type">Error</span>&gt;
    <span class="hljs-keyword">let</span> thumbnailData: <span class="hljs-type">AnyPublisher</span>&lt;<span class="hljs-type">Data</span>, <span class="hljs-type">Error</span>&gt;
        <span class="hljs-keyword">private</span> <span class="hljs-keyword">var</span> cancellables = <span class="hljs-type">Set</span>&lt;<span class="hljs-type">AnyCancellable</span>&gt;()

    <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">uploadWithThumbNail</span><span class="hljs-params">()</span></span> {
        <span class="hljs-type">Publishers</span>.<span class="hljs-type">Zip</span>(fileData, thumbnailData)
            .sink(receiveCompletion: { completion <span class="hljs-keyword">in</span>
                <span class="hljs-keyword">switch</span> completion {
                <span class="hljs-keyword">case</span> .finished:
                    <span class="hljs-built_in">print</span>(<span class="hljs-string">"Both file and thumbnail uploaded"</span>)
                <span class="hljs-keyword">case</span> .failure(<span class="hljs-keyword">let</span> error):
                    <span class="hljs-built_in">print</span>(<span class="hljs-string">"Upload failed: \(error)"</span>)
                }
            }, receiveValue: { (file, thumbnail) <span class="hljs-keyword">in</span>
                <span class="hljs-comment">// Both are guaranteed to be ready together</span>
                <span class="hljs-comment">// One can't proceed without the other</span>
                <span class="hljs-keyword">self</span>.uploadToServer(file: file, thumbnail: thumbnail)
            })
            .store(<span class="hljs-keyword">in</span>: &amp;cancellables)
    }
}
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Swift - Combine - combineLatest]]></title><description><![CDATA[What is it?
CombineLatest is an operator that combines more than one publishers, then provides a tuple of the latest value from each publisher.
The combined publisher doesn’t produce elements until each of its upstream publishers publishes at least o...]]></description><link>https://tech.radhakrishnan-s.co.uk/swift-combine-combinelatest</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/swift-combine-combinelatest</guid><category><![CDATA[Swift]]></category><category><![CDATA[Combine]]></category><category><![CDATA[Declarative]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Thu, 21 Nov 2024 13:25:16 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-what-is-it">What is it?</h1>
<p>CombineLatest is an operator that combines more than one publishers, then provides a tuple of the latest value from each publisher.</p>
<p>The combined publisher doesn’t produce elements until each of its upstream publishers publishes at least one element.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732179378188/d42f519b-6bc3-43de-88d5-89214654ae60.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-when-to-use">When to use?</h1>
<p>When we want the downstream subscriber to receive the data of the most-recent element from more than one publishers.( when any of them emit a value.)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732179399507/ebbe6757-891f-4020-9e2b-a3f69c009ce5.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-bmi-calculator-example">BMI Calculator example:</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732179537720/35abf1fb-5ca4-4e33-8563-a57686d467a2.png" alt class="image--center mx-auto" /></p>
<pre><code class="lang-swift">            <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">BMIViewmOdel</span>: <span class="hljs-title">ObservableObject</span> </span>{
    @<span class="hljs-type">Published</span> <span class="hljs-keyword">var</span> height: <span class="hljs-type">Double</span> = <span class="hljs-number">0</span>
    @<span class="hljs-type">Published</span> <span class="hljs-keyword">var</span> weight: <span class="hljs-type">Double</span> = <span class="hljs-number">0</span>
    @<span class="hljs-type">Published</span> <span class="hljs-keyword">var</span> bmi: <span class="hljs-type">Double</span> = <span class="hljs-number">0</span>
    @<span class="hljs-type">Published</span> <span class="hljs-keyword">var</span> type: <span class="hljs-type">String</span> = <span class="hljs-string">"Obese"</span>

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">var</span> cancellables = <span class="hljs-type">Set</span>&lt;<span class="hljs-type">AnyCancellable</span>&gt;()

    <span class="hljs-keyword">init</span>() {

        <span class="hljs-type">Publishers</span>.<span class="hljs-type">CombineLatest</span>($height, $weight)
            .<span class="hljs-built_in">map</span> { height, weight <span class="hljs-keyword">in</span>
                <span class="hljs-keyword">let</span> heightInMeters = height / <span class="hljs-number">100</span>
                <span class="hljs-keyword">return</span> weight/(heightInMeters * heightInMeters)
            }
            .sink{ [<span class="hljs-keyword">weak</span> <span class="hljs-keyword">self</span>] (bmi: <span class="hljs-type">Double</span>) <span class="hljs-keyword">in</span>
                <span class="hljs-keyword">self</span>?.bmi = bmi
                <span class="hljs-keyword">self</span>?.updateType(bmi)
            }.store(<span class="hljs-keyword">in</span>: &amp;cancellables)
    }

    <span class="hljs-keyword">private</span> <span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">updateType</span><span class="hljs-params">(<span class="hljs-number">_</span> bmi: Double)</span></span> {
        <span class="hljs-keyword">self</span>.type = <span class="hljs-keyword">switch</span> bmi {
        <span class="hljs-keyword">case</span> ..&lt;<span class="hljs-number">18.5</span>: <span class="hljs-string">"Underweight"</span>
        <span class="hljs-keyword">case</span> <span class="hljs-number">18.5</span>..&lt;<span class="hljs-number">24.9</span>: <span class="hljs-string">"Normal"</span>
        <span class="hljs-keyword">case</span> <span class="hljs-number">24.9</span>..&lt;<span class="hljs-number">29.9</span>: <span class="hljs-string">"Overweight"</span>
        <span class="hljs-keyword">default</span>: <span class="hljs-string">"Obeese"</span>
        }
    }


}

<span class="hljs-class"><span class="hljs-keyword">struct</span> <span class="hljs-title">ContentView</span>: <span class="hljs-title">View</span> </span>{
    @<span class="hljs-type">StateObject</span> <span class="hljs-keyword">var</span> viewModel : <span class="hljs-type">BMIViewmOdel</span> = <span class="hljs-type">BMIViewmOdel</span>()
    <span class="hljs-keyword">var</span> body: some <span class="hljs-type">View</span> {
        <span class="hljs-type">Form</span> {
            <span class="hljs-type">Section</span>(<span class="hljs-string">"Input"</span>) {
                <span class="hljs-type">TextField</span>(<span class="hljs-string">"Height"</span>, value: $viewModel.height, format: .number, prompt: <span class="hljs-type">Text</span>(<span class="hljs-string">"Enter heigh"</span>))
                <span class="hljs-type">TextField</span>(<span class="hljs-string">"Weight"</span>, value: $viewModel.weight, format: .number, prompt: <span class="hljs-type">Text</span>(<span class="hljs-string">"Enter the weight"</span>))
            }

            <span class="hljs-type">Section</span>(<span class="hljs-string">"Result"</span>) {
                <span class="hljs-type">Text</span>(<span class="hljs-string">"BMI: \(viewModel.bmi)"</span>)
                <span class="hljs-type">Text</span>(<span class="hljs-string">"Category: \(viewModel.type)"</span>)
            }

        }  .navigationTitle(<span class="hljs-string">"BMI Calculator"</span>)
    }
}
</code></pre>
<h1 id="heading-key-items-to-note">Key items to note:</h1>
<p>1. Won't emit ANY values until ALL publishers have emitted at least once</p>
<p>2.After the initial values are received, CombineLatest maintains the most recent value from each publisher. (Even if it is a passthrough subject although passthrough subject does not hold the value. :) )</p>
]]></content:encoded></item><item><title><![CDATA[Rejections in Interviews]]></title><description><![CDATA[Rejections are tough to handle, now and always. Looking back, I realize they were even more challenging a few years ago. I'd avoid any risk of rejection, even to the point of rejecting myself before others could.
Being rejected by an online form woul...]]></description><link>https://tech.radhakrishnan-s.co.uk/rejections-in-interviews</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/rejections-in-interviews</guid><category><![CDATA[how to handle rejections]]></category><category><![CDATA[failure]]></category><category><![CDATA[#FailureAsOpportunity]]></category><category><![CDATA[rejection]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Fri, 05 Jan 2024 16:53:33 GMT</pubDate><content:encoded><![CDATA[<p>Rejections are tough to handle, now and always. Looking back, I realize they were even more challenging a few years ago. I'd avoid any risk of rejection, even to the point of rejecting myself before others could.</p>
<p>Being rejected by an online form would feel like the end of the world to me. 😅</p>
<p>What brought about the change in my perspective? Two primary understandings:</p>
<p><strong>1. Embracing the power of iteration and compounding:</strong></p>
<p>I found that with repetitive, mindful practice, we can acquire and refine skills. Seeking perfection right off the bat often sets us up for disappointment.</p>
<p><strong>2. Shattering the myth of perfection:</strong></p>
<p>I learned that real progress is in attempts, feedback, and, believe it or not, rejections. Rejections aren't the end, but necessary steps on our journey towards success.</p>
<p>3. <strong>Transforming Rejections into Positive Sum Games: A Life and Interview Perspective</strong></p>
<p>Typically, when we're rejected for a job, a proposal, or any opportunity, it's easy to view the situation as a zero-sum game. We think we've lost, and the person or entity rejecting us has won. This can lead to feelings of personal failure, as if the rejection is a commentary on our value or worth.</p>
<p>For example, in a job interview scenario, you may not get the job, but that doesn't mean you're 'losing.' You gain experience, insight, and potentially feedback to help you improve for future interviews. Meanwhile, the company that rejected you isn't 'winning' in the sense of causing your loss; they're simply choosing the candidate that best fits their current needs.</p>
<ol>
<li><p><strong>What some one has learned with multiple iterations can not be mastered by me with few iterations</strong></p>
<p> The reality is that even though I want to win/be accepted in an exam, if someone else has gone through more iterations than me, the likelihood of the other person being accepted is higher. What is in my control is increasing the iterations I do and be ready to be accepted for another opportunity</p>
</li>
</ol>
<p>So, understanding rejection in the context of a non-zero sum game helps to depersonalize it. It allows us to see rejection as a part of the process rather than an end in itself, encouraging growth, learning, and resilience.</p>
<p>Handling interview rejections is still a unique challenge. They're never pleasant, but they're also seldom personal. Several factors can play a part:</p>
<p>1. our state of mind on the day</p>
<p>2. competition</p>
<p>3. even an overwhelmed interview panel.</p>
<p>It's essential to remember that rejections are less about us as individuals and more about the specific requirements at that moment. There will be a day when we will reject someone else and realize that it isn't about them as individuals either.</p>
<p>Rejections are <strong>universal</strong>, <strong>inevitable</strong>, and difficult. Yet, they also offer opportunities for <strong>learning</strong>, growth, and resilience. I'm already curious about how I'll handle my next rejection after penning down these thoughts. 🤔</p>
<p>So, what's your experience? How do you approach rejections, and what lessons have they taught you? Let's start a conversation!</p>
<p><strong>#rejections</strong> <strong>#failures</strong> <strong>#growthmindset</strong> <strong>#iteration</strong> <strong>#gametheory</strong></p>
]]></content:encoded></item><item><title><![CDATA[The importance of context in assessment]]></title><description><![CDATA[I often post my hypotheses on mindset, failures, success, growth in Linkedin.
This time I decided to let it be reviewed by LLMs ChatGPT and Bard.
Prompt
Hypothesis: Patience and Calm mind is the strategy. Rate this on different parameters of a hypoth...]]></description><link>https://tech.radhakrishnan-s.co.uk/the-importance-of-context-in-assessment</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/the-importance-of-context-in-assessment</guid><category><![CDATA[chatgpt]]></category><category><![CDATA[bard]]></category><category><![CDATA[context]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 31 May 2023 10:02:24 GMT</pubDate><content:encoded><![CDATA[<p>I often post my hypotheses on mindset, failures, success, growth in Linkedin.</p>
<p>This time I decided to let it be reviewed by LLMs ChatGPT and Bard.</p>
<h1 id="heading-prompt">Prompt</h1>
<p>Hypothesis: Patience and Calm mind is the strategy. Rate this on different parameters of a hypothesis in scale 1-10</p>
<h3 id="heading-chatgpt">ChatGPT:</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685612721272/714934ad-0087-4750-be32-a3b4b6ce121f.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-bard">Bard</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685612730891/7d044efc-9b49-4383-af2f-23795328c97a.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-my-understanding-and-follow-up">My understanding and follow up</h3>
<p>I was puzzled by the testability score gap between the 2 models.</p>
<p><mark>ChatGPT had 3/10</mark></p>
<p><mark>Bard had 7/10</mark></p>
<p>As I read through, I learned that chatGPT was considering that Calm mind and patience is subjective and can not be measured. Hence the Hypothesis can not be tested.</p>
<p>Whereas Bard assumed that Calm mind and Patience if can be measured will lead to better the testability of the success of those who practice it.</p>
<p>ChatGPT does not make the assumption that mindset and Calmness can be measured objectively.</p>
<p>Bard makes the assumption and goes on to correlate the success with the assumptions.</p>
<p><strong>Both are correct.</strong></p>
<h1 id="heading-so-why-would-different-models-have-different-response">So Why would different models have different response?</h1>
<p>Obviously they have different data sets.</p>
<p>What other factors that affect them?</p>
<h4 id="heading-here-is-bards-response">Here is bard's response:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685613672441/1c523fac-ff2f-4632-8271-1afff1f8fd3c.png" alt class="image--center mx-auto" /></p>
<h4 id="heading-here-is-chatgpts-response">Here is chatGPT's response:</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685613708911/3a5988ca-94c8-4be5-b125-c96d1bcb58c3.png" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Patience is the most important skill for a Software Engineer]]></title><description><![CDATA[As Engineers, we will face lack of clarity in below situations during our career

Requirements for a Feature

Growth in Organization

Appraisal

Debugging an issue that rarely occurs in production

Working with a new team member who does not share tr...]]></description><link>https://tech.radhakrishnan-s.co.uk/patience-is-the-most-important-skill-for-a-software-engineer</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/patience-is-the-most-important-skill-for-a-software-engineer</guid><category><![CDATA[Software Engineering]]></category><category><![CDATA[Patience]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 17 May 2023 16:39:23 GMT</pubDate><content:encoded><![CDATA[<p>As Engineers, we will face lack of clarity in below situations during our career</p>
<ol>
<li><p>Requirements for a Feature</p>
</li>
<li><p>Growth in Organization</p>
</li>
<li><p>Appraisal</p>
</li>
<li><p>Debugging an issue that rarely occurs in production</p>
</li>
<li><p>Working with a new team member who does not share tribal knowledge of your team</p>
</li>
<li><p>Learning a new programming language</p>
</li>
</ol>
<p>Under all these cases, if we have to solve problems sustainably and maintain good relationships with people we collaborate, we need <strong>patience</strong> with ourselves and with others</p>
<p>Each time we go through challenging situation, <strong>patience</strong> is the safest choice but often not the easiest .</p>
<h1 id="heading-does-it-make-business-sense-to-be-patient">Does it make business sense to be patient?</h1>
<ol>
<li><p>Patience helps one make better decisions and plans grounded in reality.</p>
</li>
<li><p>Patience helps one move from Fear by default mode to Trust by default mode. Fear by default always results in short term gains and long term debts</p>
</li>
</ol>
<p>Quality of our Decisions affect our quality and reliability of ourselves as a product and the product we build.</p>
<h1 id="heading-is-it-hard-to-be-patient">Is it hard to be patient?</h1>
<p>Yes and No.</p>
<p>If we do not consider it as a skill which takes time to learn, then Yes, it is hard to develop patience.</p>
<p>Patience is a skill and can be built by exercising it at every opportunity mindfully and recognizing the benefits you get out of it.</p>
<p>Recognize that Patience just like anyother skill needs time to become a second nature because it is about growing out of our comfort zone and better managing our frustrations.</p>
<p>We develop the muscle over several iterations. The more mindful we go through a phase, the earlier we can master patience for that situation.</p>
<h1 id="heading-how-to-develop-patience">How to develop patience?</h1>
<p>First recognizing that this can not be achieved over a day or a week or a month is important. There will be moments where when you believe that you developed patience, a new situation will topple your current mindset and you might end up acting impulsively.</p>
<p>The below items helps one with developing patience</p>
<ol>
<li><p>Setting realistic expectations for ourselves.</p>
<ol>
<li>Not every day is the same. Based on our daily circumstances, we should adjust our expectations of ourselves accordingly.</li>
</ol>
</li>
<li><p>Practicing Gratitude</p>
<ol>
<li>Helps us from focusing on what we have got instead of what we are lacking</li>
</ol>
</li>
<li><p>The Ultimate: Self Care</p>
<ol>
<li>No one will care about us more than ourselves. We know what we are going through. This is the foundation part of developing Patience</li>
</ol>
</li>
</ol>
<h1 id="heading-ending">Ending</h1>
<p>Finally, remember that developing a skill requires the mindset to reframe skill development as a process of progress rather than an achieved state.</p>
]]></content:encoded></item><item><title><![CDATA[Meetup - Succeeding in Software Development]]></title><description><![CDATA[I organized the first meet up on 29 April 2023. It was a meet and Greet event.
https://www.meetup.com/succeeding-in-software-career/events/292729665/
It was a virtual event.
Agenda:
To understand how often to meet and what to discuss.
Story time
Mars...]]></description><link>https://tech.radhakrishnan-s.co.uk/meetup-succeeding-in-software-development</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/meetup-succeeding-in-software-development</guid><category><![CDATA[Meetup]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 03 May 2023 15:05:17 GMT</pubDate><content:encoded><![CDATA[<p>I organized the first meet up on 29 April 2023. It was a meet and Greet event.</p>
<p><a target="_blank" href="https://www.meetup.com/succeeding-in-software-career/events/292729665/">https://www.meetup.com/succeeding-in-software-career/events/292729665/</a></p>
<p>It was a virtual event.</p>
<h1 id="heading-agenda"><strong>Agenda</strong>:</h1>
<p>To understand how often to meet and what to discuss.</p>
<h1 id="heading-story-time">Story time</h1>
<p>Mars Climate Orbiter's mission failure was discussed. This was lost due to a misunderstanding between metric and imperial units.</p>
<h1 id="heading-outcomes-planned-for-this-group">Outcomes planned for this group</h1>
<ol>
<li><p>Discuss and learn about growing technically and getting promotions with in a organization</p>
</li>
<li><p>Finding relevant career opportunties for members here and share them</p>
</li>
<li><p>Next meeting to be in Person and in chennai</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Scalable Communication]]></title><description><![CDATA[If we go back in history what is the earliest form of communication that would have been scalable?
I could think of "writing" and "Paintings"
Paintings suffer from a problem which is context, unlike writing.
When writing as a communication medium beg...]]></description><link>https://tech.radhakrishnan-s.co.uk/scalable-communication</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/scalable-communication</guid><category><![CDATA[communication]]></category><category><![CDATA[scalability]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 29 Mar 2023 15:17:35 GMT</pubDate><content:encoded><![CDATA[<p>If we go back in history what is the earliest form of communication that would have been scalable?</p>
<p>I could think of "writing" and "Paintings"</p>
<p>Paintings suffer from a problem which is context, unlike writing.</p>
<p>When writing as a communication medium began, asynchronously lot of people would have access to knowledge an older group of people experienced.</p>
<p><strong>For Example:</strong></p>
<p>The below one in tamil was written some 2000 years ago by Thiruvalluvar with 7 words. Its meaning can change anyone who reads it.</p>
<p>தெய்வத்தான் ஆகா தெனினும் முயற்சிதன் </p>
<p>மெய்வருத்தக் கூலி தரும்.</p>
<h4 id="heading-its-meaning">It's meaning:</h4>
<p>Even though God be against it, Effort is bound to pay the wages of labour.</p>
]]></content:encoded></item><item><title><![CDATA[Why anxiety is a blocker for Software Engineers?]]></title><description><![CDATA[Important skills for Software Engineers to grow are:

Adaptability

Learnability



Anxiety adversly affects both of them.]]></description><link>https://tech.radhakrishnan-s.co.uk/why-anxiety-is-a-blocker-for-software-engineers</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/why-anxiety-is-a-blocker-for-software-engineers</guid><category><![CDATA[anxiety]]></category><category><![CDATA[learning]]></category><category><![CDATA[adaptable]]></category><category><![CDATA[learnable]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 29 Mar 2023 15:04:08 GMT</pubDate><content:encoded><![CDATA[<p>Important skills for Software Engineers to grow are:</p>
<ol>
<li><p>Adaptability</p>
</li>
<li><p>Learnability</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1680102107365/3d789193-7245-480d-a11d-235d4a96d4e2.png" alt class="image--center mx-auto" /></p>
<p>Anxiety adversly affects both of them.</p>
]]></content:encoded></item><item><title><![CDATA[My Experiences with Chat GPT]]></title><description><![CDATA[I am building a prototype to learn React and I used ChatGPT 4.0 as a navigator.
Tools which I often use while programming which I did not have to use for my prototype:

Stackoverflow

Google


What kind of work chatGPT has been good at until now for ...]]></description><link>https://tech.radhakrishnan-s.co.uk/my-experiences-with-chat-gpt</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/my-experiences-with-chat-gpt</guid><category><![CDATA[chatgpt]]></category><category><![CDATA[React]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Mon, 27 Mar 2023 06:20:38 GMT</pubDate><content:encoded><![CDATA[<p>I am building a prototype to learn React and I used ChatGPT 4.0 as a navigator.</p>
<h1 id="heading-tools-which-i-often-use-while-programming-which-i-did-not-have-to-use-for-my-prototype">Tools which I often use while programming which I did not have to use for my prototype:</h1>
<ol>
<li><p>Stackoverflow</p>
</li>
<li><p>Google</p>
</li>
</ol>
<h1 id="heading-what-kind-of-work-chatgpt-has-been-good-at-until-now-for-me">What kind of work chatGPT has been good at until now for me?</h1>
<ol>
<li><p>Instructions to configure resources in Azure</p>
</li>
<li><p>Based on the context given, it is really good for creating javascript-related code</p>
</li>
</ol>
<h1 id="heading-what-kind-of-companies-will-be-benefitted">What kind of companies will be benefitted?</h1>
<ol>
<li><p>Start-ups who are finding PMF</p>
<ol>
<li>You can get a prototype done as fast as possible without ChatGPT</li>
</ol>
</li>
<li><p>For Established Companies</p>
<ol>
<li>Any new feature developments.</li>
</ol>
</li>
</ol>
<h1 id="heading-edge-browser">Edge browser</h1>
<p>I was never able to log in to chatGPT from the Edge browser. Chrome and Firefox had no issues.</p>
]]></content:encoded></item><item><title><![CDATA[How do I validate the effectiveness of a feature?]]></title><description><![CDATA[I use the below tools in my work to manage analytics:

Google Analytics

Tealium

Firebase


What did I like about Google Analytics?

It's interactiveness

The user segmentation


How does it help me?

Form a hypothesis.

Frame it as a question to va...]]></description><link>https://tech.radhakrishnan-s.co.uk/how-do-i-validate-the-effectiveness-of-a-feature</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/how-do-i-validate-the-effectiveness-of-a-feature</guid><category><![CDATA[analytics]]></category><category><![CDATA[Google Analytics]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Fri, 24 Feb 2023 03:08:20 GMT</pubDate><content:encoded><![CDATA[<p>I use the below tools in my work to manage analytics:</p>
<ol>
<li><p>Google Analytics</p>
</li>
<li><p>Tealium</p>
</li>
<li><p>Firebase</p>
</li>
</ol>
<h1 id="heading-what-did-i-like-about-google-analytics">What did I like about Google Analytics?</h1>
<ol>
<li><p>It's interactiveness</p>
</li>
<li><p>The user segmentation</p>
</li>
</ol>
<h1 id="heading-how-does-it-help-me">How does it help me?</h1>
<ol>
<li><p>Form a hypothesis.</p>
</li>
<li><p>Frame it as a question to validate the hypothesis</p>
</li>
<li><p>Create relevant user segmentation and validate the events</p>
</li>
</ol>
<h3 id="heading-example">Example:</h3>
<h4 id="heading-hypothesis">Hypothesis</h4>
<p>The % of successful signup is 100 on Mobile devices</p>
<h4 id="heading-question">Question</h4>
<p>Do mobile users have 100% successful signups?</p>
<h4 id="heading-how-do-i-test-it">How do I test it?</h4>
<ol>
<li><p>Create a user segment of mobile devices - With varied parameters given below</p>
<ol>
<li><p>App</p>
</li>
<li><p>Device Brand name</p>
</li>
<li><p>Exclude vs Include</p>
</li>
</ol>
</li>
<li><p>Add a secondary dimension if required to look for a specific bunch of events</p>
<ol>
<li>The event starts/contains with "signup"</li>
</ol>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Microsoft Certified: Azure Fundamentals - AZ-900]]></title><description><![CDATA[I cleared the AZ-900 Exam. :)
Below are my learnings:

Operational Expenses and Captial Expenditure are two topics that I enjoy reading about. These 2 topics are the core concepts in Cloud fundamentals. It made my learning so much more enjoyable.

Po...]]></description><link>https://tech.radhakrishnan-s.co.uk/microsoft-certified-azure-fundamentals-az-900</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/microsoft-certified-azure-fundamentals-az-900</guid><category><![CDATA[azure certified]]></category><category><![CDATA[Azure]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Sat, 28 Jan 2023 11:45:39 GMT</pubDate><content:encoded><![CDATA[<p>I cleared the AZ-900 Exam. :)</p>
<p>Below are my learnings:</p>
<ol>
<li><p>Operational Expenses and Captial Expenditure are two topics that I enjoy reading about. These 2 topics are the core concepts in Cloud fundamentals. It made my learning so much more enjoyable.</p>
</li>
<li><p>Power of elimination: As I learned about the fundamentals it was easy to eliminate what could not be the correct answer</p>
</li>
</ol>
<h1 id="heading-preparation">Preparation:</h1>
<p>I used the below resources to prepare for it:</p>
<ol>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=_WWJJYGF9ts">Az-900-1</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=R32_e358RZw&amp;t=896s">Az-900-2</a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/@Azure4Everyone">Azure Fundamentals</a></p>
<ol>
<li>This channel explains the concepts from the ground up with an example</li>
</ol>
</li>
</ol>
<h1 id="heading-during-learning">During learning</h1>
<h4 id="heading-one-mistake-i-did-was"><strong>One mistake I did was</strong></h4>
<p>not allotting a buffer time of say 2-3 days to revise/reflect on the videos again before the exam</p>
<h4 id="heading-one-good-thing-i-did-was"><strong>One good thing I did was:</strong></h4>
<p>While watching the videos the first time, I analyzed all the options of the answers, not just the correct ones. That helped me mentally map the services and helped me better with the elimination of the answers</p>
]]></content:encoded></item><item><title><![CDATA[First Class functions in Swift]]></title><description><![CDATA[Swift has first-class functions. First-class functions can be

Stored into variable

Returned from a function

Passed as an argument


Returning a function from another function and storing them in a variable
func add(p1: Int, p2: Int) -> Int {

retu...]]></description><link>https://tech.radhakrishnan-s.co.uk/first-class-functions-in-swift</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/first-class-functions-in-swift</guid><category><![CDATA[Swift]]></category><category><![CDATA[Functional Programming]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Sat, 17 Dec 2022 03:12:07 GMT</pubDate><content:encoded><![CDATA[<p>Swift has first-class functions. First-class functions can be</p>
<ol>
<li><p>Stored into variable</p>
</li>
<li><p>Returned from a function</p>
</li>
<li><p>Passed as an argument</p>
</li>
</ol>
<h1 id="heading-returning-a-function-from-another-function-and-storing-them-in-a-variable">Returning a function from another function and storing them in a variable</h1>
<pre><code class="lang-swift"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">add</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1+p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">subtract</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1-p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">multiply</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1*p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">divide</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1/p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">mod</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1%p2

}
</code></pre>
<p>The above code is refactored to below where functions are returned from another function and functions are stored in a variable.</p>
<pre><code class="lang-swift"><span class="hljs-class"><span class="hljs-keyword">enum</span> <span class="hljs-title">Operation</span> </span>{

<span class="hljs-keyword">case</span> add

<span class="hljs-keyword">case</span> subtract

<span class="hljs-keyword">case</span> multiply

<span class="hljs-keyword">case</span> divide

<span class="hljs-keyword">case</span> mod

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">chooseOperator</span><span class="hljs-params">(operation: Operation)</span></span> -&gt; (<span class="hljs-type">Int</span>, <span class="hljs-type">Int</span>) -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">add</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1+p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">subtract</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1-p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">multiply</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1*p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">divide</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1/p2

}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">mod</span><span class="hljs-params">(p1: Int, p2: Int)</span></span> -&gt; <span class="hljs-type">Int</span> {

<span class="hljs-keyword">return</span> p1%p2

}

<span class="hljs-keyword">switch</span> operation {

<span class="hljs-keyword">case</span> .add:

<span class="hljs-keyword">return</span> add

<span class="hljs-keyword">case</span> .divide:

<span class="hljs-keyword">return</span> divide

<span class="hljs-keyword">case</span> .mod:

<span class="hljs-keyword">return</span> mod

<span class="hljs-keyword">case</span> .multiply:

<span class="hljs-keyword">return</span> multiply

<span class="hljs-keyword">case</span> .subtract:

<span class="hljs-keyword">return</span> subtract

}

}

<span class="hljs-keyword">let</span> addition = chooseOperator(operation: .add)

addition(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>)

<span class="hljs-keyword">let</span> multiplication = chooseOperator(operation: .multiply)

multiplication(<span class="hljs-number">3</span>, <span class="hljs-number">2</span>)
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Handle insecurities and self doubts - 1]]></title><description><![CDATA[Software development is a collaborative activity dealing with other people with similar emotions which are

Aspiration

Jealousy

Fear

Hope

Love

Hate


Just like us others also long for the below:

Good salary

Promotions

Appreciation - Recogniti...]]></description><link>https://tech.radhakrishnan-s.co.uk/handle-insecurities-and-self-doubts-1</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/handle-insecurities-and-self-doubts-1</guid><category><![CDATA[Collaboration]]></category><category><![CDATA[team]]></category><category><![CDATA[#emotionalhealth]]></category><category><![CDATA[#emotional intelligence]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Wed, 09 Nov 2022 07:20:19 GMT</pubDate><content:encoded><![CDATA[<p>Software development is a collaborative activity dealing with other people with similar emotions which are</p>
<ol>
<li><p>Aspiration</p>
</li>
<li><p>Jealousy</p>
</li>
<li><p>Fear</p>
</li>
<li><p>Hope</p>
</li>
<li><p>Love</p>
</li>
<li><p>Hate</p>
</li>
</ol>
<p>Just like us others also long for the below:</p>
<ol>
<li><p>Good salary</p>
</li>
<li><p>Promotions</p>
</li>
<li><p>Appreciation - Recognition for work</p>
</li>
</ol>
<h1 id="heading-how-are-we-different-from-others">How are we different from others?</h1>
<h3 id="heading-each-of-our-approaches-to-coping-with-stress"><em>Each of our approaches to coping( with stress)</em></h3>
<p>If our coping strategy leads us to</p>
<p>jealousy instead of aspiration,</p>
<p>fear instead of hope,</p>
<p>hate instead of love,</p>
<p>it is time to change our approach to coping with stress.</p>
<h1 id="heading-what-lies-at-the-foundation-of-this-difference">What lies at the foundation of this difference?</h1>
<p>Fixed mindset vs Growth Mindset</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Fixed Mindset</td><td>Growth Mindset</td></tr>
</thead>
<tbody>
<tr>
<td>Jealousy</td><td>Aspiration</td></tr>
<tr>
<td>Fear</td><td>Hope</td></tr>
<tr>
<td>Hate</td><td>Love</td></tr>
</tbody>
</table>
</div><h1 id="heading-how-do-i-build-a-better-coping-strategy">How do I build a better coping strategy?</h1>
<ol>
<li><p>Remind yourself of how good you were without stress or with good coping strategies in the past</p>
</li>
<li><p>Write down your wins</p>
</li>
<li><p>Appreciate yourself for even small wins. None can notice that. You deserve kudos for even minor improvements. Be your cheerleader</p>
</li>
<li><p>Realize that this is an infinite game and you might have failures but by learning from them you will have more wins</p>
</li>
<li><p>Understand your journey is different from others. Never ever compare yourself to others if it causes jealousy.</p>
</li>
</ol>
]]></content:encoded></item><item><title><![CDATA[Decision making]]></title><description><![CDATA[Making wrong decisions quickly is better than taking no decisions at all.
Wrong decision helps us with a learning.
No decision only delays the unknown and let’s us be in fear and make things worse than what it could actually lead to.
No decision is s...]]></description><link>https://tech.radhakrishnan-s.co.uk/decision-making</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/decision-making</guid><category><![CDATA[decision]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Tue, 08 Nov 2022 15:36:26 GMT</pubDate><content:encoded><![CDATA[<p>Making wrong decisions quickly is better than taking no decisions at all.</p>
<p>Wrong decision helps us with a learning.</p>
<p>No decision only delays the unknown and let’s us be in fear and make things worse than what it could actually lead to.</p>
<p>No decision is still a decision. 😊</p>
<p>Making a wrong decision earlier also helps us build knowledge to course correct towards better decisions sooner than No decision approach.</p>
<p>Another factor to consider here is Reversible and Irreversible</p>
]]></content:encoded></item><item><title><![CDATA[Map and filter functionality using reduce - Swift]]></title><description><![CDATA[Reduce is defined as below:

Returns the result of combining the elements of the sequence using the given closure.

Can we form the result of a map/filter function using reduce?
Yes. 
Reduce function takes a sequence as an input and returns a generic...]]></description><link>https://tech.radhakrishnan-s.co.uk/map-and-filter-functionality-using-reduce-swift</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/map-and-filter-functionality-using-reduce-swift</guid><category><![CDATA[Swift]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Fri, 14 May 2021 13:04:19 GMT</pubDate><content:encoded><![CDATA[<p>Reduce is defined as below:</p>
<blockquote>
<p>Returns the result of combining the elements of the sequence using the given closure.</p>
</blockquote>
<p>Can we form the result of a map/filter function using reduce?</p>
<p>Yes. </p>
<p>Reduce function takes a sequence as an input and returns a generic output not. By setting the appropriate initial result and closure function we can exploit the reduce function to return another sequence instead of a single value result. </p>
<p><strong>Reduce function as a map
</strong></p>
<pre><code><span class="hljs-keyword">let</span> numbers1 = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]
<span class="hljs-keyword">let</span> numberSum1 = numbers1.<span class="hljs-built_in">reduce</span>([], { x, y <span class="hljs-keyword">in</span>
    <span class="hljs-keyword">return</span> x + [<span class="hljs-number">2</span>*y]
})
<span class="hljs-built_in">print</span>(numberSum1)
</code></pre><p><strong>Result</strong></p>
<pre><code>[<span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">6</span>, <span class="hljs-number">8</span>]
</code></pre><p><strong>Reduce function as a filter
</strong></p>
<pre><code><span class="hljs-string">let</span> <span class="hljs-string">numberSum2</span> <span class="hljs-string">=</span> [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]<span class="hljs-string">.reduce([],</span> { <span class="hljs-string">x</span>, <span class="hljs-string">y</span> <span class="hljs-string">in</span>
    <span class="hljs-string">return</span> <span class="hljs-string">x</span> <span class="hljs-string">+</span> <span class="hljs-string">((y</span> <span class="hljs-string">%</span> <span class="hljs-number">2</span> <span class="hljs-string">==</span> <span class="hljs-number">0</span><span class="hljs-string">)</span> <span class="hljs-string">?</span> [<span class="hljs-string">y</span>] <span class="hljs-string">:</span> []<span class="hljs-string">)</span>
}<span class="hljs-string">)</span>

<span class="hljs-string">print(numberSum2)</span>
</code></pre><p><strong>Result</strong></p>
<pre><code>[<span class="hljs-number">2</span>, <span class="hljs-number">4</span>]
</code></pre><p><strong>Article that inspired me to write this post:
</strong>
https://swiftunboxed.com/lang/reduce/</p>
]]></content:encoded></item><item><title><![CDATA[Swift - Struct vs Class]]></title><description><![CDATA[Struct:

It has value semantics and hence variable and value is unified. 
Each instance can have only one owner
The value held by a variable can not be manipulated without changing the variable itself
Efficient compared to class due to copy on write ...]]></description><link>https://tech.radhakrishnan-s.co.uk/swift-struct-vs-class</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/swift-struct-vs-class</guid><category><![CDATA[Swift]]></category><category><![CDATA[class]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Thu, 29 Apr 2021 15:22:39 GMT</pubDate><content:encoded><![CDATA[<p><strong>Struct</strong>:</p>
<ol>
<li>It has value semantics and hence variable and value is unified. </li>
<li>Each instance can have only one owner</li>
<li>The value held by a variable can not be manipulated without changing the variable itself</li>
<li>Efficient compared to class due to copy on write and no involvement of retain count management</li>
<li>A Code that uses struct  without any of its members being reference type is easy to reason because ownership is clearly defined</li>
<li>No memory leaks  to deal with</li>
<li>When a variable becomes immutable, the instance also becomes immutable and if a variable is mutable then the instance also becomes mutable when it has mutable variables or mutable methods.</li>
</ol>
<p><strong>Classes</strong>:</p>
<ol>
<li>The variable and instance are different and hence both can be manipulated separately</li>
<li>Each instance can have more than one owner</li>
<li>If an instance is amended, then all the references represented by different variables will be impacted </li>
<li>When a variable holding reference is made as immutable only the reference the variable holds is immutable not the instance the reference is pointing to. To make a class instance immutable, all its stored properties must be immutable</li>
</ol>
<p>Thanks to KHAWER KHALIQ for providing such comprehensive writing on structs vs classes</p>
<p>https://khawerkhaliq.com/blog/swift-value-types-reference-types/</p>
]]></content:encoded></item><item><title><![CDATA[Concurrency with GCD in Swift - 1]]></title><description><![CDATA[Serial Queue:

Executes only one item at a time irrespective of the number of tasks in the Queue
Good when there is a necessity to provide controlled access to a queue


func serialQueue() {
    let serialQueue = DispatchQueue(label: "test.com")
    ...]]></description><link>https://tech.radhakrishnan-s.co.uk/concurrency-with-gcd-in-swift-1</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/concurrency-with-gcd-in-swift-1</guid><category><![CDATA[Swift]]></category><category><![CDATA[queue]]></category><category><![CDATA[concurrency]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Sat, 17 Apr 2021 12:13:58 GMT</pubDate><content:encoded><![CDATA[<h1 id="serial-queue">Serial Queue:</h1>
<ol>
<li>Executes only one item at a time irrespective of the number of tasks in the Queue</li>
<li>Good when there is a necessity to provide controlled access to a queue</li>
</ol>
<pre><code>
<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">serialQueue</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">let</span> serialQueue = <span class="hljs-type">DispatchQueue</span>(label: <span class="hljs-string">"test.com"</span>)
    serialQueue.async {
        sleep(<span class="hljs-number">10</span>)
       <span class="hljs-built_in">print</span>(<span class="hljs-string">"SERIAL 1"</span>)

    }
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"SERIAL 2"</span>)
    }
}
</code></pre><p>Result:</p>
<pre><code>
<span class="hljs-type">SERIAL</span> <span class="hljs-number">1</span>
<span class="hljs-type">SERIAL</span> <span class="hljs-number">2</span>
</code></pre><p>Irrespective of the sleep function value SERIAL 2 will be printed only after SERIAL 2 as in serial Queue the processing of the task will be in the order in which tasks gets added to the Queue.</p>
<h1 id="concurrent-queue">Concurrent Queue:</h1>
<ol>
<li>Executes multiple tasks (if added) at a time</li>
</ol>
<pre><code>
<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">customConcurrentQueue</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">let</span> concurrentQueue = <span class="hljs-type">DispatchQueue</span>(label: <span class="hljs-string">"test.concurrentqueue"</span>, attributes: .concurrent)
    concurrentQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"CONCURRENT Task 1 started"</span>)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"CONCURRENT Task 1 finished"</span>)
    }
    concurrentQueue.sync {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"CONCURRENT Task 2 started"</span>)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"CONCURRENT Task 2 finished"</span>)
    }
}
customConcurrentQueue()
</code></pre><p><strong>Result of Execution 1:
</strong></p>
<pre><code><span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">1</span> started
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">2</span> started
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">2</span> finished
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">1</span> finished
</code></pre><p>Despite Task 1 beginning first, Task 2 which began later was completed.  That is concurrency. </p>
<p><strong>Result of Execution 2:
</strong></p>
<pre><code><span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">2</span> started
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">1</span> started
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">2</span> finished
<span class="hljs-attribute">CONCURRENT</span> Task <span class="hljs-number">1</span> finished
</code></pre><h1 id="synchronous">Synchronous</h1>
<p>When a task is executed synchronously, the calling thread is blocked, and only when the execution is completed, the calling thread can continue its execution</p>
<p><strong>Sync in Concurrent Queue
</strong></p>
<pre><code>func testSyncInConcurrent() {
    DispatchQueue.<span class="hljs-keyword">global</span>().sync {
        print(<span class="hljs-string">"1"</span>)
    }
    print(<span class="hljs-string">"Post Sync Execution"</span>)
    DispatchQueue.<span class="hljs-keyword">global</span>().<span class="hljs-keyword">async</span> {
        print(<span class="hljs-string">"2"</span>)
    }
    DispatchQueue.<span class="hljs-keyword">global</span>().<span class="hljs-keyword">async</span> {
        print(<span class="hljs-string">"3"</span>)
    }
}
testSyncInConcurrent()
</code></pre><p>Result</p>
<pre><code><span class="hljs-number">1</span>
<span class="hljs-string">Post</span> <span class="hljs-string">Sync</span> <span class="hljs-string">Execution</span>
<span class="hljs-number">3</span>
<span class="hljs-number">2</span>
</code></pre><p>Irrespective of any number of executions, 1 will be always printed first in sequence as testSyncInConcurrent() is blocked by the synchronous block of execution.</p>
<p><strong>Sync in Serial Queue
</strong></p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">testSyncinSerial</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">let</span> serialQueue = <span class="hljs-type">DispatchQueue</span>(label: <span class="hljs-string">"test.com"</span>)
    serialQueue.sync {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"1"</span>)
    }
    <span class="hljs-built_in">print</span>(<span class="hljs-string">"Post Sync Execution"</span>)
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"2"</span>)
    }
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"3"</span>)
    }
}
testSyncinSerial()
</code></pre><p>Result:</p>
<pre><code><span class="hljs-number">1</span>
<span class="hljs-string">Post-Sync</span> <span class="hljs-string">Execution</span>
<span class="hljs-number">2</span>
<span class="hljs-number">3</span>
</code></pre><h1 id="asynchronous">Asynchronous:</h1>
<p>When a task is executed asynchronously, the calling thread is not blocked and can continue to execute other tasks it has been enqueued with.</p>
<p>Let us execute all async tasks in a serial Queue. Since serial queue does always execute the tasks one by one,  even though the tasks are asynchronous in nature, they get executed one by one.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">testAsyncInSerial</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">let</span> serialQueue = <span class="hljs-type">DispatchQueue</span>(label: <span class="hljs-string">"test.com"</span>)
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"1"</span>)
        sleep(<span class="hljs-number">10</span>)
    }
    <span class="hljs-built_in">print</span>(<span class="hljs-string">"Post ASync Execution"</span>)
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"2"</span>)
    }
    serialQueue.async {
        <span class="hljs-built_in">print</span>(<span class="hljs-string">"3"</span>)
    }
}
</code></pre><p>Result:</p>
<pre><code><span class="hljs-number">1</span>
<span class="hljs-string">Post</span> <span class="hljs-string">ASync</span> <span class="hljs-string">Execution</span>
<span class="hljs-number">2</span>
<span class="hljs-number">3</span>
</code></pre><p>Let us execute multiple async tasks in a concurrent queue. Unlike the last time in serial queue, the order of execution does not follow as the tasks are added to the queue. With each new execution of the code the order of tasks executed has changed.</p>
<pre><code>
func testAsyncInConcurrent() {
    let concurrent = DispatchQueue.<span class="hljs-keyword">global</span>()
    concurrent.<span class="hljs-keyword">async</span> {
        print(<span class="hljs-string">"BEGIN 1"</span>)
        sleep(<span class="hljs-number">10</span>)
        print(<span class="hljs-string">"END 1"</span>)
    }
    print(<span class="hljs-string">"Post ASync Execution"</span>)
    concurrent.<span class="hljs-keyword">async</span> {
        print(<span class="hljs-string">"BEGIN 2"</span>)
        print(<span class="hljs-string">"END 2"</span>)
    }
    concurrent.<span class="hljs-keyword">async</span> {
        print(<span class="hljs-string">"BEGIN 3"</span>)
        print(<span class="hljs-string">"END 3"</span>)
    }
}
testAsyncInConcurrent()
</code></pre><p>Result of Execution 1</p>
<pre><code><span class="hljs-keyword">BEGIN</span> <span class="hljs-number">1</span>
Post ASync Execution
<span class="hljs-keyword">BEGIN</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">BEGIN</span> <span class="hljs-number">3</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">3</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">1</span>
</code></pre><p>Result of Execution 2:</p>
<pre><code>
<span class="hljs-keyword">BEGIN</span> <span class="hljs-number">1</span>
Post ASync Execution
<span class="hljs-keyword">BEGIN</span> <span class="hljs-number">3</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">3</span>
<span class="hljs-keyword">BEGIN</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">2</span>
<span class="hljs-keyword">END</span> <span class="hljs-number">1</span>
</code></pre>]]></content:encoded></item><item><title><![CDATA[Programming and Intuition]]></title><description><![CDATA[Javascript:

console.log("A" > "a") //Intuition says true
Swift:
print("A">"a") //Intuition says true
What is the expected result? My mental about English alphabets were Upper case letters were bigger than Lower case letters. Hence I expected the res...]]></description><link>https://tech.radhakrishnan-s.co.uk/programming-and-intuition</link><guid isPermaLink="true">https://tech.radhakrishnan-s.co.uk/programming-and-intuition</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Swift]]></category><category><![CDATA[programming languages]]></category><category><![CDATA[Foundation]]></category><dc:creator><![CDATA[Radhakrishnan Selvaraj]]></dc:creator><pubDate>Sun, 11 Apr 2021 17:21:11 GMT</pubDate><content:encoded><![CDATA[<p><strong>Javascript:
</strong></p>
<pre><code>console.log("A" &gt; "a") //Intuition says <span class="hljs-keyword">true</span>
</code></pre><p><strong>Swift</strong>:</p>
<pre><code><span class="hljs-selector-tag">print</span>(<span class="hljs-string">"A"</span>&gt;<span class="hljs-string">"a"</span>) <span class="hljs-comment">//Intuition says true</span>
</code></pre><p>What is the expected result? My mental about English alphabets were Upper case letters were bigger than Lower case letters. Hence I expected the result to be true.</p>
<p><strong>Result is: 
</strong></p>
<pre><code><span class="hljs-literal">false</span>
</code></pre><p><strong>Why is my intuition wrong?
</strong></p>
<p>My mental model of alphabets was correct in Real-world but the Programming languages' model about alphabets are different than mine.</p>
<blockquote>
<p>Index of <strong>a</strong> in Unicode table  -  <strong>0061</strong></p>
<p>Index of <strong>A</strong>  in Unicode table -  <strong>0041</strong></p>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1618161192305/LJJ1hGQLt.png" alt="Screenshot 2021-04-11 at 10.13.13 PM.png" /></p>
<p>An interesting perspective I read about Intuition and programming is  <a target="_blank" href="https://amasad.me/intuition">here</a> </p>
<p><strong>References</strong>:</p>
<p>https://www.unicode.org/charts/PDF/U0100.pdf</p>
<p>https://unicode-table.com/en/#basic-latin</p>
<p>https://javascript.info/comparison</p>
]]></content:encoded></item></channel></rss>