<?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 Vutukuri Sathvik on Medium]]></title>
        <description><![CDATA[Stories by Vutukuri Sathvik on Medium]]></description>
        <link>https://medium.com/@7vik.sathvik?source=rss-61a14c7c8c39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s95fMIUQ7Lvgk27eA8RCRg.jpeg</url>
            <title>Stories by Vutukuri Sathvik on Medium</title>
            <link>https://medium.com/@7vik.sathvik?source=rss-61a14c7c8c39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:17:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@7vik.sathvik/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[Senior Software Developers code Etiquette.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@7vik.sathvik/senior-software-developers-code-etiquette-9665de73aeca?source=rss-61a14c7c8c39------2"><img src="https://cdn-images-1.medium.com/max/2000/1*uwVDQeLTzfgCAycH0l6EJQ.jpeg" width="2000"></a></p><p class="medium-feed-snippet">In this post, I share the essential habits I&#x2019;ve developed while working on all software projects over my career. If you want to write code&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@7vik.sathvik/senior-software-developers-code-etiquette-9665de73aeca?source=rss-61a14c7c8c39------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@7vik.sathvik/senior-software-developers-code-etiquette-9665de73aeca?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/9665de73aeca</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Thu, 05 Oct 2023 16:37:28 GMT</pubDate>
            <atom:updated>2023-10-05T16:39:07.756Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Top 5 Data structure's asked in MAANG.]]></title>
            <link>https://medium.com/@7vik.sathvik/top-5-data-structures-asked-in-maang-f683f0deb520?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/f683f0deb520</guid>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[faang]]></category>
            <category><![CDATA[trees]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Sat, 01 Jul 2023 04:47:47 GMT</pubDate>
            <atom:updated>2023-07-01T04:47:47.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*W4RUB8r1FSvXsbjmyXY_nw.png" /><figcaption>MAANG companies. Source: Google</figcaption></figure><p>Let’s discuss about top data structures related questions asked in MAANG — Meta, Apple, Amazon, Netflix and Google.</p><p>As a naive beginner, we learn Data Structures like Arrays, Linked lists , Trees.</p><h3>5. we have Heap.</h3><p>Heap is a tree based data structure that is used to store a partially sorted set of elements. What does that even mean?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*fvgzmsxvAzMQaXjs58izdg.png" /><figcaption>Source : GeeksforGeeks</figcaption></figure><p>Let’s examine this tree-like structure closely.</p><p>If you pick any element or node in the tree, it’s going to be greater than or equal to both its children. This kind of heap is called a Max heap. What this means is that the root or the topmost node of the tree is always the maximum of all the elements.</p><p>We also have a Min heap where every element is smaller than or equal to both the children and the root node is the minimum of all the elements. Now the heap I showed you might look like a tree but it’s actually implemented using an array. So, the heap in the example can be written as this array which is partially sorted.</p><p>For an element at index n, its children can be found at the index 2n + 1 and 2n + 2. Any array can be converted into a heap by using an algorithm called Heapify. I will not go into the details of Heapify but I just want to make sure you know all the important concepts for top 5 data structures.</p><h4>So, when do we use a heap?</h4><p>The most important property of a heap is that it makes getting the maximum or minimum of all the elements very easy. So, whenever you need quick access to max or min, think about Heap.</p><p>For example, we can use a heap to implement Priority Queues.</p><p>A Priority Queue is a data structure where each element has a priority or score associated with it. And when we remove an element from this data structure, we get the element with highest priority or score first.</p><p>A Heap is the perfect candidate to achieve this.</p><p>Other famous algorithms where Heaps show up are HeapSort, Dijkstra’s algorithm and Median maintenance for a stream.</p><h3>4: we have a Binary Tree.</h3><p>Each element or Node of the tree stores a value and links to its left and the right child.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*lwaDg8aL0XtdEndSDBtyvQ.png" /><figcaption>Source : GeeksForGeeks.</figcaption></figure><p>The topmost node of the tree is called root node and the bottommost nodes are called leaf nodes.</p><p>Binary trees are used in database indexing, sorting algorithms and decision trees etc. <strong>Full Binary Tree, Complete Binary Tree, Perfect binar Tree, Balancing BST, Binary Serach Tree, Degenerate Tree, Skewed trees, Segmented trees </strong>are different kinds of binary trees. You can check this <a href="https://www.geeksforgeeks.org/types-of-binary-tree/"><strong>page</strong></a> for more details.</p><p>All of that theory is fine.</p><p>But when should you really be thinking about binary trees in a coding interview?</p><p>Well, it’s very simple.</p><p>The interviewer will ask you to think about a binary tree herself.</p><p>Binary tree questions are usually like “Given a binary tree, do this”. So, you rarely have to think about whether you need a binary tree to solve a particular problem. But, there are two very important things that you need to know about Binary trees.</p><p><strong>Number 1, Binary trees are a perfect candidate to use recursion.</strong></p><p>For those who do not know, in a recursive algorithm, a function calls itself with a smaller input value and uses the result to return its output.</p><p>Most binary tree problems can be solved using recursion.</p><p><strong>Number 2, You also need to know different ways to traverse a binary tree.</strong> Traversal is nothing but the process of visiting all the nodes of a tree. A few popular types of traversals that you should read about are: Depth First Search algo like <strong>Pre-order, Post-order,In-order and Level order traversals(Breadth First Search).</strong></p><p>A few popular binary tree problems are Lowest common ancestor, left view of the tree and maximum path sum.</p><h3>3: we have a HashTable or HashMap.</h3><p>HashMap is a data structure that provides fast access to data based on a key. When you provide a key-value pair to a hashmap, <strong>a hash function is used to map the key to a unique index in an array and the value is stored at that index.</strong></p><p>For now, you can think of a hash function(like MD5, SHA256 or simple modulo operation on number) as a black box that takes a key as an input and gives an index as the output.</p><p>If this index already contains a value, multiple values can be stored using a list at this index.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6Fmxd0p7b3pEzV1G1rZPg.png" /><figcaption>Source : GeeksForGeeks</figcaption></figure><p>Enough about the theory, when should you think about a HashMap in an interview?</p><p>While solving the problem, if you feel the need to get a particular information quickly without doing much work, you should think about using a HashMap to store this information.</p><p>For example, going through an array, you want to find the index of another number in the array that can be added to the current number to make the total sum equal to 100.</p><p>All you want is the index of 100 — the current number in the array quickly without doing a lot of work.</p><p>If you have a hashmap that contains all the numbers as key, their index as value, you can quickly look up the index of 100 — current number. But here is one thing that you should be very careful about when using Hashmaps.</p><p>Quick lookups in Hashmaps come at the cost of using extra space and this might mean that your solution is suboptimal. So, after you have found a solution that uses a hashmap, you should always be thinking if there are better solutions that don’t use the extra space used by a Hashmap.</p><p>It’s not always possible to achieve that but you should always try.</p><h3>4: we have a Stack.</h3><p>I will also include Queues here because they are very similar to Stacks.</p><p>Stack is a data structure that supports 2 main operations: Adding an element which is also called pushing and removing an element which is also called popping. Image pile of plates in your kitchen.</p><p>In a Stack, when you remove or pop an element, you get the last element that is added to the stack. <strong>Last in First Out(LIFO).</strong></p><p><strong>Moving on to the Queue, adding an element on Queue is also called Enqueuing and removing is called Dequeuing.</strong></p><p>When you remove or deque an element from a queue, you get the first element that was added to the queue. <strong>First in First Out(FIFO).</strong></p><p>Under the hood, both Stack and Queues are implemented using Arrays or Linked Lists. I highly recommend reading about Linked Lists on your own.</p><p>Moving on, a more important question that we still have not answered is <strong>“When to think about a Stack or Queue in a coding interview”?</strong></p><p>To be honest with you, Stacks or Queues are the hardest data structures to think about as it’s not obvious when to use them.</p><p>Anyway, I will try to share a few tips using the patterns I have seen.</p><p>Wherever you have some previously seen values and you know you will need the last seen value first, use a Stack.</p><p>For example, in this problem (2x+3y)where you need to calculate a math expression, you will be going into these nested brackets.</p><p>And you need to keep track of what the sum was in the parent bracket before you entered the current bracket.</p><p>Another very interesting question that uses a Stack is Largest Rectangle Histogram. I highly recommend you read about both these problems.</p><p>Moving on to the top Data Structure on the list. Most important one.</p><h3>1: we have Graphs.</h3><p>Many difficult problems asked in coding interviews use graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*A3YEp4fgl6w0zloQOOF-jw.jpeg" /><figcaption>Source : GeeksForGeeks.</figcaption></figure><p>A graph is a data structure that contains a set of vertices and edges that connect these vertices. When the edges of a graph have a direction, it’s called a directed graph. Otherwise, it’s called an undirected graph.</p><p>Wherever you spot relationships between different entities in a coding problem, you should be thinking about graphs.</p><p>For example, if you are given bus routes that go through different bus stops.</p><p>And you need to find a route from stop number 15 to stop number 12 with the minimum number of bus changes.</p><p>You should be thinking about Graphs because there is a clear relationship between entities Bus, Bus Stop and Route.</p><p>Now that you know when to think about the graphs, I want to tell you a few important graphs related concepts that you should read about.</p><p><strong>First is Graph search. Some famous graph search algorithms that you should read about are Depth First Search, Breadth First Search and Dijkstra’s algorithm. </strong>The last 2 algorithms that I mentioned are used to find the shortest path between 2 nodes on the graph.</p><p>I also recommend reading about topological sort and how to find a loop in a graph. There are many other data strcutures used but these are very important when you are preparing for an interview in any MAANg or any tech compoany.</p><p>—</p><p><em>PS: Hi there! My name is Vutukuri Sathvik, and I am a software engineer with a deep passion for software engineering craftsmanship. If you like this article, please follow me for more articles on Medium Or if you are in the Twitter space, feel free to follow sathvikvutukuri at </em><a href="https://twitter.com/sathvikvutukuri">https://twitter.com/sathvikvutukuri</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f683f0deb520" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 incredible ways ChatGPT can 10x your productivity in 2023.]]></title>
            <link>https://medium.com/@7vik.sathvik/5-incredible-ways-chatgpt-can-10x-your-productivity-in-2023-536b8ee55936?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/536b8ee55936</guid>
            <category><![CDATA[chatgpt4]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[bard-ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Tue, 27 Jun 2023 02:22:31 GMT</pubDate>
            <atom:updated>2023-10-06T03:05:13.095Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><a href="https://chat.openai.com/chat">ChatGPT</a> is truly groundbreaking AI technology. But 99% of people don’t know how to harness its full potential. Here’s 5 incredible ways ChatGPT can 10x your productivity in 2023:</blockquote><h4>1. Simplify complex topics</h4><p>If you’re ever confused about a complicated topic… Log into ChatGPT and type: “Explain [complex topic] like I’m 10years old.” It’ll output a dead-simple, easy-to-follow response. It’s incredible for learning. One of my personal favourites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sIVn7S8Cb7XORkxbi8vWYw.png" /><figcaption>ChatGPT simplifies complex topics</figcaption></figure><h4>2. Summarise articles</h4><p>Articles on the web can be a pain in the ass to read. There’s far too many: • Annoying paywalls • Unnecessary paragraphs • Distracting advertisements Luckily, ChatGPT can save you time &amp; the hassle. It’ll summarise main points from any URL you feed it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WfPox_6YCKlAT16YpaUcIQ.jpeg" /></figure><h4>3. Creating Drafts</h4><p>A first draft of text on a specific topic can get help you to get into the process of writing. ChatGPT is able to delivers high quality drafts with ease. Here is how you can generate a draft for an article:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Jui-YuImNhc3ntYNuUytA.png" /><figcaption>Source : ChatGPT</figcaption></figure><h3>4. Writing</h3><p>ChatGPT is a great writing assistent! On your existing text ChatGPT is able to perform various tasks like:</p><ul><li>Proofread spelling &amp; grammar</li><li>Recommend changes</li><li>Change text to a specific style</li></ul><p>Let’s see an example of what ChatGPT can do for you as a writer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Fb_kTQUVbTQkfaILMK8Lg.png" /></figure><h4>5.Search</h4><p>ChatGPT is able to be an alternative to classic search engines like Google. ChatGPT is free to use, comes with no ads and provides search results directly. In contrast to search engines you do not need to first click on a link to website and then extract the answer from the content given on site.</p><p>However: You need to keep in mind that ChatGPT was trained on information up until 2021. So ChatGPT is not able to provide you with answers to search results for recent topics.</p><p>Also, ChatGPT can be used for millions of other use cases, including code generation, code correction, tutorials, dating chat, and more.</p><p>—</p><p><em>PS: Hi there! My name is Vutukuri Sathvik, and I am a software engineer with a deep passion for software engineering craftsmanship. If you like this article, please follow me for more articles on Medium Or if you are in the Twitter space, feel free to follow sathvikvutukuri at </em><a href="https://twitter.com/sathvikvutukuri">https://twitter.com/sathvikvutukuri</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=536b8ee55936" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CAP theorem in System Design.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@7vik.sathvik/cap-theorem-in-system-design-3822fe9f0636?source=rss-61a14c7c8c39------2"><img src="https://cdn-images-1.medium.com/max/850/1*85GfneMfKiBphYnr_VWPBg.png" width="850"></a></p><p class="medium-feed-snippet">Sorce : Medium</p><p class="medium-feed-link"><a href="https://medium.com/@7vik.sathvik/cap-theorem-in-system-design-3822fe9f0636?source=rss-61a14c7c8c39------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@7vik.sathvik/cap-theorem-in-system-design-3822fe9f0636?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/3822fe9f0636</guid>
            <category><![CDATA[availability]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[consistency]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[cap]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Tue, 27 Jun 2023 02:06:39 GMT</pubDate>
            <atom:updated>2023-10-06T03:05:27.049Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Serverless is the biggest(May be) lie in the history of computers.]]></title>
            <link>https://medium.com/@7vik.sathvik/serverless-is-the-biggest-may-be-lie-in-the-history-of-computers-38ec098e78e5?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/38ec098e78e5</guid>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[serverless-architecture]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[monolith]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Mon, 26 Jun 2023 14:53:26 GMT</pubDate>
            <atom:updated>2023-06-26T14:53:26.780Z</atom:updated>
            <content:encoded><![CDATA[<p>Serverless is the biggest lie in the history of computers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXsTyW81oRieRaGyd87t0Q.png" /><figcaption>Server says Server Less. Pic credit: Some random gooogle page.</figcaption></figure><p>Why Amazon, Google, Microsoft is lying. And other companies too ,cant blame only OG’s of FAANG.</p><p>When you go serverless you’re still using a server it’s just not yours you’ll compute nothing and be happy.</p><p>Amazon Prime video just dropped a shocking <a href="https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90">article</a> explaining how they saved 90% on their Amazon web services bill by switching from serverless microservices to an Old-Fashioned monolith architecture. That’s great news for Amazon because it’ll save a ton of money but bad news for Amazon because it just lost a great Revenue Source</p><p>The article is sending shockwaves through Tech right now because one of the main claims of the serverless vision is that you can scale infrastructure more efficiently which in theory should cost less money.</p><p>I really appreciate(We should) Amazon’s transparency here because they’re one of the original pioneers of serverless with Lambda functions, many cloud based functionalities support and nowadays you have tons of platforms offering serverless services like Purcell and netlify which are actually just using and reselling AWS Services behind the scenes there’s almost an entire industry of startups that make AWS easier to use including open source projects like the serverless framework and SST. But not everyone is advocating the same. Creators of Ruby on Rails and Basecamp(Renting servers is a bad idea. Its like renting flat vs purchasing plot debate.) has been advocating for Majestic monoliths for the last decade and took his entire company off the cloud after they spent over three million dollars in one year now they just run their own servers a lot of successful startups like Dropbox end up leaving the cloud once they get big enough however I personally use serverless(Azure, some times GCP) for my projects and it’s an absolute gamechanger for getting things done quickly.</p><p>Although I have accidentally created a few infinitely scaling infinite Loops that could have potentially cost me an infinite amount of money but what’s the difference between a microservice and model with architecture at Prime video</p><h4><strong>Issue with Amazon Microservices</strong></h4><p>They needed a tool to analyze audio content or issues like video freeze and corruption to implement this tool they use multiple serverless functions called step functions which are basically the same thing as Lambda to handle different responsibilities you have an initial entry point which kicks off another service to do a file conversion that converts an audio video stream into frames that can be used by the detector you’ve got multiple detectors using machine learning to analyze the video then finally you have another function to aggregate the result and store them in a bucket but there’s a little bit of overhead every time you pass data from one service to another they need to serialize and deserialize data and communicate over a network in this case their service needed to run multiple times for every second of a video stream and they quickly hit a bottleneck with their account limits just trying to orchestrate the service in addition by temporarily uploading files to AmazonS3 they were burning through money just accessing these files in the buckets</p><p>They realized that the distributed architecture was the root cause of these bottlenecks causing them to make a bold decision to re-architect to a monolith instead of running decoupled distributed Services they took everything and made it run on a single container all the components are the same but now that they run on a single server they can only scale vertically that means to do more work they’ll need to make each server bigger unlike the microservice architecture which could scale horizontally by creating more service for each individual component based on its scaling needs that seems like.</p><p>It would be a drawback but it eliminated all kinds of unnecessary communication and network usage that reduced their cost by 90%(freaking numbers) and for a product of this magnitude that means millions of dollars(Still peanuts for employees) saved so I guess the takeaway is that if you’re using microservices you should probably Cobble them together into a monolith right now well not so fast in this case the optimization was pretty.</p><p>Obvious famously back in 2008 Netflix was based on a monolith architecture and had a massive failure that motivated them to break their architecture into hundreds of different microservices that can scale independently with fault tolerance(Made netflix to release lots of open source libraries).It might be more complex and expensive but if Netflix goes down for a few hours it’ll cost them way more money and lost memberships .</p><p>I can easily deploy my shitty Java+Quarkus code without ever having to think about infrastructure I rarely even bust out of the free tier and when I do it’s money well spent because I have peace of mind knowing that I’m not going to deploy some bad code to my monolith that takes down my entire operation ultimately when it comes to Cloud architecture there are no solutions only trade-offs.</p><p>So Serverless / Monolith , both are great and safe options depends on your use case , cost , maintenance. Some times how fast can you ship the features.</p><p>I am always a big fan of Monolith but uses serverless cloud in lots of scenarios.</p><p>See you in next article.</p><p>Follow and clap . This is a free operation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38ec098e78e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Switch statement evolution from Java7 to Java 17.]]></title>
            <link>https://medium.com/@7vik.sathvik/java-switch-statement-evolution-from-java7-to-java-17-acb9663a472c?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/acb9663a472c</guid>
            <category><![CDATA[switch]]></category>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[java17]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 02:58:06 GMT</pubDate>
            <atom:updated>2023-06-25T02:58:06.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KV6j1j8GlgtwfdPNCWwS-Q.jpeg" /><figcaption>Java Switch statement. Source: Google.</figcaption></figure><p>Hi Techies,</p><p>Switch statement in java has gone through a rapid evolution since Java 7 . So in this article we will discuss evolution or changes of switch statement from java 7 to java 17 with example .</p><p>Let’s begin with initial java 7</p><h3>Java 7 : Switch Statement</h3><p>Until Java 7 only integers could be used in switch case and this had been the standard for a long time:</p><pre>int value = 5;<br>switch (value) {<br>    case 1:<br>        System.out.println(&quot;One&quot;);<br>        break;<br>    case 5:<br>        System.out.println(&quot;five&quot;);<br>        break;<br>    default:<br>        System.out.println(&quot;Unknown&quot;);<br>}</pre><h3>Java 8 : Switch Statement</h3><p>In Java 8 strings &amp; enum were introduced in case values and switch statements started to evolve</p><p><em>String Switch Case :</em></p><pre>String day = &quot;Tuesday&quot;;<br>        switch (day) {<br>            case &quot;Monday&quot;:<br>                System.out.println(&quot;Week day&quot;);<br>                break;<br>            case &quot;Tuesday&quot;:<br>                System.out.println(&quot;Week day&quot;);<br>                break;<br>            case &quot;Wednesday&quot;:<br>                System.out.println(&quot;Week day&quot;);<br>                break;<br>            case &quot;Thursday&quot;:<br>                System.out.println(&quot;Week day&quot;);<br>                break;<br>            case &quot;Friday&quot;:<br>                System.out.println(&quot;Week day&quot;);<br>                break;<br>            case &quot;Saturday&quot;:<br>                System.out.println(&quot;Weekend&quot;);<br>                break;<br>            case &quot;Sunday&quot;:<br>                System.out.println(&quot;Weekend&quot;);<br>                break;<br>            default:<br>                System.out.println(&quot;Unknown&quot;);<br>        }</pre><p><em>Enum Switch Case</em></p><pre>enum DAYS {<br>    MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY<br>}DAYS days = DAYS.SUNDAY;<br>switch (days) {<br>    case MONDAY:<br>        System.out.println(&quot;Weekdays&quot;);<br>        break;<br>    case TUESDAY:<br>        System.out.println(&quot;Weekdays&quot;);<br>        break;<br>    case WEDNESDAY:<br>        System.out.println(&quot;Weekdays&quot;);<br>        break;<br>    case THURSDAY:<br>        System.out.println(&quot;Weekdays&quot;);<br>        break;<br>    case FRIDAY:<br>        System.out.println(&quot;Weekdays&quot;);<br>        break;<br>    case SATURDAY:<br>        System.out.println(&quot;Weekends&quot;);<br>        break;<br>    case SUNDAY:<br>        System.out.println(&quot;Weekends&quot;);<br>        break;<br>    default:<br>        System.out.println(&quot;Unknown&quot;);<br>}</pre><h3>Java 12 : Switch Statement</h3><p>Java 12 further enhanced the switch statement and introduced switch expressions as a <em>preview </em>feature.</p><p>It introduced a flurry of new features:</p><ul><li>You can return values from a switch block and hence switch statements became <strong><em>switch expressions</em></strong></li><li>You can have multiple values in a case label</li><li>You can return value from a switch expression through the arrow operator or through the “break” keyword</li></ul><p><strong>Return value through break keyword</strong></p><pre>return  switch (day) {<br>    case &quot;Monday&quot;:<br>        break &quot;Weekday&quot;;<br>    case &quot;Tuesday&quot;:<br>        break &quot;Weekday&quot;;<br>    case &quot;Wednesday&quot;:<br>        break &quot;Weekday&quot;;<br>    case &quot;Thursday&quot;:<br>        break &quot;Weekday&quot;;<br>    case &quot;Friday&quot;:<br>        break &quot;Weekday&quot;;<br>    case &quot;Saturday&quot;:<br>        break &quot;Weekend&quot;;<br>    case &quot;Sunday&quot;:<br>        break &quot;Weekend&quot;;<br>    default:<br>        break &quot;Unknown&quot;;<br>};</pre><p>The word “break” can be used to return the result value.</p><blockquote><em>This word was replaced by “yield” later in Java 13.</em></blockquote><pre>return  switch (day) {<br>    case &quot;Monday&quot;:<br>        yield  &quot;Weekday&quot;;<br>    case &quot;Tuesday&quot;:<br>        yield &quot;Weekday&quot;;<br>    case &quot;Wednesday&quot;:<br>        yield &quot;Weekday&quot;;<br>    case &quot;Thursday&quot;:<br>        yield &quot;Weekday&quot;;<br>    case &quot;Friday&quot;:<br>        yield &quot;Weekday&quot;;<br>    case &quot;Saturday&quot;:<br>        yield &quot;Weekend&quot;;<br>    case &quot;Sunday&quot;:<br>        yield &quot;Weekend&quot;;<br>    default:<br>        yield &quot;Unknown&quot;;<br>};</pre><p><strong>Return value through arrow operator :</strong></p><p>Further instead of returning values using break keyword , Java 12 introduced arrow operators as a simple alternative:</p><pre>return  switch (day) {<br>            case &quot;Monday&quot;-&gt; &quot;Week day&quot;;<br>            case &quot;Tuesday&quot;-&gt; &quot;Week day&quot;;<br>            case &quot;Wednesday&quot;-&gt;&quot;Week day&quot;;<br>            case &quot;Thursday&quot;-&gt;&quot;Week day&quot;;<br>            case &quot;Friday&quot;-&gt;&quot;Week day&quot;;<br>            case &quot;Saturday&quot;-&gt; &quot;Weekend&quot;;<br>            case &quot;Sunday&quot;-&gt; &quot;Weekend&quot;;<br>            default-&gt;&quot;Unknown&quot;;<br>        };</pre><p><strong>Multiple case labels :</strong></p><p>Also starting Java 12 multiple case values could be provided in a single case statement , So if you observe above example since all 5 case expected here same value so instead of return one by one i can merge or combine multiple case value to single one like below</p><pre>return  switch (day) {<br>            case &quot;Monday&quot;,&quot;Tuesday&quot;,&quot;Wednesday&quot;,&quot;Thursday&quot;,&quot;Friday&quot;<br>-&gt; &quot;Week day&quot;;<br>            case &quot;Saturday&quot;, &quot;Sunday&quot; -&gt; &quot;Weekend&quot;;<br>            default-&gt;&quot;Unknown&quot;;<br>        };</pre><h3>Java 14 : Switch Statement changes</h3><p>What ever switch statement &amp; features we discussed so far in java 12 and 13 those are preview features to access that The flag –enable-preview need to set true .<br>But Java 14 just made all the features permanent from being a preview feature<br>The flag –enable-preview need not be set starting java 14. &amp; switch statements have evolved into switch expressions!</p><h3>Java 17 : Switch Statement / Expression :</h3><p>Java 17 LTS is the latest long-term support release for the Java SE platform and it was released<strong> on </strong><strong>September 15, 2021.</strong></p><p>Switch expression features</p><ol><li>Pattern matching</li><li>Gaurded pattern</li><li>Null cases</li></ol><h3>Pattern Matching :</h3><p>It has introduced a new feature for switch i.e called <strong><em>pattern matching.</em></strong></p><p>You can match patterns in a case label.</p><p>In other words you can pass objects in switch condition and this object can be checked for different types in switch case labels.</p><pre>return switch (obj) {<br>    case Integer i -&gt; &quot;It is an integer&quot;;<br>    case String s -&gt; &quot;It is a string&quot;;<br>    case Employee s -&gt; &quot;It is a Employee&quot;;<br>     default -&gt; &quot;It is none of the known data types&quot;;<br>};</pre><p>In the above example I am passing an object to the switch condition. This was not possible until Java 17. And then this object can be checked for a particular data type and assigned to a variable as well.</p><p>For example consider the case :</p><p>case Integer i- &gt; &quot;It is an integer&quot;;</p><p>The passed object is checked for the type “Integer” and then assigned to the variable “i” if it is an integer. And through the arrow operator the string “It is an integer ” is returned .</p><h3>Gaurded Patterns :</h3><p>Let’s take this use case.</p><p>Inside the case label where I have checked for a “Employee” instance , I want to do an additional check.</p><p>Thinking traditionally , you could be doing this after the case statement.</p><p>Something like this:</p><p>case Employee emp:</p><p>if(emp.getDept().equals(&quot;IT&quot;)) {</p><p>yield &quot;This is IT Employee&quot;;</p><p>}</p><p>But Java 17 has introduced “Guarded Patterns” . You can do this check in the case label itself like below</p><pre>return switch (obj) {<br>    case Integer i -&gt; &quot;It is an integer&quot;;<br>    case String s -&gt; &quot;It is a string&quot;;<br>    case Employee employee &amp;&amp; employee.getDept().equals(&quot;IT&quot;) -&gt; &quot;IT Employee&quot;;<br>    default -&gt; &quot;It is none of the known data types&quot;;<br>};</pre><h3>Null Cases :</h3><p>You could never pass a null value to switch statements prior to Java 17 without a Null pointer exception being thrown.</p><p>Java 17 allows you to handle it this way</p><p>case null -&gt; &quot;It is a null object&quot;;</p><p>If you have the above switch expression you will never get Null Pointer exception if the object you pass is null.</p><p>That’s all about the journey from java 7 to java 17 switch case journey . Hope you like this article . if yes do follow me on medium now :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acb9663a472c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring WebFlux over @Async Annotation]]></title>
            <link>https://medium.com/@7vik.sathvik/spring-webflux-over-async-annotation-ffe26a12d631?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffe26a12d631</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[threads]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 08:44:31 GMT</pubDate>
            <atom:updated>2023-03-06T08:44:31.534Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re building a web application in Java, you have several options for handling asynchronous processing.</p><p>One approach is to use the @Async annotation in Spring to delegate long-running tasks to separate threads. Another approach is to use Spring WebFlux, which provides a non-blocking, event-driven programming model for building reactive web applications.</p><p>In this article, we’ll explore the benefits of using Spring WebFlux instead of the @Async annotation.</p><p>A typical application performs a variety of I/O events, such as reading and writing data to databases, external APIs and files.<br>Caching data, interacting with message queues, and streaming data are also common I/O events.</p><p>I have selected an external service call (GET <a href="https://ipinfo.io/161.185.160.93/geo)">https://ipinfo.io/161.185.160.93/geo)</a> as a demonstration and will record the performance metrics by making an external API call using both @Async and Web-flux.</p><p>You can find code for File I/O included in the project.</p><p>- <strong><em>Webflux Controller</em></strong></p><pre>@RestController<br>public class ExternalAPIController {</pre><pre>    private final WebClient webClient;</pre><pre>    public ExternalAPIController(WebClient.Builder webClientBuilder) {<br>        this.webClient = webClientBuilder.baseUrl(&quot;https://ipinfo.io&quot;).build();<br>    }</pre><pre>    @GetMapping(value = &quot;/data&quot;, produces = MediaType.APPLICATION_JSON_VALUE)<br>    public Mono&lt;String&gt; getData() {<br>        System.out.println(&quot;Hit **&quot;);<br>        return webClient.get()<br>                .uri(&quot;/161.185.160.93/geo&quot;)<br>                .retrieve()<br>                .bodyToMono(String.class);<br>    }<br>}</pre><p><strong><em>-Async Annotation Controller</em></strong></p><pre>public class ExternalCall {</pre><pre>    private final RestTemplate restTemplate;</pre><pre>    public ExternalCall(RestTemplate restTemplate) {<br></pre><pre>        this.restTemplate = restTemplate;<br>    }</pre><pre>    @GetMapping(value = &quot;/data&quot;, produces = MediaType.APPLICATION_JSON_VALUE)<br>    public CompletableFuture&lt;String&gt; getData() {<br>        return getDataAsync();<br>    }</pre><pre>    @Async<br>    public CompletableFuture&lt;String&gt; getDataAsync() {<br>        String result = restTemplate.getForObject(&quot;https://ipinfo.io/161.185.160.93/geo&quot;, String.class);<br>        return CompletableFuture.completedFuture(result);<br>    }<br>}</pre><p>To measure the performance of the two services, you can use a load testing tool such as Apache JMeter or Gatling to simulate a large number of requests and measure the response time and throughput of each method under various conditions.</p><p>You can also use tools like Micrometer to collect metrics on the performance of the application.</p><p>I used Apache JMeter to load and test both applications separately on two different VMs.</p><p>I generated 100 requests per second to test performance.<br>Here are the statistics from Jmeter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Eb-PGqFGO7bHhWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lno5EFV5J77AzyIY.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kH67kD0pAIzgnxLa.png" /></figure><p>During our stress testing, we observed that the Webflux service outperformed the <a href="http://twitter.com/Async">@Async</a> approach.</p><p>This was evident from the <strong>Average</strong> (4021)and <strong>Max</strong> (8090) stats for Webflux in JMeter.</p><p>When we performed silo testing using Postman, we noticed a significant reduction in response time for the Webflux service.</p><p>Webflux has several benefits over the @Async approach in Spring. It uses reactive programming and non-blocking I/O, making it highly efficient and responsive.</p><p>It’s important to keep in mind that performance optimisation requires balancing various factors, such as speed, resource usage, and ease of development and maintenance.</p><p>Therefore, it’s crucial to consider the specific requirements and constraints of your application when deciding which approach to use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffe26a12d631" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best IntelliJ plugins to boost your productivity.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@7vik.sathvik/best-intellij-plugins-to-boost-your-productivity-741465ef2397?source=rss-61a14c7c8c39------2"><img src="https://cdn-images-1.medium.com/max/2600/1*i3x6bmBKtFluR_AFh0Mlyg.png" width="3456"></a></p><p class="medium-feed-snippet">IntelliJ IDE</p><p class="medium-feed-link"><a href="https://medium.com/@7vik.sathvik/best-intellij-plugins-to-boost-your-productivity-741465ef2397?source=rss-61a14c7c8c39------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@7vik.sathvik/best-intellij-plugins-to-boost-your-productivity-741465ef2397?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/741465ef2397</guid>
            <category><![CDATA[intellij]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[plugins]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 06:38:13 GMT</pubDate>
            <atom:updated>2023-10-06T03:04:55.344Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Garbage Collection in Java.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@7vik.sathvik/garbage-collection-in-java-6180db954ec5?source=rss-61a14c7c8c39------2"><img src="https://cdn-images-1.medium.com/max/612/1*VtNXJPiRq_XEXDEXsBlJqQ.jpeg" width="612"></a></p><p class="medium-feed-snippet">In Java, garbage means unreferenced objects.</p><p class="medium-feed-link"><a href="https://medium.com/@7vik.sathvik/garbage-collection-in-java-6180db954ec5?source=rss-61a14c7c8c39------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@7vik.sathvik/garbage-collection-in-java-6180db954ec5?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/6180db954ec5</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[garbage-collection]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Wed, 04 Jan 2023 10:08:31 GMT</pubDate>
            <atom:updated>2023-10-06T03:06:04.362Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What is ChatGPT?]]></title>
            <link>https://medium.com/@7vik.sathvik/what-is-chatgpt-c0a16b76ca8a?source=rss-61a14c7c8c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0a16b76ca8a</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[chatgpt3]]></category>
            <dc:creator><![CDATA[Vutukuri Sathvik]]></dc:creator>
            <pubDate>Wed, 04 Jan 2023 09:40:07 GMT</pubDate>
            <atom:updated>2023-01-04T09:46:52.458Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>CHATGPT is a variant of the popular GPT (Generative Pre-training Transformer) language model developed by OpenAI. It is specifically designed to perform well in chat-based environments, such as chatbots and messaging platforms.</strong></p><figure><img alt="ChatGPT is developed by artificial intelligence (AI) research laboratory OpenAI." src="https://cdn-images-1.medium.com/max/1024/1*UvqL7_S2kwzQWnq8ED3Ysg.jpeg" /></figure><p>Like other GPT models, ChatGPT is trained using a large dataset of human-generated text and is able to generate human-like responses to a given input. However, ChatGPT has been fine-tuned on a specific dataset of chat conversations, which allows it to better understand the context and language used in such environments.</p><p>One of the main benefits of ChatGPT is its ability to generate coherent and natural-sounding responses. This makes it well-suited for use in chatbots and messaging platforms, where the goal is to create a conversational experience that feels natural to the user.</p><p>ChatGPT is also highly flexible and can be used in a wide range of applications, from customer service and support to language translation and content generation. Its ability to understand and generate human-like language makes it a powerful tool for tasks that require natural language processing capabilities.</p><p>Overall, ChatGPT is a powerful and flexible language model that is well-suited for chat-based environments. Its ability to generate coherent and natural-sounding responses makes it a valuable asset for a wide range of applications, including chatbots and messaging platforms.</p><p>Since its debut , OpenAI had a record of 1 million subscribers in less than 5 days, fastest technology adoption in history, by far. In last few days OpenAI engineers added many checks, conditions to restrict answers for some of the questions. OpenAI also have plans to start subscription based API’s for OpenAI ChatGPT usage. Free users will have limit on the questions asked.</p><h3>Microsoft things</h3><p>In 2019, OpenAI LP received a US$1 billion investment from <a href="https://en.wikipedia.org/wiki/Microsoft">Microsoft</a> and Matthew Brown Companies. It says microsoft heavily invested in OpenAI to counter Google, Meta AI models. Microsoft is in plans to use ChatGPT to power its Bing search engine.</p><p><strong>20 entertaining ways ChatGPT can be used</strong></p><h4>1. Write a Twitter thread.</h4><h4>2. Write a novel.</h4><h4>3. Guest speaker Q&amp;A prompts.</h4><h4>4. Creating games.</h4><h4>5. Dating help.</h4><h4>6. Dealing with loneliness and anxiety.</h4><h4>7. Translation on the go.</h4><h4>8. Fitness.</h4><h4>9. Coding and integrations.</h4><h4>10. Lesson plans for teachers.</h4><h4>11. Find podcast guests.</h4><h4>12. Handle social media comments and reviews.</h4><h4>13. Crime fighting.</h4><h4>14. Reduce bias.</h4><h4>15. Film scripts and Screenplay.</h4><h4>16. Prepare for interview.</h4><h4>17. Coding help.</h4><h4>18. Pass time by asking anything you want.</h4><h4>19. Gift ideas.</h4><h4>20. Weird one which is comparing response across Google, Duckduckgo, Bing and ChatGPT.</h4><p>Here is the link for <a href="https://chat.openai.com/chat">https://chat.openai.com/chat</a>. Try it and tell us your experiences in the comments section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0a16b76ca8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>