<?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 jayaprabhakar k on Medium]]></title>
        <description><![CDATA[Stories by jayaprabhakar k on Medium]]></description>
        <link>https://medium.com/@jayaprabhakar?source=rss-123db930314a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*W8JyiubOG66uP7Ql.</url>
            <title>Stories by jayaprabhakar k on Medium</title>
            <link>https://medium.com/@jayaprabhakar?source=rss-123db930314a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:50:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jayaprabhakar/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[Serve Home Page From CDN with Cloudflare Worker]]></title>
            <link>https://jayaprabhakar.medium.com/serve-home-page-from-cdn-with-cloudflare-worker-bfaf50701d0f?source=rss-123db930314a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfaf50701d0f</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[service-worker]]></category>
            <category><![CDATA[low-latency]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[jayaprabhakar k]]></dc:creator>
            <pubDate>Tue, 12 Jun 2018 09:39:06 GMT</pubDate>
            <atom:updated>2018-06-14T06:36:25.199Z</atom:updated>
            <content:encoded><![CDATA[<p>Cloudflare Service Worker helped Codiva jump at least 2 positions in Google by speading up home page response. I did it by serving the new users (and search crawler) from the edge, and avoiding redirects for logged in users.</p><p>Let us take a look at the undocumented hack using Cloudflare workers.</p><p>You are building a SAAS product. When a user is logged in, the home page should show the user’s personal content. If the user is not logged in, it should show the home page that convinces users’ to sign up or login (typically static content).</p><p>Ideally, you want the static content to be served from CDN. At the same time, you would want to avoid redirects to the logged in user.</p><p>If you are a developer consious of latency, you would want to serve as much content as quickly as possible. Reducing latency improves engagement. Also, Google crawler, considers latency as a ranking parameter.</p><p>The ultimate latency reduction guideline is to</p><blockquote><em>Serve </em>less data<em> over </em>short distance<em> with an </em>efficient protocol<em>.</em></blockquote><p>This post assumes, you already know 1. Content Delivery Network 1. Service Worker 1. Basic web terminologies like Cookies, Cache, Requests, etc</p><p>Let us see the various scenarios for the traffic and see how to improve in each case.</p><ol><li>Existing user — logged in</li><li>Existing user — not logged in</li><li>First time user.</li></ol><h3>Existing user (logged in or not logged in)</h3><p>For existing users, the biggest optimization you could do is to minimize amount of data transferred.</p><p>You could do that with Service Worker to intercept the request, and fetch only the dynamic content and render using the prefetched template.</p><p>I will explain that technique in detain in a later post.</p><h3>First time user (Real user or web crawler)</h3><p>For the first time user, there is not much optimization you could make. There is no data cached. Also, the request has to go to the server to determine if the user is logged in. Required to decide whether to serve the static content or the dynamic personalized content.</p><p>This trick lies in identifying whether the user is a first time user or existing user. We do it by looking at the cookies.</p><p><a href="https://www.codiva.io/">Codiva</a> uses Express with Node. Express sets ‘connect.sid’ cookie on every response. In Cloudflare Service Worker, we could simply check if this cookie is set. If not, respond with the static home page.</p><p>Otherwise, send the request to the server. (Optimizing this case is in later post).</p><pre>if (event.request.headers.has(&#39;Cookie&#39;)<br>   &amp;&amp; event.request.headers.get(&#39;Cookie&#39;)<br>          .indexOf(&#39;connect.sid&#39;) &gt;= 0) {<br>      // Existing user.  <br>      event.respondWith(fetch(event.request));<br>} else {<br>  // You may need to set the Page Rule to cache .html files<br>  var newUrl = new URL(&#39;/static/homepage.html&#39;, event.request.url);</pre><pre>  event.respondWith(fetch(newUrl.toString())<br>      .then(function(response) {<br>        // Remove cache headers<br>        response = new Response(response.body, response)<br>        response.headers.delete(&#39;expires&#39;)<br>        response.headers.delete(&#39;cache-control&#39;)<br>        return response<br>  }</pre><pre>  ));<br>}</pre><p>If you use other technologies, find the correct cookie. This does not need any change on the downstream server. You could do some sophisticated processing here to identify the right cookie. If you want to modify the server, you could even set a separate cookie when a user logs in. (Remember, the cookie might get invalid. So cookie present just means the user may be logged in. But cookie not present clearly means the user is not logged in.)</p><p>The advantage of this solution are.</p><ol><li>No changes needed on the downstream server.</li><li>Very simple to implement and debug</li><li>Serves the first time user from the edge. Whether the user comes from search result, search ad, or from direct or other referrals</li><li>Search Crawler will see the same content and faster. This is not a blackhat technique.</li><li>No redirects for logged in user (Try <a href="https://www.gmail.com/">Gmail</a> to see the annoying redirects for logged in user.)</li></ol><p><em>Originally published at </em><a href="https://www.codiva.io/blog/post/serve-home-page-from-cdn-cloudflare-worker/"><em>www.codiva.io</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfaf50701d0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rethinking Atwood’s Law]]></title>
            <link>https://jayaprabhakar.medium.com/rethinking-atwoods-law-64a894b54aa4?source=rss-123db930314a------2</link>
            <guid isPermaLink="false">https://medium.com/p/64a894b54aa4</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jeff-atwood]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[jayaprabhakar k]]></dc:creator>
            <pubDate>Wed, 03 Jan 2018 10:03:15 GMT</pubDate>
            <atom:updated>2018-01-03T10:03:15.909Z</atom:updated>
            <content:encoded><![CDATA[<p>In 2007, Jeff Atwood made the quote that was popularly referred to as Atwood’s Law.</p><p>Atwood’s Law</p><blockquote>“Any application that <em>can </em>be written in JavaScript, <em>will</em> eventually be written in JavaScript.”<br> — Jeff Atwood, Author, Entrepreneur, Cofounder of StackOverflow</blockquote><p>10 years ago:<br>As a Java developer, I couldn’t tolerate JavaScript. I always believed coding in JavaScript is a mistake. I actually preferred GWT where you write Java code.</p><p>When I first heard this, I felt Atwood’s law is a corollary of Murphy’s law.</p><blockquote>“If anything can go wrong, it will.</blockquote><p>where when you put <strong>Writing in JavaScript</strong> for <strong>Wrong</strong> you get Atwood’s law.</p><p>Now:</p><p>10 years has passed. I believe he is more correct today than ever. Almost everything that used to be desktop only, are available in the web. At present the number of desktop apps created are reducing significantly. They are being replaced by Web version and smartphone Apps.</p><h3>JavaScript everywhere:</h3><p>JavaScript is not only used in the browser, but also on the Server. Thanks to Node.js. Also Chrome team for open-sourcing V8 javascript engine.</p><p>You can build Android and iOS Apps with JavaScript.</p><p>You can even build Desktop apps with Electron.</p><h3>Browser and the Cloud:</h3><p>Although JavaScript apps can run anywhere, the primary driver for its usage is the Browser and the Cloud.</p><p>You interact with the browser, some or most of the processing happens in the server.</p><ul><li>Store data in the server.</li><li>Access from multiple devices.</li><li>Safe from data corruption</li><li>More secure than many individual’s desktops.</li><li>Use any number of CPUs for processing</li></ul><p>The rise of Chromebooks despite its limitations shows the power of this model.</p><ul><li>Write documents</li><li>Create Presentations</li><li>Track expenses</li><li>Chat</li><li>Edit Photos and Videos</li><li>Write Code</li></ul><p>Almost everything is done in cloud through the Web or an App.</p><h3>Hosting</h3><p>Unless you are a super-big company, you don’t own your servers. Many of the big companies today were small startups once. For them, cash is the king. No one wants to tie them up by buying servers that depreciate quickly.</p><p>The applications have browser or smartphone App that connects to the cloud.</p><p>Today, I think Atwood’s law should be rewritten as,</p><blockquote><strong>“Any application that <em>can </em>run in cloud, <em>will</em> eventually run in the cloud.”</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64a894b54aa4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to embed Java Programs on Medium and your blogs?]]></title>
            <link>https://jayaprabhakar.medium.com/how-to-embed-java-programs-on-medium-and-your-blogs-76ef05dd77fe?source=rss-123db930314a------2</link>
            <guid isPermaLink="false">https://medium.com/p/76ef05dd77fe</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[jayaprabhakar k]]></dc:creator>
            <pubDate>Sun, 10 Dec 2017 09:13:50 GMT</pubDate>
            <atom:updated>2021-03-21T08:38:20.964Z</atom:updated>
            <content:encoded><![CDATA[<h3>On Medium,</h3><ol><li>Create the code you have on Codiva.io</li><li>Click ‘Share’ to share the read only copy to everyone.</li><li>Copy the link, and paste the URL.</li><li>Press Enter.</li></ol><p>Medium will automatically embed the Codiva project on your post.</p><p>Once you publish the post, your users will be able to read and run the program write from your page. They will also be able to clone the project and edit their copy.</p><p>The embedded post appears like,</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F9509b8fb-4866-4366-97e1-bc2ceb9145f9&amp;display_name=Codiva.io&amp;url=https%3A%2F%2Fwww.codiva.io%2Fp%2F9509b8fb-4866-4366-97e1-bc2ceb9145f9&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb1cc589198c2519a87615d23dac92f5/href">https://medium.com/media/cb1cc589198c2519a87615d23dac92f5/href</a></iframe><h3>On other sites,</h3><ol><li>Create the code you have on Codiva.io</li><li>Click ‘Share’ to share the read only copy to everyone.</li><li>Copy the code sample that prints the snippet to embed</li><li>Paste the code snippet in your blog or your site.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76ef05dd77fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Poorly Researched Clickbait Articles in DZone]]></title>
            <link>https://jayaprabhakar.medium.com/poorly-researched-clickbait-articles-in-dzone-cca19d1d0999?source=rss-123db930314a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cca19d1d0999</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[complexity]]></category>
            <category><![CDATA[java-training]]></category>
            <dc:creator><![CDATA[jayaprabhakar k]]></dc:creator>
            <pubDate>Fri, 23 Dec 2016 23:33:43 GMT</pubDate>
            <atom:updated>2016-12-26T10:52:35.455Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Developer of </em><a href="https://www.codiva.io/"><em>https://www.codiva.io Online Java Compiler</em></a><em> and Software Engineer at Google!</em></p><p>I am a subscriber of DZone newsletters and I have always liked their curated articles. But, I started to notice some occasional poorly researched articles recently.</p><p>The latest and the craziest article was <a href="https://dzone.com/articles/string-concatenation-performacne-improvement-in-ja"><em>“We Don’t Need StringBuilder for Concatenation Anymore”</em></a></p><p><em>Edit: The author has updated the article. </em><a href="https://web.archive.org/web/20161222144139/https://dzone.com/articles/string-concatenation-performacne-improvement-in-ja"><em>Read the original version here</em></a><em>.</em></p><p><strong>TL;DR: Ignore that advice. Use StringBuilder when concatenating large number of strings, except for the trivial cases.</strong></p><p>I learnt Java in 2002 and have been programming in Java from then on. Since the initial version of Java, using StringBuffer was recommended for String concatenation. Then from Java 5 (or 1.5) onwards, StringBuilder is recommended for String concatenation.</p><p>The title <em>“We Don’t Need StringBuilder for Concatenation Anymore”</em> <strong>caught my attention</strong>. I expected</p><ol><li>A new library that makes string concatenation faster.</li><li>An upcoming Java 9 feature.</li></ol><p>So I opened the article.</p><p>It started with the claim that StringBuilder is no longer needed <strong>“In Java 8”</strong> That raised <strong>my curiosity</strong>.</p><p>The article starts with the drawback of using concatenation using ‘+’ operator. (It had a mistake there it said dot operator. Let us forgive that as a genuine mistake). String is immutable. And pointed out concatenating the immutable strings can become O(n²) operation.</p><p>So far so good. The author tried to appear authoritative by</p><ul><li>adding images</li><li>source code of StringBuilder</li><li>the generated byte code (decompiled using javap).</li></ul><p>And claimed Java compiler does some magic, and proved it with a trivial example, shown below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2F9a89ef22-27da-4a63-a846-cd44d4e05dff&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F9a89ef22-27da-4a63-a846-cd44d4e05dff&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/00ae4298658025a4ac7f70af5afe798f/href">https://medium.com/media/00ae4298658025a4ac7f70af5afe798f/href</a></iframe><h3><strong>Wrong Wrong and so many wrongs</strong></h3><ol><li>Java compiler knows to use StringBuilder. So the author claims StringBuilder is not needed anymore.</li><li>The author claims this is a compiler optimization from Java 8. But this has been present since 1.4 (released in 2002 from when I learnt Java) using StringBuffer. From what I know, this has been there from the first version.</li><li>The author didn’t verify his own example — repeated string concatenation with 1 million strings.</li><li>The compiler can optimize the million string concatenation into O(n) operation only when they are on a single statement.</li></ol><h3>Common use case for StringBuilder and the compiler cannot optimize</h3><p>String concatenation in a loop. And look at the decompiled .class file (Click Files &gt; then open the /bin/StringConcateDemo.class)</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2Ff59b4966-7f38-410f-8034-eaa087fb053c&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2Ff59b4966-7f38-410f-8034-eaa087fb053c&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3655bc56b51de8fc362fb161c647fcfe/href">https://medium.com/media/3655bc56b51de8fc362fb161c647fcfe/href</a></iframe><p>You will see that compiler internally used StringBuilder. Don’t prematurely conclude compiler optimized it. The program is still O(n²).</p><p>0: ldc #2 // String<br> 2: astore_1<br> 3: iconst_0<br> 4: istore_2<br><strong> 5: iload_2<br></strong> 6: sipush 1000<br><strong> 9: if_icmpge 38</strong><br> 12: new #3 // class java/lang/StringBuilder<br> 15: dup<br> 16: invokespecial #4 // Method java/lang/StringBuilder.”&lt;init&gt;”:()V<br> 19: aload_1<br> 20: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;<br> 23: bipush 46<br> 25: invokevirtual #6 // Method java/lang/StringBuilder.append:©Ljava/lang/StringBuilder;<br> 28: invokevirtual #7 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;<br> 31: astore_1<br> 32: iinc 2, 1<br><strong> 35: goto 5<br></strong> 38: return</p><p>Look at the lines between 5–35 is the loop. You will see a new StringBuilder object is created in each iteration. That copies the string resulting in O(n²) complexity.</p><p>Run this Java program in <a href="https://www.codiva.io/">Codiva.io Online Java Compiler</a> to get the time taken with and without using StringBuilder. Decide for yourself.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2F85769b8c-a68c-43aa-8cd7-d5f37482ff4e&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F85769b8c-a68c-43aa-8cd7-d5f37482ff4e&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca3de48708916896d2bf56b67e529aee/href">https://medium.com/media/ca3de48708916896d2bf56b67e529aee/href</a></iframe><h4>TL;DR</h4><p>You still need StringBuilder.</p><h4>My Free Advice to Students</h4><p>Every time you read an article online, always be critical of the conclusions. <a href="https://www.reddit.com/r/programming/comments/5k3auf/poorly_researched_clickbait_articles_in_dzone/dbl38mh/">Quoting a reddit user’s comment</a>,</p><blockquote>Programming is an activity that requires nuance, so those with none of it should be treated with suspicion.</blockquote><p>There are too many impressive articles with incorrect programming advices.</p><p>When it comes to performance, always benchmark.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cca19d1d0999" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What computer science teachers don’t teach you]]></title>
            <link>https://jayaprabhakar.medium.com/what-computer-science-teachers-dont-teach-you-3568b54e261b?source=rss-123db930314a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3568b54e261b</guid>
            <category><![CDATA[java-training]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[jayaprabhakar k]]></dc:creator>
            <pubDate>Sun, 09 Oct 2016 07:44:10 GMT</pubDate>
            <atom:updated>2016-10-09T07:44:10.946Z</atom:updated>
            <content:encoded><![CDATA[<p>Most courses starts with simple topics and gradually introduces complex topics. For each topic, a simple problem will be used to illustrate the complex solution. In many cases, where simpler solutions exist, teachers fail to point that out.</p><p>I believe this is a problem. The teachers are training their students to look for complex approaches, instead of searching for simpler solution.</p><p>For example, if you are programmer, you would have written code to compute the nth Fibonacci number.</p><blockquote>F(n) = F(n-1) + F(n-2) for n &gt;= 2 and F(0) = 0, F(1) = 1.</blockquote><h3>Loops</h3><p>In your programming course, when loops are introduced, you would have written something similar to the following code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F59e67891-8c36-4853-89a4-da0dab825882&amp;display_name=Codiva.io&amp;url=https%3A%2F%2Fwww.codiva.io%2Fp%2F59e67891-8c36-4853-89a4-da0dab825882&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/509286630beecd81a4b1767dcd2a2a5e/href">https://medium.com/media/509286630beecd81a4b1767dcd2a2a5e/href</a></iframe><p>There is no issues with this code. It works. Simple to write. Simple to explain.</p><h3>Recursion</h3><p>Once recursion is introduced, the same fibonacci code will be rewritten either as an example or as an exercise.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2F539d3555-fbd1-449d-862f-32b34f90cf6b&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F539d3555-fbd1-449d-862f-32b34f90cf6b&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8167a72b6d93e2e20e1040585f9fbb6e/href">https://medium.com/media/8167a72b6d93e2e20e1040585f9fbb6e/href</a></iframe><p>Very simple to understand. Very short. But horribly slow because the complexity is O(2^N)</p><h3>Memoization</h3><p>After explaining why the previous code is bad, a new topic memoization will be introduced. Just store the previously computed value.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2F25020e90-4290-40ed-bdaf-e468f81cdb4c&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F25020e90-4290-40ed-bdaf-e468f81cdb4c&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfe33aea244a4cf8f2afea0fdd440dc8/href">https://medium.com/media/dfe33aea244a4cf8f2afea0fdd440dc8/href</a></iframe><p>This code is much faster. A bit more complicated. Now you have learnt a new concept. The teaching ends here.</p><p>What if, there is a simple and faster solution. Only needs some basic math operations. <a href="https://en.wikipedia.org/wiki/Fibonacci_number#Computation_by_rounding">A simple Formula</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yQ6n5eF0sbyCgyRQ4aUqQA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.codiva.io%2Fp%2F53246842-7d6c-4465-82ea-a0eafe4e9ba5&amp;src=https%3A%2F%2Fwww.codiva.io%2Fem%2Fp%2F53246842-7d6c-4465-82ea-a0eafe4e9ba5&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codiva" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/5fdf8317f0e7e658bb581273d9a7502e/href">https://medium.com/media/5fdf8317f0e7e658bb581273d9a7502e/href</a></iframe><p>It is one line. Unfortunately, this doesn’t use any important programming concepts. Therefore, no one teaches it. Teachers teach topics, not how to find the best solution when there are many. We have successfully taught the students to find the complex solution to the simple problem.</p><h3>It can be worse…</h3><p>Given a problem, instead of learning about various approaches, we immediately jump to code.</p><p>It was in 2008. There was a senior engineer in our team. He was a backend engineer. We noticed a bug. When submitting a form with a text field filled with large text, it gets truncated. He learnt that GET requests get truncated because of url limits.</p><p>He jumped to the solution. <strong>True Story!</strong></p><ol><li>Break the text into small chunks</li><li>Send each chunk with some AJAX</li><li>On the server, merge all the chunks.<br>How hard is it? <strong>Except, we want to keep the server stateless</strong>.</li><li>Store the chunks in a persistent storage. It was 2008. Bigtable was not hard. But, what happens when the subsequent requests goes to different regions?</li><li>Cross-region replication might be eventually consistent, but not suitable for this use-case. Solve this with even more complexity.</li></ol><p>Weekend was over. Proud about the design, he worked through the weekend and on Tuesday, he announced to the team during the status update, how he solved this complex problem. He was enthusiastically explaining, until another teammate asked,</p><blockquote>“Have you tried POST?”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3568b54e261b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>