<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kshitij Saraogi</title>
    <description>The latest articles on DEV Community by Kshitij Saraogi (@kshitij10496).</description>
    <link>https://dev.to/kshitij10496</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F9678%2Fc27d0cbe-1015-4bee-8c85-39963eea6181.jpg</url>
      <title>DEV Community: Kshitij Saraogi</title>
      <link>https://dev.to/kshitij10496</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kshitij10496"/>
    <language>en</language>
    <item>
      <title>Why I Write Go</title>
      <dc:creator>Kshitij Saraogi</dc:creator>
      <pubDate>Wed, 14 Nov 2018 06:26:23 +0000</pubDate>
      <link>https://dev.to/kshitij10496/why-i-write-go-4o9n</link>
      <guid>https://dev.to/kshitij10496/why-i-write-go-4o9n</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally posted: &lt;a href="https://kshitij10496.github.io/posts/on-go/" rel="noopener noreferrer"&gt;Why I Write Go&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt;: This is not a rant about how Go is "superior" to other languages. It's all apples and oranges and I like them both, not at the same time, ofcourse! 🍎/🍊&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;off-topic&lt;/strong&gt;: When I was a little boy 👦, I used to play all day long with my legos - constructing buildings, trucks, everything that I could imagine. Chaining dominoes with my parent's music collection cassettes, solving jigsaw puzzles and playing scrabble with my cousins. Good ol' days! &lt;/p&gt;




&lt;h1&gt;
  
  
  Inspiration
&lt;/h1&gt;

&lt;p&gt;Reading Rob Pike's post titled "&lt;a href="https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html" rel="noopener noreferrer"&gt;Less is exponentially more&lt;/a&gt;", I found myself introspecting about the way I write software. The article evoked some joy in me, stimulated that deep-seated feel-good core - the part of my being that enjoys programming. And I want to share it with everyone! &lt;/p&gt;

&lt;h1&gt;
  
  
  Why Go?
&lt;/h1&gt;

&lt;p&gt;During my GSoC, I used to struggle with grasping the idea of classes implementing behaviours and how would it be useful for subclasses - inheritance. &lt;/p&gt;

&lt;p&gt;For example, let's consider a &lt;code&gt;Point&lt;/code&gt; class representing a point in the Cartesian Space.   &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Should &lt;code&gt;distance&lt;/code&gt; be a method on this class?
&lt;/li&gt;
&lt;li&gt;Does &lt;code&gt;distance&lt;/code&gt; define the "behaviour" of a &lt;code&gt;Point&lt;/code&gt;?
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;*Not necessarily!  *&lt;/p&gt;

&lt;p&gt;(After reading some mathematics on Measure Theory, I came to know that "distance" is a quantity defined by a "metric function" - property of the space rather than any entity.)&lt;br&gt;&lt;br&gt;
In our case, the &lt;code&gt;distance&lt;/code&gt; should be a method on the &lt;code&gt;CartesianSpace&lt;/code&gt; rather than &lt;code&gt;Point&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The question that arises then is how can I assure that I can always compute distance between given pair of &lt;code&gt;Point&lt;/code&gt; values, or any geometrical entity for that matter?
&lt;/li&gt;
&lt;li&gt;Should I just override the &lt;code&gt;distance&lt;/code&gt; method in each geometrical class?
&lt;/li&gt;
&lt;li&gt;If so, what purpose does the base &lt;code&gt;distance&lt;/code&gt; method in &lt;code&gt;CartesianSpace&lt;/code&gt; serve now?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I would agree that these questions are subjective and I respect your solution to the problem. &lt;/p&gt;

&lt;p&gt;However, then I came to know about &lt;a href="https://kshitij10496.github.io/posts/duck-typing-in-python/" rel="noopener noreferrer"&gt;Duck Typing in Python&lt;/a&gt; and it's approach to the problem. However, I was not satisfied with the Python implementation. It almost felt kind of a convenience pattern which was incompatible with Pythonic code. &lt;/p&gt;

&lt;p&gt;Eventually, I found about Go &lt;code&gt;interfaces&lt;/code&gt;.(Plus, CSP! ❤️) &lt;/p&gt;

&lt;h1&gt;
  
  
  Things I like about Go
&lt;/h1&gt;

&lt;p&gt;Coming back to the question - &lt;em&gt;"Why I Write Go?"&lt;/em&gt;, here are some of my favourite reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;emphasis on separation between state and behaviour&lt;/li&gt;
&lt;li&gt;composition over inheritance; think &lt;em&gt;legos&lt;/em&gt; 🧩&lt;/li&gt;
&lt;li&gt;simplicity in design; &lt;strong&gt;less is more&lt;/strong&gt;, indeed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More importantly, I rediscovered the joy of putting tiny pieces together and building something greater than the sum of the individual parts (read off-topic). In addition to writing “cleaner and more readable” code, I find a lot more clarity when it comes to solving problems and coherence in my thinking while implementing the solution. I guess that is the underappreciated USP of Go, for me, ofcourse! 😁&lt;/p&gt;

&lt;p&gt;So what is your favourite programming language and why? 😃&lt;/p&gt;

</description>
      <category>go</category>
      <category>python</category>
      <category>software</category>
    </item>
  </channel>
</rss>
