The Go Programming Language

Author: Alan A. A. Donovan and Brian W. Kernighan
Publisher: Addison Wesley
Pages:400
ISBN: 978-0134190440
Print: 0134190440
Kindle: B0184N7WWS
Audience: Programmers
Rating: 4
Reviewer: Harry Fairhead

Can Brian Kenighan do for Go what he did for C?

Brian W. Kernighan wrote the classic guide to C, back in the days when it was a new language, co-authoring it with Dennis Richie one of C's creators. There is a lot about Go that is similar to C, and indeed this book has similarities to the classic "The C Programming Language" beyond the form of the title. It has a concise presentation, but not quite as concise as the classic C book, and I found myself wondering if it is a difference in the languages. It has a slower pace and there is a lot more to read.

"The Go Programming Language" also isn't aimed at the complete beginner. The aspects of the language are introduced as if the reader was a knowledgeable programmer in some other language and just wanted to get the facts of Go sorted out. The examples are often very math and science based - Lissajous figures, Mandelbrot sets and so on.  

Banner

The book starts off with a tutorial tour of Go as a language. It covers command line arguments, creating animated GIF and fetching URLs and even implementing a simple web server. Of course these things have more to do with using the Go libraries than the details of the language itself.

After this the book goes though the standard sequence needed to document a language:

Chapter 2 Program Structure

Chapter 3 Data Types

Chapter 4 Composite Types

Chapter 5 Functions

 

 

The book takes a step up in abstraction at Chapter 6 Methods when it explains how object -orientation works in Go - some might argue that Go isn't object oriented but the way that it associates functions with particular data types is a core concept in object programming.

Chapter 7 Interfaces has some big examples - expression evaluator and a token based XML decoder.

Chapters 8 and 9 describe Go's approach to concurrent programming - goroutines and channels. Here we meet some of the difficulties of concurrent programming in any language - race conditions, mutex and so on.

Chapter 10 explains packages and the Go Tool; Chapter 11 does the same for the Go test tool. The penultimate chapter explains reflection and some meta programming techniques.

The final chapter is where all the bodies are buried. It is a discussion of low level programming - unsafe code, memory layout and calling C code from Go. This is the sort of coding you hope that Go can keep you away from, but for some tasks it is probably still unavoidable.

Conclusion

This book was easy to read but I couldn't avoid a comparison with the original classic K&R book on C. I learned C from the K&R book and I did it over a weekend. I might not have instantly acquired all of the techniques I would learn about in the years to come, but after reading it I was happy that I could program fairly well in C. It was the almost instant transformation to a C programmer that made the book remarkable. Of course it might have just been that the language was built right.

I can't say that this particular book has transformed me overnight into a Go programmer in anything like the same way. It is concise, but there is so much more to say and it spends a lot of time dealing with the rough edges of the language. After reading it you can probably write Go programs, but probably not with confidence - there is too much to remember.

Another problem is that the book doesn't really sell the idea of working with Go. It doesn't explain why Go's approach is so much better, in fact it hardly points out what is special about Go at all. As Go's selling points are not self-evident, this is a failing. I also have to warn you that Go has moved on since the book was written and there are some new features which are ignored - not a big problem but you need to know.

It is a good book, but not up to the standard of K&R.

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Embracing Modern C++ Safely

Author: Dr. John Lakos, Vittorio Romeo, Dr. Rostislav Khlebnikov and  Alisdair Meredith
Publisher: Addison-Wesley
Date: December 2021
Pages: 1376
ISBN: 978-0137380350
Print: 0137380356
Kindle: B09HTFQB92
Audience: C++ developers
Rating: 4
Reviewer: Harry Fairhead
Writing safe C++ - sounds essential

 [ ... ]



Reliable Source: Lessons from a Life in Software Engineering

Author: James Bonang
Date: January 2022
Pages: 608
Kindle: B09QCBVJ9V
Audience: General interest
Rating: 5
Reviewer: Kay Ewbank

This book combines a fun read with interesting insights into how to write reliable programs.


More Reviews

Related Articles

A Programmer's Guide To Go With LiteIDE

A Programmer's Guide To Go Part 2 - Objects And Interfaces

A Programmer's Guide To Go Part 3 - Goroutines And Concurrency

Getting started with Google's Go

Last Updated ( Tuesday, 05 December 2017 )