This is a creation in Article, where the information may have evolved or changed.
Summary: This article is compiled from Google chief engineer Rob Pike's speech slide, mainly on the part of Go design principles and intentions, but also refers to the use of the go language in and outside of Google's application status. But the purpose of this article is more about software engineering than programming language design, more precisely how to design a programming language to help software engineering.
Preface: About Go
The go language is an open source, concurrent, efficient, simple, fun (but probably boring for some people) programming language that supports garbage collection (GC) and is very scalable. Go was developed from the end of 2007 by Robert Griesemer, Rob Pike, Ken Thompson, and later joined Ian Lance Taylor, Russ Cox, and eventually open source in November 2009, A stable version of Go 1 was released earlier in 2012. Now the go development is completely open and has an active community.
Go was originally developed to solve Google's problems, knowing that Google faces a lot of big problems. Google's servers are mostly written in C + +, plus a lot of Java, Python code. In addition, Google also has thousands of engineers, countless lines of code, a huge distributed build system, and countless machines (which we think are relative to a medium-sized cluster). Google's development can be slow, even clumsy, but it's always effective.
So there's no doubt that Go's support for "big hardware" is very good, and it's also suitable for "big software" development. CSDN also compiled a batch of Rob Pike's articles--go the father of language to go: The Boulevard to Jane, where Rob describes the origins and original purpose of Go's creation.
Why should I use go?
Go is designed to help people read, debug, and maintain large software systems, so the goal is
- No longer slow
- No longer clumsy.
- Increase efficiency
- Maintain (or even promote) extensibility
However, in the case of C + + or Java development, you often encounter various problems:
- Slow build
- Dependency is difficult to control
- Each programming language uses a different subset of languages
- The program is difficult to understand (documents, etc.)
- Repeat work
- High cost of updates
- Version crossover
- Automation inconvenient (tool problem)
- Cross-language building
The go language is designed to solve these problems.
In addition, C language dependence has always been a big problem, including dependency overlay, compile-time dependency on the situation is difficult to deal with, and you can not find out which dependencies are deleted, those can not. In C + +, this becomes more apparent:
- There are # include files in each class
- #include文件中有代码 (and not just declarations)
- #ifndef的残留
So it's not possible to build large Google binaries on a single machine. (To build a large Google binary in a single computer is impractical.)
Of course, the tools did help, so the following improvements were made:
- A new distributed building system
- Makefile is no longer needed (but still uses the build file)
- Multi-cache
- Multi-level complexity (the large program itself has)
Even with the help of Google's distributed build system, large construction projects still take time (for example, in one of the binaries, it took 45 minutes and now 27 minutes in 2007 years). The quality of life is still too low.
Into the Go language
We all want to have a higher quality of life, so we have to solve these problems, so we have the original idea:
- Must be extensible
- Ideal for large programs, large teams, and applications with a lot of dependencies
- Must be accessible, such as near the C language.
- Modernization
- Suitable for multi-core machines
- Suitable for network machines
- For web development
The go language is designed with software engineering as its goal, so it has these advantages:
- A clear Reliance
- A clear grammar
- Clarity of semantics
- Simple model (garbage collection and concurrency)
- Convenient tools (Go tool, Gofmt, Godoc, Gofix, etc.)
And those questions?
The biggest problem with the go language is that there is not enough experience to prove that go is really a successful product and lacks large-scale application practices. But inside Google, such as golang.org, YouTube.com, dl.google.com have started to use go language development, in addition to some other small applications (some on the Gae) also choose to use go, but outside of Google, the BBC Worldwide, Canonical, Heroku, Nokia, SoundCloud are also trying to go.
All in all, go is a programming language driven by software engineering, but it's productive and interesting, and the design is very productive.
The slide of Rob Pike's speech can be seen here.