<?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 Abhijit Pachpande on Medium]]></title>
        <description><![CDATA[Stories by Abhijit Pachpande on Medium]]></description>
        <link>https://medium.com/@abhijitpachpande?source=rss-f52f97cebdb2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GVIoEDwoOaZXYe01wSUdYg.jpeg</url>
            <title>Stories by Abhijit Pachpande on Medium</title>
            <link>https://medium.com/@abhijitpachpande?source=rss-f52f97cebdb2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 14:01:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhijitpachpande/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[Ancient secret of work — Karma Yoga]]></title>
            <link>https://medium.com/@abhijitpachpande/ancient-formula-for-efficient-work-36a4ce7be6c1?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/36a4ce7be6c1</guid>
            <category><![CDATA[hinduism]]></category>
            <category><![CDATA[bhagavad-gita]]></category>
            <category><![CDATA[vivekananda]]></category>
            <category><![CDATA[karmayoga]]></category>
            <category><![CDATA[karma]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Fri, 28 Feb 2025 10:39:48 GMT</pubDate>
            <atom:updated>2025-02-28T10:53:15.794Z</atom:updated>
            <content:encoded><![CDATA[<p>Karma Yoga is misunderstood in a million ways. In this blog, you will find a practical approach that Karma Yoga teaches.</p><p>Firstly, the word Karma has many meanings. For the context of this blog, it means “work”. Karma yoga is the science of doing work.</p><p>In the Bhagavad Gita, there are 2 shloka’s that beautifully summarize Karma Yoga.</p><ol><li><strong>योग: कर्मसु कौशलम् — </strong><em>yogaḥ karmasu kauśhalam </em>(Chapter 2, Verse: 50)</li><li><strong>कर्मण्येवाधिकारस्ते मा फलेषु कदाचन । मा कर्मफलहेतुर्भुर्मा ते संगोऽस्त्वकर्मणि ॥ — </strong><em>Karmanye vadhikaraste Ma Phaleshu Kadachana,<br>Ma Karmaphalaheturbhurma Te Sangostvakarmani </em>(Chapter 2, Verse: 47)</li><li><strong>योग: कर्मसु कौशलम् — </strong><em>yogaḥ karmasu kauśhalam</em></li></ol><p>This verse means that yoga is skill in action. It is doing work with cleverness, effectiveness and as a science — striving for beauty and perfection in it.</p><p>It also means that we should choose the work skillfully and wisely. At any given moment, human beings have multiple choices of action. Amongst the alternatives, we have the <strong>freedom to choose</strong> the action that we perform. This is what is explained as “<strong>The last of the human freedoms</strong>” by Viktor Frankl and as “<strong>Being Proactive</strong>” in the famous book <em>The 7 habits of highly effective people</em>. This leads us to the second shloka</p><p>2. <strong>कर्मण्येवाधिकारस्ते मा फलेषु कदाचन । मा कर्मफलहेतुर्भुर्मा ते संगोऽस्त्वकर्मणि ॥ — </strong><em>Karmanye vadhikaraste Ma Phaleshu Kadachana,<br>Ma Karmaphalaheturbhurma Te Sangostvakarmani</em></p><p>Often paraphrased prematurely as “keep working and don’t worry about the result,” this shloka has a deeper meaning that needs to be understood.</p><p>It literally means that you have the right to work, but not to the results thereof. Let’s try to understand this in the light of the first shloka.</p><p>We have the right to work. That is to say, we have the right to <strong>choose </strong>our actions ( and by extension, choose how well we perform them). To make the right choices, we must think through the various consequences of our actions. We must have goals.</p><p>However, the result of our action can be different from the result we had in mind. There are many external factors beyond our control. Therefore, the shloka states in its second part that we do not have the <strong>right, control or authority </strong>over the results of the action.</p><p>Recognizing this, we must keep our focus on work and be detatched from the outcome. One way to do this is to develop <em>prasad buddhi —</em>accepting the result as one accepts <em>Prasad</em> (a sacred offering) and being content with it.. By surrendering to the wisdom of a higher power and accepting the present moment as divine will, we can take responsibility for choosing the right action.</p><blockquote>Ours is to work, the results will take care of themselves<br>- Swami Vivekananda</blockquote><h3>In Summary:</h3><ul><li>We have the right to choose our work and must perform it with a sense of ownership.</li><li>Whatever the result — good or bad — we should accept it with <em>prasad buddhi</em> and be satisfied.</li><li>Things will come to us. We don’t need to keep desiring; we need to make ourselves deserving.</li></ul><p>I would love to hear your thoughts on this post. Feel free to leave a comment. If you like the content, do follow me — I will continue bringing more such content in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kXQoigmgDLCzRf7I" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36a4ce7be6c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Tech to improve your addition]]></title>
            <link>https://medium.com/@abhijitpachpande/simple-tech-to-improve-your-addition-64749f10f07c?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/64749f10f07c</guid>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Thu, 26 Dec 2024 17:33:18 GMT</pubDate>
            <atom:updated>2024-12-26T17:33:18.440Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvU7GupSx1pI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvU7GupSx1pI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvU7GupSx1pI%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2619a0446a2f104721d20d298a68367/href">https://medium.com/media/b2619a0446a2f104721d20d298a68367/href</a></iframe><p>Fast calculation gives you and edge in any competition, especially in exams like CAT where the time per question is low under high pressure. Arun Sharma, one of the best CAT faculty tells a method to improve your addition. According to him, once your addition improves, all other calculation gets better themselves.</p><h4>The Practice</h4><p>Arun Sharma suggests to write down random numbers in circle and practice adding them starting from random positions. Instead of putting random numbers yourself on a paper, I decided to create a quick website for doing that. I have been practicing it for 2 days now and can already see improvement.</p><p>You can check it out <a href="https://addition.abhijitpachpande.co.in/">here</a>. I suggest you take a look at the video once before starting.</p><p>Hope someone else finds this useful too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64749f10f07c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What should you choose: Native vs JVM?]]></title>
            <link>https://medium.com/@abhijitpachpande/what-should-you-choose-native-vs-jvm-320b543c34f7?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/320b543c34f7</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[quarkus]]></category>
            <category><![CDATA[graalvm]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Wed, 25 Sep 2024 15:34:37 GMT</pubDate>
            <atom:updated>2024-09-26T10:16:08.445Z</atom:updated>
            <content:encoded><![CDATA[<p>When should you use native and when should you go with JVM?</p><blockquote><strong>There are no solutions, only trade-offs.</strong><br> — Thomas Sowell</blockquote><p>There is a buzz around native compilation of java applications with new age tools like graalvm and frameworks like quarkus. But should you move to native? Let’s have a look at some factors that you must take into consideration before making a decision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PX6f7vY7u35dT54gmfOLNg.jpeg" /></figure><h4>Performance Impact on start up times</h4><p>So your application starts faster. Who cares? This thought process is correct if we remove moving to cloud from the equation.</p><p>Especially with adoption of kubernetes, where container restarts is not exactly in your control, it makes sense that you would want to optimize the startup time. If your application takes up a lot of time and resources during startup, it will cause memory spikes, and you would end up paying more.</p><p>Graalvm uses ahead of time compilation and creates executable native binaries that run directly on the operating system. These binaries start faster because you don’t have to spin up a JVM to execute the application. It starts in milliseconds and consumes less memory, making java more usable in serverless environments.</p><h4>Performance Impact in terms of latency</h4><p>Native compilation happens statically and ahead-of-time. It has no way to know which functions are called more often. Hence, it has no way to optimize for that. Whereas JVM optimizes itself according to the user’s interaction with the system. The getter/setters and functions that are used more often are optimized for performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1HmpojOTzLLZ5dgzMDfHA.jpeg" /></figure><h4>Developer Experience</h4><p>This is from personal experience and is subjective. Debugging issues in native-compiled applications is tough. I personally use Quarkus dev mode while developing application that uses JVM under the hood. It has happened several times that things work fine on JVM but start breaking after making native image. For example, you need to understand how reflections are handled in native images.</p><blockquote>Native Image tries to resolve the target elements through a static analysis that detects calls to the Reflection API. Where the analysis fails, the program elements reflectively accessed at run time must be specified using a manual configuration.<br>- <a href="https://docs.oracle.com/en/graalvm/enterprise/20/docs/reference-manual/native-image/Reflection/#automatic-detection">Source — oracle documentation</a></blockquote><p>So that means that Reflection may or may not work. It is vague. To be safe, I register all the DTOs in the application for reflection manually.</p><p>Apart from reflections, I have seen issues in serialization as well.</p><p>In an enterprise setup, this leads to bad developer experience.</p><p>That being said, there is rapid progress in these technologies and things can change in the future.</p><p>Hence, consider the time, experience, and energy of your engineers to adapt and keep up with the latest trends in this technology before making a decision.</p><h4>Summary</h4><p>Use native in —</p><ol><li>Serverless Environments</li><li>When container restarts are common and in less control, like Kubernetes.</li><li>When you have a fast paced continuous integration continuous delivery in place.</li></ol><p>Use JVM where —</p><ol><li>When you have long running application that rarely needs to restart or changed.</li><li>When your application is running on on-premise server.</li><li>When you do not have developer’s with experience in debugging native related issues.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=320b543c34f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Developer’s Edge]]></title>
            <link>https://medium.com/@abhijitpachpande/the-developers-edge-d5d7758fb707?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d7758fb707</guid>
            <category><![CDATA[naval-ravikant]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[atomic-habit]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[james-clear]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Mon, 16 Sep 2024 14:27:42 GMT</pubDate>
            <atom:updated>2024-09-16T14:43:49.029Z</atom:updated>
            <content:encoded><![CDATA[<p>Cultivating learning habits that stick, is difficult. Being a developer requires the ability to keep learning to stay relevant. <strong>Hence, the most important skill you develop as a developer is your learning habit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oWwodpy6dY4OFyhj" /></figure><p>There are several blogs and summary videos on the amazing book by James Clear — <em>Atomic Habits</em>. Personally, before reading this book, I went through a lot of summary videos and blogs which were all about the “how-to” sections of the book.</p><p>Although helpful, there is one point that James Clear very beautifully puts. that is often overlooked. According to me, this is the secret mind hack to sustain a habit. In this blog I want to elaborate on that one sentence that changed the game for me. Here it comes —</p><blockquote>The more pride you have in a particular aspect of your identity, the more motivated you will be to maintain the habits associated with it.</blockquote><p><strong>Are you proud that you are a developer?</strong></p><p>Somewhere in the rat race of deliveries, promotions, and comparing salaries, we lose sight of the <em>potential</em> of creating impact and meaning that developers have. How cool it is to be able to sit on a chair for a few hours and use your brains to create systems on which billion-dollar businesses operate.</p><p>You have got to <strong>feeeeeeeel</strong> it.</p><p>Look around. The world is growing both in terms of its physical infrastructure as well as digital infrastructure. There is a very high entry barrier to contribute to the physical infrastructure. Whereas you can start contributing to building digital infrastructure from day one. The startup cost is pretty small comparatively, you don’t have to ask for permission and there are several resources online to get you going.</p><p>Like Naval Ravikant says, a woodchopper who cuts wood for 4 hours gets the worth of 4 hours of work. That is not so with coders because it is more of a qualitative job than a quantitive one. That means you have the <strong>potential</strong> to make enough money for a lifetime by a few months of coding effort. Or you could build something that earns money for you while you are asleep. That is what Naval Ravikant means by <em>leverage.</em></p><p>For this to happen, as rightly said by Naval,</p><blockquote>Stay on the bleeding edge of trends and study technology, design, and art — become really good at something.</blockquote><h4>Follow your curiosity</h4><p>Ask yourself if you really understand what you are coding or are you <em>coding by accident</em>. In today’s world there is so much abstraction that coders can go through their life oblivious to the basic concepts. And there is a lot to learn, both in terms of depth and vastness of technology. Explore what you feel is worth exploring and see where it takes you.</p><h4>Fake it till you make it</h4><p>We all know that curiosity, passion, enthusiasm and patience are good things that we should have. But in my experience, it does not work if you <em>try to want </em>these qualities. When you say you <strong>want to be</strong> passionate about technology, the implicit assumption is that you are not passionate right now and you want to be passionate in the future. This way you will be like the rabbit running on the treadmill with carrot tied in front of him.</p><p>There is a simple solution here. Fake it.</p><p>Think about what kind of person you want ot be. Fake it till you make it.</p><h4>Invest Money</h4><p>If you have decided to spend decades of your life coding, you should not shy away from investing in the quality and comfort of your tools, workspace, and overall workflow. Be willing to spend money (guilt free) when it comes to upgrading your equipment; monitor, keyboard, laptop, and even the table and chair.</p><p>Also be generous about spending money on learning — premium subscription of medium, courses, books and certifications.</p><p>This does <em>three</em> things —</p><ol><li>Increases your pride in your identity as a developer</li><li>Associates cost to quit making it harder to quit and easier to persevere in difficult times.</li><li>You are buying time with money. Think about it this way, someone invested years of there life and condensed it to create content that you can consume within hours.</li></ol><h4>Surround Yourself with the right people</h4><blockquote>You are the average of the 5 people you surround yourself with.</blockquote><p>Yes, it’s a classic cliché but, it could be one of the best pieces of advice out there. Strive to build quality network, with people who are on the same path as you. Find good mentors. If you don’t control your surroundings consciously, chances are you will end up surrounding yourself with time suckers, life suckers and in general, suckers.</p><p>In general, avoid people who make you feel negative, demotivated and helpless. Sometimes you cannot avoid these people. Sometimes you need to keep your ego aside, accept people the way they are and focus on what you can learn. But how involved you want to get with people is your choice.</p><h4>Summary</h4><ol><li>Pride in your identity as a developer will help you sustain motivation to keep learning and developing.</li><li>In short, being a software engineer is extremely cool. You get to build cool stuff, don’t have to wait for any help or permissions, and dont have to spend much.</li><li>Stay on the bleeding edge of technology. Follow your curiosity.</li><li>Don’t be afraid to spend money on upgrading equipment and means of learning.</li><li>Network with high quality people on the same path as you.</li><li>Fake it till you make it.</li></ol><p>Follow if you like the content!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d7758fb707" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hidden in Plain Sight: Unleashing the Power of Postman Scripting]]></title>
            <link>https://medium.com/@abhijitpachpande/hidden-in-plain-sight-unleashing-the-power-of-postman-scripting-a2c05d949d72?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2c05d949d72</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Thu, 05 Sep 2024 14:07:27 GMT</pubDate>
            <atom:updated>2024-09-05T14:11:38.151Z</atom:updated>
            <content:encoded><![CDATA[<p>Postman is packed with powerful features, but some of its most useful tools are often overlooked. One such feature is scripting, which, surprisingly, took me two years to discover — despite being right next to the request body section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eq6lgYeFYuSl03Dq" /></figure><h4>My Use Case: Simplifying Token Management</h4><p>Like many developers, I rely on JWT (JSON Web Token) bearer tokens to secure my APIs. If you’re unfamiliar, here’s a quick rundown:</p><p>You typically have an authentication server — this can be part of your application, or an external service like Keycloak (which I use). You send a request with your username and password to the authentication server, and in return, you receive a JWT token.</p><blockquote>JWT tokens are encoded strings containing user details like name and roles used for the purpose of identity management (Authentication and Authorization).</blockquote><p>After receiving this token, the client adds this token in a Header Parameter called Authorization ( generally with the prefix ‘Bearer’ as shown in the figure below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BfMvdEu_olfaU7NbxxoXjg.png" /><figcaption>Img1. Auth Server Architecture</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oJrlRR8ABxTdmgkG7Lu4sw.jpeg" /></figure><p>Managing tokens while testing your application from your local device generally feels like a burden. Let’s explore a few ways to do it.</p><h4>Traditional (and Tedious) Token Management Methods</h4><ul><li><strong>Method 1:</strong> Copying the curl command from an authenticated browser session — a repetitive and dull task.</li><li><strong>Method 2:</strong> Manually hitting the authentication API, copying the token, and pasting it into the request headers.</li><li><strong>Method 3:</strong> Using Postman’s Authorization tab, where you can generate and store tokens. Though better, these tokens expire, requiring you to repeat the process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r63ooaBxe9Gg4ZvOMcRRgg.png" /></figure><p>Here you get an option to generate and save tokens as shown below —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LW98MIgnLd9wnpsfXSPDvg.jpeg" /><figcaption>Configuring new Token</figcaption></figure><h4>Drawbacks of these approach</h4><p>The big drawback of the approach mentioned above are that JWT tokens expire. Once the token is expired you have to do the same all over again.</p><h4>The Postman Scripting Approach</h4><p>Postman provides you with Pre-request and Post-response scripting options.</p><p>In Pre-request scripts, you can use javascript to configure this request dynamically.</p><p>In Post-response script, you can use javascript to write tests, visualise the response and much more.</p><p>I have leveraged both these types of scripting for authentication.</p><p>Before diving into the code, let’s understand <strong>Postman Environments</strong>.</p><blockquote>A Postman environment consists of variables that you can reuse across requests and share with your team. These variables can be used in authentication headers, query parameters, request bodies, or scripts, making your workflow more efficient.</blockquote><blockquote>You can see the Postman Environment typically in the top right corner of the postman window.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2KTYpcvO4qX7WztdAjCSg.jpeg" /></figure><h4>Automating Token Management with Pre-request Scripts</h4><p>So the way I implemented the Pre-request script is:</p><ol><li><strong>Hit the Auth Server</strong> API with Credentials</li><li><strong>Get the access_token</strong> from the response</li><li><strong>Store it in a Postman environment variable</strong> (example- token).</li><li>Use the variable in the <strong>Authorization header</strong> for your requests. (example - Bearer {{token}} )</li></ol><pre>pm.sendRequest({<br>    url: &#39;https://xxxx.xxxxxxx.com/realms/&lt;your-realm&gt;/protocol/openid-connect/token&#39;,<br>    method: &#39;POST&#39;,<br>    header: {<br>        &#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;<br>    },<br>    body: {<br>        mode: &#39;urlencoded&#39;,<br>        urlencoded: [<br>            { key: &#39;username&#39;, value: &#39;your-username&#39; },<br>            { key: &#39;password&#39;, value: &#39;your-password&#39; },<br>            { key: &#39;grant_type&#39;, value: &#39;password&#39; },<br>            { key: &#39;client_id&#39;, value: &#39;your-clientId&#39; },<br>            { key: &#39;client_secret&#39;, value: &#39;your-secret&#39; }<br>        ]<br>    }<br>}, function (err, res) {<br>    if (err) {<br>        console.error(err);<br>    } else {<br>        // Extract token from response<br>        var jsonData = res.json();<br>        var token = jsonData.access_token;<br><br>        // Set token in environment variable<br>        pm.environment.set(&#39;token&#39;, token);<br>    }<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8l04L0qEaqZxJQBEJN60A.jpeg" /><figcaption>using token from environment variable</figcaption></figure><p>Now everytime before we fire this request, the pre-request script runs, fetching a fresh token and inserting dynamically into my request.</p><h4>Post-response Scripts for OTP-based Authentication</h4><p>I have another use case involving OTP-based authentication. For that I have written a Post-response script on the OTP verification API, in which I take the response of this API and store it in a environment variable for further use.</p><pre><br>var response = pm.response.json();<br><br>if (response.token) {<br>    pm.environment.set(&quot;otpToken&quot;, response.token);<br>    console.log(&quot;otpToken set to:&quot;, response.token);<br>} else {<br>    console.error(&quot;Token not found in the response&quot;);<br>}</pre><h4>Conclusion: An Open Playground for Scripting</h4><p>Token management is just one of the many ways you can leverage Postman scripting. You can use these scripts for data visualization, automated testing, saving responses to local storage, and more.</p><p>If you’re interested in more backend insights and tips like this, be sure to follow my blog. I regularly share my experiences and discoveries — Let’s keep learning together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2c05d949d72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make mistakes of Ambition]]></title>
            <link>https://medium.com/@abhijitpachpande/make-mistakes-of-ambition-2253a70532b3?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2253a70532b3</guid>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Mon, 12 Aug 2024 10:56:40 GMT</pubDate>
            <atom:updated>2024-08-12T13:09:49.501Z</atom:updated>
            <content:encoded><![CDATA[<h2>Mistakes of Ambition</h2><p>“Make mistakes of Ambition and not mistakes of sloth. Develop the strength to do bold things, not the strength to suffer”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2253a70532b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inspiring Talk for Devlopers and Entrepreneurs by Dr.Pramod Varma — Chief Architect of Aadhaar]]></title>
            <link>https://medium.com/@abhijitpachpande/inspiring-talk-for-devlopers-and-entrepreneurs-by-dr-pramod-varma-chief-architect-of-aadhaar-b11eadb847ff?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b11eadb847ff</guid>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 18:27:17 GMT</pubDate>
            <atom:updated>2024-07-25T18:31:15.414Z</atom:updated>
            <content:encoded><![CDATA[<h3>Inspiring Talk for Developers and Entrepreneurs by Dr.Pramod Varma — Chief Architect of Aadhaar</h3><p>I had the priveldge to attend <a href="https://events.yourstory.com/devsparks">Devsparks 2024 in Bangalore</a> organized by <a href="https://yourstory.com/">Yourstory</a> this April. Amongst all the talks, the one that stood out and inspired me the most was the one given by Dr. Pramod Varma who is the chief architect of Indiastack and is instrumental in building DPI ( Digital Public Infrastricure like Aadhar, UPI, Digilocker etc) for India.</p><p>The thing that blew me away the most was Dr. Pramod Varma’s enthusiasm for technology which enables him to take massive challenges and still start fresh from first principles and core computer science principles ( as he himself says so in the talk attatched below ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*RLWDUH4G_fpj-cIzGLRZfQ.jpeg" /><figcaption>Dr. Pramod Varma</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVV8d2p01vaw&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVV8d2p01vaw&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FVV8d2p01vaw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/99b03c6493fad12b657c29c6e3d45d12/href">https://medium.com/media/99b03c6493fad12b657c29c6e3d45d12/href</a></iframe><p>Some highlights from the talk ( paraphrased ) -</p><ol><li>“I Love to design from nothing. I am a first principle thinker, core computer science principles”</li><li>Designing what works at scale is very different from scaling something that works</li><li>Learnt the art of coding “policy as code” while building Aadhar.</li><li>Had to create tech that is resellient to India’s craziness. What can go wrong absolutely does go wrong.</li><li>You have to ask all the bold questions that experienced people refuse to ask. Think from First Principles. Ask why Not?</li><li>UPI — Specification was only 1 and half page ( Basically keep it simple ) and problem statement was simply “you should be able to send money as easily as you send message”. If something seems complex, chances are that it is complex and you have over complicated things.</li><li>India is laying new generation infrastructure, new generation playgrounds. But there are no playground without players ( entrepreneurs)</li><li>DPI — <br>Public Infrastructure — UPI<br>Private Innovation — PhonePe, Paytm<br>The point is that it is very difficult for private companies to move to human scale unless public infrastructure reduces cost of innovation and operation.</li><li>Embrace AI , dont fear it. As programmers we are fundamentally problem solvers and should not care about the syntax too much.</li><li>Have sheer belief that if we put our minds to something we can solve. Secondly, I am perpetual optimist. I do not like pessimist people around me who complain and brood. Always say “we can , we can “. Wake up everyday wanting to live another day.</li></ol><p>Dr. Pramod Varma’s clarity of thought is something you can’t miss from this talk. Also he is able to articulate it and put it across in a simple and raw ( first principle ) way. You can see the clarity of purpose when he explains other projects like Bhashini, ONDC, Beckn etc. He explains the topic of open protocols very beautifully.</p><p>Going home after listening to this talk, I got inspired to try something new and challenging at work ( and I did ). Found this Video recently on youtube and thought this talk is worth sharing. If you ever do have the chance, try to catch a live talk xD</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b11eadb847ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Great article on Spring transaction]]></title>
            <link>https://medium.com/@abhijitpachpande/great-article-on-spring-transaction-af6bf644bb9d?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/af6bf644bb9d</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[transaction-management]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring-aop]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Fri, 19 Jul 2024 13:47:07 GMT</pubDate>
            <atom:updated>2024-07-19T13:47:07.777Z</atom:updated>
            <content:encoded><![CDATA[<p>Lately I came across this article which explains Spring transaction in great depth. The other articles on the site are also good ( can checkout spring auto-configuration as well).</p><p>Hope this helps someone find this<br><a href="https://www.marcobehler.com/guides/spring-transaction-management-transactional-in-depth">https://www.marcobehler.com/guides/spring-transaction-management-transactional-in-depth</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1F1sR-cof4Rw9LQg" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af6bf644bb9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Complex States in Quarkus: A Custom State Machine Approach]]></title>
            <link>https://medium.com/@abhijitpachpande/state-machine-in-quarkus-5c24e641f9cf?source=rss-f52f97cebdb2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c24e641f9cf</guid>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[quarkus-framework]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[state-machine]]></category>
            <category><![CDATA[quarkus]]></category>
            <dc:creator><![CDATA[Abhijit Pachpande]]></dc:creator>
            <pubDate>Wed, 17 Jul 2024 18:37:36 GMT</pubDate>
            <atom:updated>2024-08-31T11:27:25.022Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Repo</strong> — <a href="https://github.com/Abhi5Pande/Quarkus-state-machine">https://github.com/Abhi5Pande/Quarkus-state-machine</a></p><h4><strong>The </strong>Maintenance Nightmare</h4><p>When building complex systems, you often encounter scenarios where multiple entities have interdependent states. There are different conditions and pre/post processing you need to manage before performing any transitions.</p><p>Now imagine maintaining a codebase that has this complex state transition logic scattered across a very large codebase.</p><p>What a nightmare right!</p><p>Any new requirement in this system will break you from the inside and take away your sleep XD.</p><p>As time goes by, forgetting any pre/post-processing steps becomes increasingly easy. This processing can be anything:- checking for some external conditions, updating reports, sending mail to clients, auditing etc.</p><h4><strong>Here comes the solution — A State Machine</strong></h4><p>A state machine allows you to manage state transitions centrally, avoiding the chaos that comes with scattered state logic across your codebase. By doing so, you reduce the risk of illegal state transitions and create a more maintainable system.</p><p>Recently, I had a use case for state machine as my application had entities with very complex intertwined states.</p><p>I researched and found no existing implementation of state machine for quarkus. Considering my complex use case it made sense for me to write a state machine of my own.</p><h4>Re-invent the wheel</h4><p>I do suggest writing your own state machine even if the framework you are working on provides one ( or atleast enhance it ). I have been able to tweak the state machine to my exact use case and it has been very useful.</p><p>The point I am trying to make is that maybe you have some more complex preprocessing logic that I have not incorporated for or you want to make asynchronous calls using kafka instead of quarkus event bus.</p><p>Even then I would encourage taking a look at my implementation and hopefully find something useful that you can incorporate in your own projects.</p><p>You can check the code for this <a href="https://github.com/Abhi5Pande/Quarkus-state-machine"><strong>here</strong></a><strong>.</strong></p><h4><strong>Understanding the Structure</strong></h4><p>So the trick here is to define the rules at startup. The way I do it is by keeping a Map. The keys are the action ( to be performed on the entity ) mapped to a List of Transition object.</p><p>This is how the transition object looks like:-</p><figure><img alt="Transition object" src="https://cdn-images-1.medium.com/max/886/1*XHoiLCcYDZM2s46RqEf8HA.png" /><figcaption>1. Transition Object</figcaption></figure><p>Notice the fields.</p><p>We have the initialState which represents the initialState on which this action can be performed. Since we are mapping the action to a list of Transitions, the assumption is that the same action can be performed on multiple initial States.</p><p>The finalStates field is also a list, so the assumption is that one action on one initialState, based on some other factors can lead to multiple final States. For Example, depending on whether the payment mode is Cash on Delivery or Online the Order state can be PLACED or PAYMENT_PENDING .</p><p>The roles field represent the roles that are authorized to perform this action.</p><p>The handler field is interesting. So changing the state might not be the only thing you might want to do. There could be additional checks that influence the state change. In that case I have provisioned a way that people can define their own implementation ( Check the Delegate processing to state handler in the flowchart Diagram 4).</p><p>Similarly you may define Pre-processors/ Post-processors as per your use case and more.</p><p><strong>How to define the </strong><strong>Transitions</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNV8hFeGYWk9MRlTdw8Y2g.png" /><figcaption>2. UML</figcaption></figure><p>Step 1 — Create a class and extend the StateMachine <em>abstract</em> class<br>Step 2 — Override the addRulesOnStartup() method<br>Step3 — Make use of addRule() and addPostProcessor() functions inside this addRulesOnStartup method.</p><p>Example —</p><pre>@ApplicationScoped<br>public class MyObjectStateMachine extends StateMachine&lt;MyObject&gt; {<br>    <br>    @Override<br>    protected void addRulesOnStartup() {<br>    addRule(/*checkout image below */);<br>    addPostProcessor(/*checkout image below */);<br>    }<br><br>    @Override<br>    protected Class&lt;MyObject&gt; entityClass(){<br>        return MyObject.class;<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-XwjQ_mQSou82cGdp6D0g.png" /><figcaption>3. Example of defining state transition rules</figcaption></figure><h4>Keeping the Front End Informed About the Legal Actions</h4><p>Additionally we are keeping one more map with initial states of the entity as Keys and List of Actions available on that initial State. So whenever the front-end lands on the list view page ( or whatever page you want to perform the action on ) we are giving an API that simply responds with this map.</p><p>The front-end can now provide appropriate buttons/dropdowns based on the current state of the entity.</p><p>Example —</p><pre>{<br>    /*<br>      Key - Initial State - CREATED<br>      Value - List of Actions available on that initial state - PREPARING,CANCEL<br>    */<br>    &quot;CREATED&quot;: [<br>        &quot;PREPARING&quot;,<br>        &quot;CANCEL&quot;<br>    ],<br>    &quot;PROCESSING&quot;: [<br>        &quot;PREPARED&quot;<br>    ],<br>    .<br>    .  <br>    .<br>    // you get the point ;)<br>}</pre><h4>The Endgame</h4><p>We are now finally in the end game. Here is the part where the state transitions are performed.</p><p>There is the method -performAction(ENTITY , action ) in the <em>abstract class </em>StateMachine. Observe you need to pass the entity and the action to be performed on that entity.</p><p>Now the flowchart below should give a good enough understanding of how this function is working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*B0tx9LSpZRfsUs3mI2xTLw.png" /><figcaption>4. Flowchart of how the State Machine is designed to perform action</figcaption></figure><p>I will just quickly take a moment to explain how post processing is implemented here.</p><p>We are using <a href="https://quarkus.io/guides/reactive-event-bus">quarkus event bus</a> for handling asynchronous events. Much like Topics in kafka, we need to provide a String to this event bus where this message is produced and to which this event will be consumed.</p><p>We are making this String on the fly by appending the entity class name and the final State it has arrived.</p><p>Example — Consider you have a Exam entity. When the status of Exam is completed lets say you want to send a message to the candidates with their scores. The event EXAM_COMPLETED would be sent by the stateMachine that you can consume and make appropriate Actions ( could be simple logging as well ).</p><pre>    @ConsumeEvent(value = &quot;EXAM_COMPLETED&quot;)<br>    public Uni&lt;?&gt; orderCompleted(Exam exam) {<br>        Log.info(&quot;Exam completed postprocessing&quot;);<br>        // Send mail, update reports whatever you like XD<br>        return Uni.createFrom().voidItem();<br>    }</pre><h4>Conclusion</h4><p>Building a state machine tailored to your specific use case can significantly streamline the management of complex, intertwined states within your system. It not only centralizes state transitions but also enhances maintainability by reducing the risk of missing critical pre/post-processing steps.</p><p>If you find yourself dealing with similar challenges, I encourage you to explore my implementation. Whether you’re looking to handle complex preprocessing logic, integrate asynchronous calls via Kafka or Quarkus event bus, or just want a flexible and customizable solution, this state machine design could be a solid foundation.</p><p>I’m also in the process of publishing a Maven library for this state machine, making it even easier for you to integrate it into your projects. If you have any questions or need help solving your specific use case using this design, don’t hesitate to get in touch. I’d love to collaborate and help you build a robust state management solution for your applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c24e641f9cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>