Shared publicly  - 
 
Teaching Distributed Systems using Go:

My Google friends might be (amused? scared? delighted?) to know that we're re-doing the assignments for the ugrad Distributed Systems course (15-440) in Go.

The good:
* Eliminates a lot of boilerplate cruft compared to Java;
* Less grungy crap compared to doing the assignments in C++ (students used to spend a lot of time debugging data structures or learning the STL, which is not what I wanted them to be learning -- I wanted their brains to hurt thinking about consistency protocols, not hash tables).
* Easily switches between lower-level system calls (UDP sends, etc.) and really high-level functionality (they marshal / unmmarshal using JSON, which is one function call away).

The bad:
* Weird new language to learn...
* Potentially less industrially useful than C++
* The language is new (one bug report filed thus far), and it and its tools are still evolving rapidly.


From my view so far, it's awesome, but I'll know more on Thursday when the first project checkpoint is due. I'll let you know if I turned out to be completely insane.
43
26
Jeremy Wall's profile photoGrace Shindhelm's profile photoRamakrishna Reddy Kunreddy's profile photoНиколай Алещанов's profile photo
25 comments
 
You forgot "Shares a name with a geeky board game that can confuse people."
 
Which means you should have been teaching distributed systems in ML for at least 20 years now.
 
It's an interesting experiment. But honestly, I don't agree with any of your "Pro" points for using Go.
 
+Robert Harper , I'm shocked, shocked to hear you say that. :-) :-)

+Niraj Tolia I did. The thing that really sold me on Go was the CSP-like channels. Strongly typed communication channels between myriad lightweight threads makes for awesome flexibility in structuring system design. I like Scala's mix of functional and otherwise, but in all, it didn't feel like it really changed the way I would think about systems programming. Go did.
 
+jinyang li , you mean you don't consider them good enough, or you don't agree that Go, e.g., lets you mix low and high level constructs easily? (The latter seems to be a matter of fact, not opinion... :).
 
I don't see why that is a big plus for using a new language. :)
But I guess I should do some of your assignments to see the advantages.

Have you thought about Erlang? It's supposedly a language designed for building distributed systems.
 
Erlang provides a lot of the same advantages that Go does. It was on my shortlist. I ended up choosing Go because I felt like it offered a better mix of the familiar (C-like) and Erlang's support for concurrency and distributed programming.

Look at the LSP portion of project 1. Goroutines and channels make it surprisingly straightforward to build a protocol module (with its own timers, buffers, etc.) that you link into an application (also with its own timers, threads, stuff happening, etc.).
 
Seems that you are really picking Go for its CSP programming style then. How easily can Go programs be debugged?
 
It's like C++, approximately. The stack traces are ugly; logging a lot is probably the best bet. In general, I've found it a little easier to write working code in Go than in C++ as far as avoiding nasty corner cases, and found it impossible to match C++'s performance if I really, really put my mind to optimizing things.
 
As someone who will work with your future students, I would like them to learn how to use the STL and debug data structures. Hopefully they pick that up in a differenet course.
 
+David Andersen I've been meaning to learn Go. Do you have any book or PDF suggestions?
 
Are you using gccgo, or the 6g/8g compilers? Interested to hear about your experience. BTW, Scala in combination with Akka gives your Erlang style actors.
 
+Pat Gunn , no good books. There are some PDFs out there, but I haven't tried any of them. My suggestion is to work through some of the examples in the learning go section of the website (and then do the 15-440 assignment, it's kind of fun. :-).

+Diwaker Gupta , 6g. I haven't tried gccgo for a while, but the last time I did it seemed to have problems in a lot of the areas that I think Go is cool - using 1 pthread per goroutine, for example, which really changes the way you think about goroutines. One of these days I hope to awaken to find something with 6g's "go-ness" and gcc or llvm's optimizer.

+Frank Dabek , I hear you on that. Is not knowing C++/STL a show stopper in your book? Like MIT, our students aren't guaranteed to encounter C++ itself (but they've hit C and Java and ml). I'm hoping that the Go decision balances out well overall, "potential employer happiness" is on my list, just not at the top of the priority stack.

Note that they've had a ton of data structure debugging before in a variety of their courses, in ml, C, and probably Java. Easy datastructures through mind-twistingly complex DS and algos. Just not in C++/STL. I figure it really only saves a few months of the learning curve, which is why the C++ emphasis is lower on my list than having a good language for learning distributed systems programming in general.
 
Not a show-stopper for me: it's just annoying to have to teach each new batch of engineers that map<> is actually a red-black tree.

On the other hand, I have seen candidates rejected because they got a coding question, tried to use the STL, and botched it. It gives the impression of "don't know how to code."
 
Re: "my google friends might be..." If you ask ten of them, you'll probably get ten different opinions.

Re: C++ experience being useful in industry, I can't imagine anyone is going to graduate from your program knowing only Go. Given that, I think the broadening experience is more valuable than the additional practice with C++.
 
Learning more weird languages is actually good. It's a multi-language world out there - the ability to pick up new ones quickly is way more important than slightly deeper knowledge in a specific one. As for the industrial usefulness of C++ purely learned in college, without any personal side projects... Let's not go there :)

In general, if a college course has the choice between teaching a bit of vocational skills and exposure to new ideas, I strongly hope for the latter. The former part is better learned via internships/apprenticeships.
 
+Frank Müller Mein Deutsch ist nicht perfekt, aber ich kann Deutsch lesen (Ich studierte Deutsch 4 Jahre lang im "High School"). Danke. Ist das PDF "unencumbered"?
Translate
 
+Pat Gunn Ah, sehr gut. (smile) The content samples are pure PDF, but I sadly don't know details about the eBook. But it is a PDF too, yes.
 
+Sameer Ajmani This is ridiculously polished and awesome, even on first glance. Bravo! And thanks.
Add a comment...