DEV Community

Cover image for [Go, Book Review] Learn Go with Tests by Chris James
UponTheSky
UponTheSky

Posted on

[Go, Book Review] Learn Go with Tests by Chris James

*image credit to Renee French, the source is the one of the official Go blog posts

TL; DR

  • The book covers from the very basic concepts of the language to writing complex applications.
  • You learn Go interactively by writing tests.
  • This book is more than learning Go itself - you learn practical TDD methodology from the author.
  • Highly recommended for those who have just started learning Go, or the Software engineering in general.

Intro - why did I choose this book?

Since my painful memory of starting my Rust journey, I setup my own principle of learning a new programming language: begin with very simple tutorial, and write as many examples as possible before moving on to advanced cases.

Therefore, I was very fortunate to get to know this amazing book, Learn Go with Tests. Right after skimming through the tour, I was looking for a material that provides plenty of examples and good practices. The LGWT book exactly suits the needs.

Good Parts

1. Learning features of Go interactively with tests

This book starts from basic concepts of the language such as types, loops, pointers, interfaces, etc. But it also covers several advanced and frequently used concepts such as context and concurrency. The book provides a very good introduction to these difficult topics in general, with actual running examples as tests rather than with abstract words.

I would like to say that learning the language with writing test code is one of the best features of this book. Usually, learning a compile language like C/C++ or Rust requires users to run compilation commands, which usually takes a long time. However, by writing test and run it, you can actually check how a few lines of Go work right away. Even on my old 2017 MacBook Pro with 8GB RAM, running tests usually took around half a second.

Additionally, almost all the chapters of this book contain tests. Thus, as you read through the book, actually writing and running those tests, you will become much familiar with writing Go.

2. Rethinking of software design and tests

In the chapters of building an application, the author constantly bring up the idea of what is a good software design and how you can achieve it with the TDD principle. Except the chapters about Go language features, the book is more like a TDD and software design book with examples written in Go. The author gives his real-life stories from his long time of software engineering careers, and these are what normal software engineers usually face day to day. I was astonished how his stories and claims resonate with my own experience with bad software design and messy test code I had written in the past. If the TDD book by Kent Back can be thought of as a manifesto for TDD, this book is more like an anecdote from a senior engineer at the reader’s company.

Soso Parts

There are not particularly bad parts. Overall the book is well written and organized. Moreover, Since it is also an open-source material, many readers have contributed to the contents of the book(including a few of mine :)). I hope there are more books like this for other languages such as Rust or Python.

Conclusion

I highly recommend this book for Go newbies. It covers the language features extensively, and also provides practical code examples that you can run on your machine. You will also learn rigorous principles of writing maintainable and robust software with TDD by reading this book. Even if you’re an experienced Go developer, I am pretty sure you could learn important lessons from this book as well.

Top comments (0)