The Go Programming Language (Addison-Wesley Professional Computing Series) (英語) ペーパーバック – 2015/11/5
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
- The first chapter is a tutorial on the basic concepts of Go, introduced through programs for file I/O and text processing, simple graphics, and web clients and servers.
- Early chapters cover the structural elements of Go programs: syntax, control flow, data types, and the organization of a program into packages, files, and functions. The examples illustrate many packages from the standard library and show how to create new ones of your own. Later chapters explain the package mechanism in more detail, and how to build, test, and maintain projects using the go tool.
- The chapters on methods and interfaces introduce Go’s unconventional approach to object-oriented programming, in which methods can be declared on any type and interfaces are implicitly satisfied. They explain the key principles of encapsulation, composition, and substitutability using realistic examples.
- Two chapters on concurrency present in-depth approaches to this increasingly important topic. The first, which covers the basic mechanisms of goroutines and channels, illustrates the style known as communicating sequential processes for which Go is renowned. The second covers more traditional aspects of concurrency with shared variables. These chapters provide a solid foundation for programmers encountering concurrency for the first time.
- The final two chapters explore lower-level features of Go. One covers the art of metaprogramming using reflection. The other shows how to use the unsafe package to step outside the type system for special situations, and how to use the cgo tool to create Go bindings for C libraries.
The book features hundreds of interesting and practical examples of well-written Go code that cover the whole language, its most important packages, and a wide range of applications. Each chapter has exercises to test your understanding and explore extensions and alternatives. Source code is freely available for download from http://gopl.io/ and may be conveniently fetched, built, and installed using the go get command.
Alan A. A. Donovan is a member of Google’s Go team in New York. He holds computer science degrees from Cambridge and MIT and has been programming in industry since 1996. Since 2005, he has worked at Google on infrastructure projects and was the co-designer of its proprietary build system, Blaze. He has built many libraries and tools for static analysis of Go programs, including oracle, godoc -analysis, eg, and gorename.
Brian W. Kernighan is a professor in the Computer Science Department at Princeton University. He was a member of technical staff in the Computing Science Research Center at Bell Labs from 1969 until 2000, where he worked on languages and tools for Unix. He is the co-author of several books, including The C Programming Language, Second Edition (Prentice Hall, 1988), and The Practice of Programming (Addison-Wesley, 1999).
The examples in the book sometimes diverge into subjects that won't be of universal interest, such as overly deep dives into using Go to solve graphics and rendering problems. Also, the text is simply not concise enough.
I discovered that a combination of first working through the "Tour of Go", reading the Go blogposts by the experts in the field, finding answers on sites such as Go By Example and boards such as Stack Overflow, plus keeping a bookmark to the Go Packages documentation has worked really well for real-life professional coding. In this day and age, textbooks on programming languages are not always the best way to learn quickly.
In a pretty concise, yet readable reference, just like its predecessor, K&R, this is the essential book for your desk. I keep two books on my desk a copy of K&R ( The C Programming language for those not familiar) and this book, so not only are they the essential tools for understanding what ever you're coding, they have easy to remember names. What more can you ask for, yeah a bash reference, I hear ya.
Besides, what's Github for?
But not just that: it also helps get people into better coding habits.
Golang is a language based on best practices, and I feel I not only learned a new language this past Summer, but I also learned more about being a good programmer in general.
I would definitely consider using this language in bigger projects in the future, and I have already adopted several practices they listed across other languages I use.
The only things I am not a fan of with this language are the ways it implements public vs private data members and interfaces. I feel the variable name casing should not determine public or private members, because it is less explicit. I also did try a few things out, after reading, and I came across some nasty bugs that were not the easiest to track, due to the implicit interface implementation -- things would go from implementing part of my interface and not another to getting changed and implementing them in reverse, even with only the parts in question being changed; I would much rather say "implements x, y, z", and the compiler would know EXACTLY what I'm trying to do.
It also provides the most solid grounding for getting more deeply involved in the more complex areas of the language, which it introduces on a gradient, without getting too thoroughly involved in them.
I have a feeling that It would work reasonably well as a beginner's book, although you might want to make it the second book (or a follow up to the many free tutorials on-line) if you're brand new to programming. It could easily be a first Go book if you've produced even trivial programs in any other language. I highly recommend it to anyone who is not yet fully comfortable reading the language spec and standard library source code. And even if you are happy doing so, you're not going to be doing yourself any harm by reading this work.