<?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: Kurtis Nusbaum</title>
    <description>The latest articles on DEV Community by Kurtis Nusbaum (@klnusbaum).</description>
    <link>https://dev.to/klnusbaum</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%2F7910%2FBZH8JJvO.jpg</url>
      <title>DEV Community: Kurtis Nusbaum</title>
      <link>https://dev.to/klnusbaum</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/klnusbaum"/>
    <language>en</language>
    <item>
      <title>Why I’m So Frustrated WithÂ Go</title>
      <dc:creator>Kurtis Nusbaum</dc:creator>
      <pubDate>Thu, 01 Jun 2017 16:09:19 +0000</pubDate>
      <link>https://dev.to/klnusbaum/why-im-so-frustrated-withgo</link>
      <guid>https://dev.to/klnusbaum/why-im-so-frustrated-withgo</guid>
      <description>&lt;p&gt;It’s been about a year since I started using Go. I’ve written a lot of code with it, including an entire micro-service and a contribution to glide. I want to emphasize that, for the most part, it’s been pretty good. But about once a month, my eye starts twitching and I get the urge to start making a head-to-desk motion. The reasons for this can be pretty simply demonstrated. Since I seem to have this conversation on a regular basis, I thought I’d record my thoughts so I can just simply reference this the next time it comes up.&lt;/p&gt;

&lt;h1&gt;
  
  
  A Simple Data Structure
&lt;/h1&gt;

&lt;p&gt;I need a data structure. It has the following requirements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It must store the name of an animal and an associated struct containing some information regarding the animal.&lt;/li&gt;
&lt;li&gt;It must have O(1) lookup time.&lt;/li&gt;
&lt;li&gt;I must be able to iterate over it’s elements in some predefined order.&lt;/li&gt;
&lt;li&gt;It must be immutableÂ¹.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At first glance, we might be tempted to simply use a map like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is kinda nice. In fact, it satisfies the first two requirements of our data structure. But since the very early days of Go, the &lt;a href="https://blog.golang.org/go-maps-in-action#TOC_7."&gt;order objects are stored in a map is random&lt;/a&gt; (for good reason). So I can’t do something simple like insert all the elements into the map in the same order over which I’d like them to be iterated.&lt;/p&gt;

&lt;p&gt;Alright, no big deal. We can get around this by just writing a little bit more code, using an array to keep track of order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;Mapping&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;
  &lt;span class="n"&gt;Order&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now whenever we want to iterate over the map, we need to iterate over the &lt;code&gt;Order&lt;/code&gt; slice instead, using the strings we pull off as keys into the map. Not the greatest, but it works.&lt;/p&gt;

&lt;h1&gt;
  
  
  What About Immutability?
&lt;/h1&gt;

&lt;p&gt;This is where things get really hairy. Go doesn’t have the concept of &lt;a href="https://www.quora.com/What-is-the-compile-time-constant-and-run-time-constant-in-the-C-programming-language"&gt;runtime constants&lt;/a&gt;. If we want things to be immutable after we create them, we’re going to have to completely, and I mean completely, encapsulate both the slice and the map in our struct. This is because maps and slices have &lt;a href="https://stackoverflow.com/questions/40680981/are-maps-passed-by-value-or-by-reference-in-go"&gt;pass-by-reference semantics&lt;/a&gt;. In other words, if at any point I give you a reference to them, you’ll be able to modify them. The best I can come up with is now this explosion of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;Animals&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Len&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;At&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Len&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;At&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;

&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mapping&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;
    &lt;span class="n"&gt;order&lt;/span&gt;   &lt;span class="n"&gt;animals&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;NewMap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mapping&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;newMap&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;newMap&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;newMap&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newMap&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;am&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;Animals&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;am&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;am&lt;/span&gt; &lt;span class="n"&gt;AnimalMap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;am&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What just happened? That’s an infuriating amount of code to write. You know how much code I’d have to write if this were &lt;a href="https://stackoverflow.com/questions/2636303/how-to-initialize-a-private-static-const-map-in-c"&gt;C++&lt;/a&gt;, &lt;a href="https://msdn.microsoft.com/en-us/library/dn467194(v=vs.111).aspx"&gt;C#&lt;/a&gt;, or &lt;a href="https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/collect/ImmutableMap.html"&gt;Java&lt;/a&gt;? None. They all have reusable notions of an immutable, ordered map. Yet in Go, every time I need one I have to write 30 lines of code. I feel like I had to fight to Go every step of the way here. I feel sad.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Go has some pretty neat concepts. I love that it enforces composition over inheritance. Goroutines are pretty nifty. I’ve been pretty satisfied with it overall. But time and again, I find myself solving the same problems over and over when using Go. I find myself completely blocked, with no way to write DRY codeÂ².&lt;/p&gt;

&lt;p&gt;I’d love to see the Go community address issues like this. IMHO generics would solve all of the issues above, but I understand that’s somewhat of a sore topic for the Go community. Perhaps something like a simple form of codegen for common data structures and algorithms?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Kurtis Nusbaum is a Mobile and Backend Developer at Uber. He’s an avid long distance runner and diversity advocate. Here's his &lt;a href="http://tinyletter.com/kurtis"&gt;mailing list&lt;/a&gt;. Here's his &lt;a href="https://twitter.com/klnusbaum"&gt;Twitter&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/knusbaum"&gt;LinkedIn&lt;/a&gt;. Here’s his &lt;a href="https://github.com/klnusbaum"&gt;github&lt;/a&gt;. If Kurtis seems like the kind of guy with whom you’d like to work, shoot him an e-mail at &lt;a href="mailto:kcommiter@gmail.com"&gt;kcommiter@gmail.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Â¹Here's &lt;a href="https://softwareengineering.stackexchange.com/questions/151733/if-immutable-objects-are-good-why-do-people-keep-creating-mutable-objects"&gt;why you might want immutability&lt;/a&gt;&lt;br&gt;
Â²For instance, try writing a reusable exponential backoff algorithm or a reusable binary tree. Oh, and you can’t use interface{}. We’re programming in a statically typed language for a reason.&lt;/p&gt;

</description>
      <category>go</category>
    </item>
    <item>
      <title>What Makes A Senior Software Engineer</title>
      <dc:creator>Kurtis Nusbaum</dc:creator>
      <pubDate>Sat, 25 Feb 2017 01:42:51 +0000</pubDate>
      <link>https://dev.to/klnusbaum/what-makes-a-senior-software-engineer</link>
      <guid>https://dev.to/klnusbaum/what-makes-a-senior-software-engineer</guid>
      <description>

&lt;p&gt;As a Senior Software Engineer here at Uber, I often spend time helping to mentor newer software engineers. One of the questions I get asked most often from my mentees is “How do I become a Senior Engineer?”&lt;/p&gt;

&lt;p&gt;This is a complex question. Any true answer will contain caveats and nuances. However, in my opinion there is one broad answer that cuts to the core of the question. The distinction between a Junior Engineer and a Senior can be boiled down to a one word difference:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Junior engineers &lt;strong&gt;build on the&lt;/strong&gt; rails, Seniors &lt;strong&gt;build the&lt;/strong&gt; rails.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What I mean by this is that Junior Engineers are going to be building on the work already done by Senior Engineers. Senior Engineers essentially multiply the work they do by creating technologies/architectures that enable other engineers to write better code.&lt;/p&gt;




&lt;p&gt;Let's look at an example. Back when I was at Facebook on the messenger team we had a problem: implementing new message types required changes across our entire stack. Changes needed to happen across multiple layers of abstractions on both clients and the backend. It was a huge pain in the assÂ¹.&lt;/p&gt;

&lt;p&gt;Together with the help of several other engineers, I helped build a technology called XMAs (extensible message attachments). The result of building XMAs was that adding a new message type became as simple as making single, small change on the backend and a corresponding single, small change on each client.&lt;/p&gt;

&lt;p&gt;New types of messages that would've taken months to develop using a team of engineers could now be built in a week or two with a handful of engineers. The work my team and I did enabled easy development of new features, increasing developer productivity. We built out new rails.&lt;/p&gt;




&lt;p&gt;It's worth noting that we based our XMA technology off of another technology at Facebook, Story Attachments. The engineer who had built that was, in my opinion, working at higher level than a Senior Engineer. They had enabled engineers to enable even more engineers, further multiplying their effect.&lt;/p&gt;

&lt;p&gt;Think about some of the most esteemed engineers you know. The Kent Becks, the Dennis Ritches, the Grace Hoppers. What's the one thing they all have in common? They've enabled thousands of engineers to write better software.&lt;/p&gt;

&lt;p&gt;That's really what growing as an engineer is, enabling larger and larger amounts of engineers to do more work. So if you find yourself wondering how you can improve your abilities as an engineer, try asking yourself a different question: how can I enable other engineers to be better?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Kurtis Nusbaum is a Mobile and Backend Developer at Uber. He's an avid long distance runner and diversity advocate. Here's his &lt;a href="http://tinyletter.com/kurtis"&gt;mailing list&lt;/a&gt;. Here's his &lt;a href="https://twitter.com/klnusbaum"&gt;Twitter&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/knusbaum"&gt;LinkedIn&lt;/a&gt;. Here's his &lt;a href="https://github.com/klnusbaum"&gt;github&lt;/a&gt;. If Kurtis seems like the kind of guy with whom you'd like to work, shoot him an e-mail at &lt;a href="mailto:kcommiter@gmail.com"&gt;kcommiter@gmail.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Â¹ As a general rule of thumb, if something is a huge pain in the ass for you, two facts can be assumed: it's a pain in the ass for others, and creating a solution is highly leveraged work. Problems like these are ripe for the fixing and will most likely enable other engineers.&lt;/p&gt;


</description>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>career</category>
    </item>
  </channel>
</rss>
