<?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 Sethuraman Krishnamoorthy on Medium]]></title>
        <description><![CDATA[Stories by Sethuraman Krishnamoorthy on Medium]]></description>
        <link>https://medium.com/@sethu-k-r?source=rss-16593c7c7d47------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*rihQPd7a4PHkDXx9u6BGsA.png</url>
            <title>Stories by Sethuraman Krishnamoorthy on Medium</title>
            <link>https://medium.com/@sethu-k-r?source=rss-16593c7c7d47------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:55:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sethu-k-r/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[Concise Kotlin]]></title>
            <link>https://sethu-k-r.medium.com/concise-kotlin-487fef45e840?source=rss-16593c7c7d47------2</link>
            <guid isPermaLink="false">https://medium.com/p/487fef45e840</guid>
            <category><![CDATA[vaadin]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Sethuraman Krishnamoorthy]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 18:13:37 GMT</pubDate>
            <atom:updated>2020-04-20T18:13:37.388Z</atom:updated>
            <content:encoded><![CDATA[<p>A modern programming language with multiplatform support</p><figure><img alt="Kotlin" src="https://cdn-images-1.medium.com/max/200/1*IMG3wQSteD3mBdFDkCMdFQ.png" /><figcaption>Source from Wikipedia</figcaption></figure><p>Kotlin is concise, safe, pragmatic and Interoperable with Java. We’ll discuss more what the terms are…</p><p><strong>Concise </strong>— Replace the maximum number of coding with lesser code<br><strong>Safe </strong>— Kotlin comes with various type system to get rid of problems like NullPointerException<br><strong>Pragmatic </strong>— Coding approach in Kotlin follows the modern way of programming such as functional programming, etc<br><strong>Interoperable </strong>— Kotlin is a new programming language with the good contact support of other programming languages such as Java and JavaScript</p><p><strong>When Kotlin becomes so popular?</strong><em><br>On 7 May 2019, Google announced Kotlin becomes the preferred language for Android developers</em></p><ul><li>Kotlin follows Static Type System meaning Datatype of a variable is known at Compile time instead of at Run time</li><li>Supports Type Interference which means automatically detects the data type. <strong>var x = 1 </strong>it automatically detects type is <strong>Int</strong> which is as same as writing the code as <strong>var x: Int = 1</strong></li><li>Follows an approach of Functional Programming which allows writing <em>First-class functions</em></li><li>In Kotlin, all are expressions, not statements that Java follows. If, function, try-catch all are expressions</li><li>A variable declaration in Kotlin uses two reserved keywords. <strong>var (Mutable), val (Immutable)</strong></li><li>Uses the String template to avoid the complexity of combining multiple variables into a long string. <strong>print(“Kotlin is a ${var1}, ${var2} and ${var3}”)</strong></li></ul><h3><strong>Kotlin Function</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*IjU2D13kgdNAlK0WkUN8Rg.png" /><figcaption>Function Declaration</figcaption></figure><ul><li><strong>fun </strong>is a keyword to declare a function</li><li>After <em>fun</em> keyword with space, the function name is to be placed</li><li>Then parameters need to be passed in the parenthesis after the function name. <strong>(param_name1: param_type, …)</strong></li><li>The return type of the function needs to be specified at the end of the parenthesis</li></ul><h3><strong>Kotlin Class</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnExHd13b2Eo6mMQWNfgUg.png" /></figure><ul><li>Scenario to define an Employee class with two variables, name and experience. name is an immutable, experience is a mutable</li><li>Left side code shows how we can convert the above scenario to real-world code in Java</li><li>Right side code shows the Kotlin way of writing the above scenario</li><li>See how Kotlin reduces the maximum number of coding lines</li><li>When the user wants to add the extra function to a class such as toString, equals, hashCode, getter and setter for all the variables. Coding lines keep increasing in Java more than 40 to 50 lines</li><li>But in Kotlin, we have to convert the <strong>class Employee (val name: String, var experience: Int) </strong>into <strong>data class Employee (val name: String, var experience: Int) </strong>for adding the extra function to a class such as toString, equals, hashCode, getter, and setter for all the variables</li></ul><h3><strong>Other Kotlin Features</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YK5PLgDKciZ0J66Ilvb9wQ.png" /><figcaption>Source from kotlinlang.org</figcaption></figure><ul><li>Kotlin uses new keyword <em>when </em>which replaces the <em>switch </em>statements</li><li>Supports Named Arguments and Default Parameter to a function</li><li>We can add an extra function to the Predefined Java Class by extending it is known as Function Extension</li><li>Introduces many Type systems such as Safe call Operator (?.), Elvis Operator (?:), Safe Casts Operator(as?), etc</li><li>Unlike Java, Kotlin natively supports Operator Overloading</li><li>Destructuring the variables from Class</li><li>Delegate is an OO Design Pattern which allows us to reuse the objects as same as Inheritance</li><li>Object declaration is the best way for creating a singleton object in Kotlin</li></ul><p><em>Simple Geocoder application is built with Kotlin, Spring Boot and Vaadin. </em><a href="https://github.com/sethuraman-k-r/geocoder-app-kotlin">https://github.com/sethuraman-k-r/geocoder-app-kotlin</a></p><p>Follow me in GitHub to get more updates</p><p><strong>Learn by earn, Earn to learn<br>Stay Home, Stay Safe</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=487fef45e840" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java — Functional Programming]]></title>
            <link>https://sethu-k-r.medium.com/java-functional-programming-ee7c2fb2bd7e?source=rss-16593c7c7d47------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee7c2fb2bd7e</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[java8]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Sethuraman Krishnamoorthy]]></dc:creator>
            <pubDate>Thu, 26 Mar 2020 17:24:32 GMT</pubDate>
            <atom:updated>2020-03-26T17:30:53.758Z</atom:updated>
            <content:encoded><![CDATA[<h3>Java — Functional Programming</h3><h4>Learn the functional way of writing the code in Java</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*XrvRPx-b8ysRu_8zim0NNg.png" /><figcaption>Logo of Java</figcaption></figure><p><strong>Question </strong>— Imperative Programming vs Functional Programming</p><p>Normally We do Java Programming in an Imperative way which means Developer focus on How to perform tasks by using an algorithm, give more importance on Order of Execution with the help of Class Instances (Objects) by Loops, Conditionals and Method calls</p><p>Before Java 8 came into existence, Imperative way of writing the code is the only solution to code in Java</p><p>But I always have one question, What’s wrong with Imperative Programming??</p><p>In earlier days, We have only a single CPU desktop and laptop computers. Nowadays laptops and desktops come up with so many CPUs, that are known as Multi-core computers.</p><p>Today we have a system with four, eight, sixteen, etc core systems which mean not a single CPU we have four, eight, sixteen CPUs.</p><p>When we write code in an Imperative way, it maintains the load only in a single CPU. It doesn’t utilize the capacity of other idle CPUs. This leads the system to process the big amount of task by taking huge time to complete or system might be crashed</p><p>But Functional Programming share the work of heavy load process to all the CPU cores</p><p><a href="https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/functional-programming-vs-imperative-programming">Functional Programming vs. Imperative Programming (C#)</a></p><p>Over 700 programming languages are available across the industry, but how the programming languages maintain its popularity over several years.</p><p>They have to update themselves in order to survive, Java also did that in their released version 8 to switch into the way of writing Functional code. But it also provides the support of writing Imperative code in that version.</p><p>In Java 8, we have several new features to update the way of writing our code which includes Lambda, Function Interface, Type Inference, Method Reference, Constructor Reference, etc</p><ul><li>Predicate, Consumer, Function, Supplier are some of the common functional interfaces</li><li>LocalDate, LocalTime, LocalDateTime, Instant and Period are the new Date and Time API</li><li>Stream is an effective way of coding difficult tasks within a line of code</li><li>Optional is an added class under java.util package to avoid nullability exception</li><li>and a lot more</li></ul><p>To know more about the Java 8 Concepts, I recommend you to learn from <strong>Java 8 in Action </strong>by <strong>Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft</strong></p><p>I have implemented some of the concepts from that book and also solve most of the JPA problems using the Java 8 concepts. Both the projects are available in GitHub Repository</p><ul><li><a href="https://github.com/sethuraman-k-r/learn-java-8">https://github.com/sethuraman-k-r/learn-java-8</a></li><li><a href="https://github.com/sethuraman-k-r/java-8-employee-database">https://github.com/sethuraman-k-r/java-8-employee-database</a></li></ul><p><strong><em>Please follow the README instructions to know more about how to start using the projects</em></strong></p><p>March 2020 is really special for Java developers, Java 14 is released this month</p><p>Follow me for more updates, let’s stay connected</p><p><strong>Learn by earn, Earn to learn</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee7c2fb2bd7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learn GraphQL]]></title>
            <link>https://sethu-k-r.medium.com/learn-graphql-2c93fc094a4?source=rss-16593c7c7d47------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c93fc094a4</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[graphql-vs-rest]]></category>
            <dc:creator><![CDATA[Sethuraman Krishnamoorthy]]></dc:creator>
            <pubDate>Mon, 20 Jan 2020 05:50:23 GMT</pubDate>
            <atom:updated>2020-01-20T05:50:23.931Z</atom:updated>
            <content:encoded><![CDATA[<h4>A query language for your API</h4><p>GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. (<strong>Definition from GraphQL</strong>)</p><p><strong>What does it mean? <br></strong>Most of the programming languages powered with so many powerful frameworks in order to create a REST API within a couple of minutes. Express.js for JavaScript, Django/Flask for Python, Spring REST/Jersey JAX-RS for JAVA, etc.<br>JSONPlaceholder is a fake Online REST API for Testing and Prototyping. When I hit the following link <a href="https://jsonplaceholder.typicode.com/users">https://jsonplaceholder.typicode.com/users </a>from browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*nHYvAG_TKSNCqI55CLIG6Q.png" /><figcaption><a href="https://jsonplaceholder.typicode.com/users/">https://jsonplaceholder.typicode.com/users/</a> — All users data</figcaption></figure><p>The output from the server for this endpoint is all the users&#39; data. What if I need only one user data? Then again hit another link from the browser <a href="https://jsonplaceholder.typicode.com/users/1">https://jsonplaceholder.typicode.com/users/1</a> and you will be getting output in the below format</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*2rKjbZxwPtOL8837Y7EZoA.png" /><figcaption>Single user data — User # 1</figcaption></figure><p>Now check the difference between two links <br> 1. <a href="https://jsonplaceholder.typicode.com/users">https://jsonplaceholder.typicode.com/users</a> <br> 2. <a href="https://jsonplaceholder.typicode.com/users/1">https://jsonplaceholder.typicode.com/users/1</a></p><p>If I want the data of all the users, I will go with link #1. Else link #2 for a single user data by sending the user-id with the URL. That’s pretty cool. Isn’t it?</p><p>Now I’m managing two different web applications. Both the application requires data from <a href="https://jsonplaceholder.typicode.com/users/user_id.">users/<strong>user_id</strong>.</a> But the problem is, One application requires only id, name, address, and email and another application require only id, name, username, phone, and company. <em>Is it possible to send those required data from server end to client end using REST API? The answer is YES, but the problem is we need to create a new endpoint for each data. Each and every time when the user request for data with different keys, the server needs to create a new endpoint (users/id/email/ or users/id/email/username/ or users/id/name/address). The backend developer doesn’t know about what keys are requesting by the client-side for the data.</em></p><figure><img alt="Logo of GraphQL" src="https://cdn-images-1.medium.com/max/400/1*8yGId6pSq_9b7d5ooIcEOA.png" /></figure><p>Here’s why the GraphQL helps the developers to achieve the above tedious job. We can write a code to send user data, and from the client end, the developers can choose which keys they really want and send those keys to the endpoint. Finally, they will get only the essential data which they are requesting, not any unnecessary data. Now I hope you understood the meaning of the above definition about GraphQL. We can select the data which I want for my application, instead of calling different endpoint for each type of data.</p><p>GraphQL project is available in GitHub — <a href="https://github.com/sethuraman-k-r/graphql-js">https://github.com/sethuraman-k-r/graphql-js</a></p><p>Please visit the GitHub and play with that project by forking it</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c93fc094a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>