#golang: The Next Great Teaching Language

The first few months spent learning a programming language are incredibly important. If a teacher finds the perfect balance of difficulty, creativity, and magic, she’ll reward her students with a beautiful skill. If the learning process becomes too difficult, however, the student might forsake programming, missing out on the opportunity of a lifetime. Thus, it’s paramount that a student’s first programming language provides an almost perfect experience: it should be easy to pick up for a complete novice, while also including a great purview of computing.

Many languages have spent time as academia’s favorite teaching language. For much of the 80’s and 90’s, a Lisp dialect, Scheme, was considered that language. It’s minimal syntax combined with excellent teaching materials (SICP) made it a favorite for many universities. In the late 90’s, Java took its place by introducing unparalleled portability, familiar C-like syntax, and wide applications. Many universities introduce students to programming with dynamic languages, such as Python. This is so that students are not bogged down with too much “low-level” work. My alma mater, Harvey Mudd College, hedges its bets by teaching all three languages in the first year of the computer science program. Today, we are starting to see a very viable competitor emerge.

In 2009, Google introduced the programming language Go, which promised compiled language performance and dynamic language productivity. In addition, the language has a serious pedigree: two of the co-creators are Rob Pike and Ken Thompson, who were heavily involved in the invention of the UTF-8 encoding and the Plan 9 operating system. Although Go was designed to solve computing problems of Google’s scale, it also introduces many key features that, in my opinion, make it suited to be the next great teaching language.

Minimal Syntax

Go has a minimal syntax. It is so minimal, in fact, that the entire specification of the language fits on a single web page. This makes a huge difference when teaching because students can learn the complete language quickly. When I was a sophomore in college learning C++, I never felt like I actually knew the language. After every lecture, we would learn another obscure C++ feature that only created confusion when it was actually time to program. New programming features take practice in order to learn correctly. If you shove too many of these in front of a novice, they’ll quickly become overwhelmed.

Static Typing

If you’re coming from a dynamic language background, static typing might seem tedious and unnecessary. As your program becomes larger and more complex, however, static typing becomes an indispensable aid for refactoring and determining correctness; the compiler becomes an asset. In dynamic programming languages, you depend on unit tests for assuring correctness throughout the development process. Although testing is still required in static languages, you can ignore a lot of boilerplate testing because the compiler will assure you that your code will execute correctly. This results in confident programming, of which new programmers need plenty.

Concurrent Programming

The end of Moore’s Law is approaching: we’re starting to reach physical limitations to how fast we can make our computer processors. Subsequently, vendors now scale out processor architectures over various cores. Taking advantage of modern multicore and multiprocessor hardware, however, is not easy: doing so involves refactoring existing code to either be thread or process aware—a considerable task for new programmers. Go abandons these traditional models and implements it’s own style of concurrency, using goroutines and channels. Goroutines and channels essentially function as lighter threads and queues. By providing these primitives as first class members of the language, concurrent programming feels like a natural extension of the language. By understanding these concepts, new programmers will be able to create modern and performant applications earlier.

Developer Tools

Developer tools are easy to ignore when learning a programming language. Tools such as profilers, formatters, race condition detectors, and documentation generators are not entirely critical when writing basic programs. They become essential very quickly, though. By bundling all of these tools with the standard distribution, Go provides all of the facilities necessary to jump into serious software development.

Comprehensive Standard Library

Out of the box, Go is suited for a wide variety of programming tasks. Everything from a web application to a database can be implemented without turning to third party libraries. This is advantageous because aspiring programmers do not have to concern themselves with the tedious task of finding and updating dependencies. In Go, a generally bug-free implementation of many common programming libraries is built-in. Since the implementations are tied to the language, you can depend on the interfaces to be stable long-term.

It Factor

Programming in Go feels right. The language feels well architected, and the libraries offer precise documentation and clean interfaces. I know that this is hard to explain and quantify, so I’ll leave it as an exercise to the reader to confirm. I have a feeling you’ll agree.

-David

Comments