<?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 John Murphy on Medium]]></title>
        <description><![CDATA[Stories by John Murphy on Medium]]></description>
        <link>https://medium.com/@murphybytes?source=rss-2ce2a92af867------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cl_lmmD0OimNjWRr.png</url>
            <title>Stories by John Murphy on Medium</title>
            <link>https://medium.com/@murphybytes?source=rss-2ce2a92af867------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:08:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@murphybytes/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[Go Big or Go Home
Learning the Go Programming Language]]></title>
            <link>https://medium.com/@murphybytes/go-big-or-go-home-learning-the-go-programming-language-14887c7c64d0?source=rss-2ce2a92af867------2</link>
            <guid isPermaLink="false">https://medium.com/p/14887c7c64d0</guid>
            <dc:creator><![CDATA[John Murphy]]></dc:creator>
            <pubDate>Mon, 22 Dec 2014 03:34:14 GMT</pubDate>
            <atom:updated>2016-04-19T03:01:28.011Z</atom:updated>
            <content:encoded><![CDATA[<p>There are several programming languages that I’ve been wanting to try for quite some time now. The languages I’ve considered are, in no particular order, Clojure, Rust, Go and Swift. I ruled out Swift right away because it seems like an Apple only language and I’d prefer not to use proprietary software. Clojure, I’ll probably come back to, but I don’t really want to tackle a functional language just now. That left Rust and Go. At first glance they seem very similar, but since Rust is still in beta, Go is what I picked to try.</p><p>When I first started using Go I thought it was missing some important features commonly found in other computer languages. There is no structured exception handling. There is only one looping control structure instead of several. Go does not have data hiding features at least not in the classical object oriented sense. What I’ve found with use is that the spare features in Go make it a very easy language to learn and don’t limit its expressiveness or capability. Go seems to have a design philosophy analogous to modernist architecture, form follows function, with no extraneous features. I find this results in a language which is efficient, simple and elegant.</p><p>I’m most excited about the way that Go implements concurrency. The traditional way of handling concurrency in languages like C++ and Java is to use threads. I’ve spent a lot of my career writing multi-threaded code. Dealing with shared data and communication between threads can be nightmarish. Go doesn’t use threads, it uses <a href="http://golang.org/doc/effective_go.html#goroutines"><em>goroutines</em></a>. A goroutine is a function that is capable of running concurrently with other functions. They are extremely simple to invoke and very inexpensive to create, requiring only a 8kb of stack space. Goroutines are managed by the Go runtime which multiplexes multiple goroutines with a small number of threads. What this means is that you achieve concurrency without the overhead of swapping CPU cache between cores as threads are pre-empted by the operating system. Krishna Sundarram’s excellent blog post, <a href="http://blog.nindalf.com/how-goroutines-work/">How Goroutines Work</a>, has more details of how this is accomplished. I’ve read some criticism of the Go language execution speed being slower than that of Java but I think efficient concurrency is where Go really shows great potential compared to other languages, especially in terms of it’s ability to do computational work in situations where a problem is highly parallelable.</p><p>Go side-steps the issue of data synchronization by eliminating it entirely. By doing so, Go eliminates a whole class of bugs having to do with data consistency and locking issues. Go doesn’t rely on traditional constructs such as mutexes and the like. It uses something called <a href="http://golang.org/doc/effective_go.html#channels"><em>channels</em></a> to pass information between goroutines via messaging, eliminating shared data consistency and locking problems. Channels also provide useful features like being able to type messages, define the direction that messages can flow in a channel, and buffering.</p><p>One of the few things I liked about C++ was that it provided the ability to guarantee that dynamically allocated resources would be released by calling the clean up code for the resource in an object’s destructor. If the object was allocated on the stack the OS would always call the destructor when the stack was released thereby releasing the dynamic resource. This provided a way to avoid problems like memory leaks and other kinds of resource exhaustion. Go provides similar capability with the <a href="http://golang.org/doc/effective_go.html#defer"><em>defer</em></a><em> </em>keyword. Prefacing a function call with the defer keyword schedules the deferred function to be called when the current function, i.e. the function containing the deferred function exits. With just one line of code you can guarantee a resource will be released just like you can in C++, but with a lot less work.</p><p>Go provides a built in test framework that I found intuitive and easy to use. I also liked how the Go designers chose not to include most object oriented features, only relying on interfaces and data structures which may or may not have methods associated with them. There isn’t any inheritance or data hiding. Interfaces provide a contract that certain types of behaviors must be implemented by a data structure passed to a function. I think that these design choices make it easier for the developer to write clean, easy to understand code.</p><p>The one thing that I did not like about Go was the lack of a decent debugger. <a href="https://golang.org/doc/gdb">Here</a> is the documentation for debugging Go code using GDB, which they admit doesn’t work. In my experience even some of the things that they imply do work by including it in their documentation, don’t. For example, on my machine, simply printing the value of a variable causes your program to crash. I hope that they choose to address the lack of a debugger in the future.</p><p>In summary, Go is very different than languages than those I’m used to like Ruby or Java. It seemed to me as if the Go designers went back to fundamentals and by doing so eliminated much of the feature bloat that has made languages like Java so unpleasant to use. I found Go easy to learn and easy to use. I think that compute intensive, highly parallel problems are great candidates for Go because of it’s concurrency features. It’s definitely going to be my language of choice for these sorts of problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14887c7c64d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>