Google’s new programming language, called Go, took the application development world by storm when the search giant released it Nov. 10.
The ambitious technology comes with a pedigree featuring programming experts from the Unix world, including Ken Thompson, who teamed with Dennis Ritchie to create Unix. Created as a systems programming language to help speed up development of systems inside Google, Go is now viewed as a general-purpose language for Web development, mobile development, addressing parallelism and a lot more.
Ironically, Google launched Go just a week before Microsoft’s Professional Developers Conference, which typically dominates the software development landscape while it is running. This time there might be a little Go buzz at the event.
Go is an experimental language that is still in the process of being tweaked and maturing, but it holds huge potential. The Google Go team blogged about Go, saying, “Go combines the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. Typical builds feel instantaneous; even large binaries compile in just a few seconds. And the compiled code runs close to the speed of C.”
Moreover, having released Go as an open-source effort, Google is opening up the ongoing development of the language to the community at large. Will it be the next big thing? Could it supplant Java? Rob Pike, one of the three founders of the Go project, spoke with eWEEK about the overall effort. Here are 12 things to know about Go.
1. Where did the idea for Go come from?
““In Google we have very large software systems and we spent so long literally waiting for compilations, even though we have distributed compilation and parallelism in all of these tools to help, it can take a very long time to build a program. Even incremental builds can be slow. And we looked at this and realized many of the reasons for that are just fundamental in working in languages like C and C++, and we needed a different approach. We also decided the tools that everybody used were also slow. So we wanted to start from scratch to write the kind of programs we need to write here at Google in a way that the tools could be really efficient and the build cycles could be very short.” “
2. Go is a multipurpose language
Pike said Go is appropriate for a broad spectrum of uses, including Web programming, mobile programming and systems programming. “We based it on our ideas of what we think systems programming should be like,” he said.
Then a Google engineer told the team he wanted to do a port to ARM processors for the Go language because he wanted to do some work in robotics. With the ARM support, “We can now run Go code in Android phones, which is a pretty exciting possibility,” Pike said. “Of course, ARMs also run inside a lot of the other phones out there, so maybe it’s a mobile language.”
Taking Advantage of a New Modern Language
3. Will Go be the next big thing in programming?
Asked whether he thought Go might be the next big thing, Pike replied, “I’d be thrilled if that happened, but I don’t expect it.”
He added that he hopes the language will grow on its own merits. Then Pike noted a significant difference between Go and Java.
“It’s not a Google official language the way that, say, Java was a Sun [Microsystems] official language,” Pike said. “We’re really launching this as an open-source experimental toy for people to play with. It needs time … to become something that people would want to build companies around or anything like that. It may never get there. But, so far, the response has been really positive.”
4. Google’s Go owes some debt to BellLabs’ Plan 9
Plan 9 is a distributed operating system developed as the research successor to Unix at Bell Labs. Pike and Thompson were part of the original Plan 9 team at Bell Labs. And Go team member Russ Cox also was a Plan 9 developer.
Although there was not a lot of direct use of Plan 9 technology in creating Go, the link between team members is not the only connection.
The Plan 9 team produced some programming languages of its own, such as Alef and Limbo, which had a slight impact on the direction of Go. “We didn’t pull out those languages and look at them again,” Pike said. “But I think a better way to express it is that, particularly on the concurrency side of things–the parallel programming side of things–those languages are kind of in the same family tree and inspired by the same approach.”
Pike added, “Ken’s compiler is entirely new … it uses the Plan 9 compiler suite, linker and assembler, but the Go compiler is all new. So we borrowed a little technology, but that’s just the compiler, that’s not the vision. And naturally some of the people working on the project were around from the Plan 9 days, so there’s got to be some intellectual cross-breeding there. But this wasn’t an attempt to do a Plan 9. This is a language, not an operating system, and they address different things. Go doesn’t even have a Plan 9 port at this point, although it would be nice to have one.”
5. Seven engineers join Google’s Go team
Pike and Griesemer were officemates who groused about the problems with programming. Once they decided to try to create a language they invited Thompson to join, because “Ken really understands how to make things go fast and has really good ideas about things … and besides he was in the next office. And in about 5 minutes we decided the three of us could really make something happen.”
A Google Development Team Comes Together
Meanwhile, another Google engineer, Ian Taylor, saw the draft specification for the language and told the trio he had written a GCC front end for it. So he joined the team. Russ Cox joined about a year ago. And in the last couple of months another Google engineer named Adam Langley joined the team and has been helping out with a lot of library work and getting an SSL (Secure Sockets Layer) implementation in native Go, Pike said. Jini Kim is the product manager for Go and organized many aspects of the launch.
6. How Go speeds up development
“One of the big problems with development that sounds very uninteresting and unsexy [is] maintaining the dependencies–what you need to build first in order to build this thing you’re trying to build now, such as the libraries, the packages, layers of software,” Pike said. “And languages like C++ and C in particular make it very hard to guarantee that you’re not building anything that you don’t need to. And we’ve investigated this in some detail and found that it’s a huge reason, almost the dominant reason why build times are so slow for large C++ applications.
“So one of the things we did with Go is we are very rigid about dependency specification. And the language actually yells if you try to pull in a dependency you don’t actually use. This guarantees a minimal tree and that really helps the build. And there’s one more very technical thing that is really important and that’s the idea that we pull the dependency information up the tree as we go so that you only look at anything once. You never compile anything more than once when you’re doing a build. And that’s a huge improvement in performance relative to the normal C family of languages.”
On this point, Pike also said, “The languages people use for building large software systems nowadays are typically languages like C++ and Java, which were designed pretty much a generation ago in terms of programming abilities and understanding. And they’re not aging very well. And we realize that there are things like the advent of multicore processing and the dominance of cluster computing and things like that really needed a rethink at the language level. So we tried to bring in some of our background in distributed systems and concurrent programming and stuff like that.”
7. Google Go has an unusual type system
Pike said some have described Go as object-oriented programming without objects. Instead of having a notion of a class and then defining all the methods for that class and then subclassing and so on, Go is much more orthogonal, he said.
“You write down the types as storage buckets that implement things,” Pike said. “And then you can have what we call interfaces, which are pure abstractions about behaviors of those things. And when you want to write a program that needs something like a ‘write’ or a ‘sort’ you just say I need something that knows how to write or that knows how to sort. You don’t have to explicitly define a subclass of something from a sorting interface and build it down. It’s all sort of much more compiler-derived instead of programmer-specified. And a smaller point, but it matters to some of us is that you can put a method, in the object-oriented sense, in any type in the system.”
Putting All the Parts Together
Moreover, in Go the type system is fully statically typed, Pike said. “In the sense that, let’s say, going back to the sorting idea … At compile time you know that everything coming in can implement the sorting interface or it would not statically compile,” he said. “But there is dynamic type information under the covers that programs can use to do interesting things. So it’s a statically typed language with a little bit of polymorphism mixed in. That’s the best way to say it.”
8. Google builds Go to support concurrency
Although most of the larger machines delivered today have multiple cores inside them, the common programming languages that are out there don’t really have enough support for using those cores efficiently, Pike said.
Developers can find libraries to help with this, “but they’re very difficult to use and the primitives are fairly clumsy,” he added. “One of our goals in Go was to make a language that could use those processors well, particularly for the kind of server-side programming that we do here at Google where you have many client requests coming into a machine that’s multiplexing them. And Go is a really good language for writing multiplex servers in, where you use these things called ‘go’ routines, which are kind of like threads but lighter-weight, and some communication primitives to do the multiplexing.”
In fact, the Golang.org Website is written in Go and is doing exactly that, Pike said.
“It’s a parallel Web server with multiple internal threads of control for each client request that comes in,” he said. “And it works really well. It seems to be a good way to go. We haven’t built it at the kind of scale we need yet to say this is definitely the way to go. And there’s definitely some more library support needed for things like scheduling and so on. But from a starting point it’s a really good place to be.”
9. In terms of programming languages, Google Go is most like…
Rather than viewing Go as competing with other languages for developer attention, Pike said he thinks Go simply provides an alternative.
Moreover, he said he thinks programmers who are used to developing systems software and are used to languages like C and C++ and Java will find Go interesting because of the different take it has.
10. To thrive, Google Go needs to sprout an ecosystem
Pike said he “hopes” that the language will generate an ecosystem. However, “This is a kind of skunkworks project,” he said. “We put out what we’ve got so far, but one of the big reasons we did that is we want people to help us expand it and put in support for the Windows operating system and also help us develop tools such as IDEs [integrated development environments] and things like that.
As an open-source project I think it will develop an IDE and an ecosystem, as it seems to be really well received. But I really can’t predict how big that ecosystem will get. We’d certainly love to see it thrive.”
Scratch Google Go, Find Open Source
11. Google Go is open source to the bone
Pike said he believes that part of the advantage of Go being totally open source is the community can help generate an ecosystem. “If the community gets excited and starts building up the ecosystem it will grow and thrive on its own,” he said. Regarding the Go language Website, Pike noted that it is not Google-branded. “It’s a different Website,” he said. “We’re happy it’s from Google and we’re going to use it internally for a lot of our stuff, we hope. But it really is an open-source project and we want the community to help us make something happen.”
Also, in a nod to the openness of the Go language and the might of the Eclipse open-source development platform, Pike said, “I would love to see Eclipse support Go. We’ve talked about that for probably a year now, but we haven’t gotten anyone to do the work. It’s a fair bit of effort to make a proper plug-in for Eclipse.”
In response, Ian Skerrett, director of marketing at the Eclipse Foundation, told eWEEK: “I think it would be great to see a Go plug-in for Eclipse. Eclipse has support for lots of languages, including some of the ‘newer’ ones like Scala, Groovy [and] Ruby, so adding Go would make sense. It will really depend on people in the Go community seeing the need and creating the plug-in.”
12. Next steps for Google Go
Regarding what the Go team plans to do in the near term, Pike said:
“We’ve got a few language features that we’ve been batting around for awhile that we’d like to continue to bat around and see if we can make them fit–things like … [for example,] union types is something that we think we have a good handle on that we haven’t had time to implement. The run-time needs a fair bit of development. The garbage collector works just fine but it’s not robust or efficient enough to be a practical solution for a large-scale server. We’re very conscious of that. But there’s some very clever work at IBM that’s been published that we think we can use to guide a much better garbage collector. I think we can solve that problem well. And once we do we’ll have achieved something really nice, which is a native compiled language with garbage collection that works well in a systems environment.
“Java suffered quite a bit from that and we’re very aware of the issues that garbage collection and systems programming have. You tend to worry about pauses where the garbage collector is running. We have to make sure we don’t introduce those. Those are the big things that we’re thinking about. But we also need a lot of tools. We need a debugger, and then second-order things like IDEs and ports to Windows and other operating systems.”