Feeds

Google Go boldly goes where no code has gone before

How to build all the Google stuff Google won't talk about

The Power of One Brief: Top reasons to choose HP BladeSystem

The New Node?

Open sourced less than two years ago, Go isn't widely used. Besides Heroku – a Silicon Valley darling recently purchased by Salesforce.com – the only big name programming with the service, at least publicly, is Canonical. But given its characteristics – and its pedigree – Go has the potential to reach an audience beyond even the systems-programming set.

In Silicon Valley, the platform of the moment is Node.js, a means of coding server-side applications in JavaScript. An "event-driven" system, Node is billed as an ideal way of building internet applications that involve heavy I/O. But both Pike and Gerrand argue that such applications are better served with Go, whose concurrency setup can also provide parallelism.

"[Node.js is] a single thread. In a very similar amount of code, you could write a goroutine-heavy server that could handle tens of thousands of requests and use all the cores on your machine, so that if the requests were expensive – if they were CPU-intensive – you'd have a chance of keeping up," Pike says.

"Node.js shows great numbers for heavy numbers of clients, and they've done a really good job. But if those clients are CPU-intensive, they've got no place to go. You can't get the parallelism you need. With Go, you get the best of both worlds: You get many clients easily handled, and if they're CPU intensive, you can imagine scaling to a much larger number of requests."

What's more, Gerrand argues, Go doesn't force developers to embrace the asynchronous ways of event-driven programming. "With goroutines and channels, you can say 'I'm going to send a message to another goroutine or wait for a message from another goroutine', but you don't have to actually leave the function you're in to do that," Gerrand says. "That lets you write asynchronous code in a synchronous style. As people, we're much better suited to writing about things in a synchronous style."

Gerrand argues there's a "huge market" for using Go as a back-end web language. "There's a lot of hype about Node.js, but I think that Go actually solves a lot of the problems that Node does, but in a more holistic sense."

Of course, Node has a certain advantage simply because it uses JavaScript, which is already so widely used on the front end. Coders may need some time to adjust to the event-loop arrangement, but the language itself is no leap forward. "JavaScript is a familiar language to a whole generation of developers," Node creator Ryan Dahl tells us. "The ability to apply an existing programming language to the domain of writing servers goes a long way towards being 'easy'." He also points out that although the Node runtime doesn't provide parallel execution, if you like, you can take advantage of the parallelism in the operating system, "pre-forking" the Node server.

There's a familiarity to Go as well. The syntax looks like C, so if you have history with C, or C++, or Java, you can pick up the basics rather quickly. Grasping the concurrency may take a little longer, even if you're experience with something like Erlang – "the concept's a bit difficult to grasp if you've never been exposed to message-passing inside of a program before," says Brian Ketelsen – but Gerrand says that during workshops he has seen programmers with no Go experience write concurrent programs in a matter of minutes.

Go Fibonacci Closure

Go Fibonacci Closure

According to many developers we spoke to, Go has that certain something that makes it suited to almost anything. Gerrand says Google employees are using it to simply grab information from servers. "Google has people who administer apps and services, and they need to, say, write tools that say scrape a few thousand machines statuses and aggregate the data," he says. "Previously, these operations people would write these in Python, but they're finding that Go is much faster in terms of performance and time to actually write the code."

Programmer Charles Thompson uses Go for scripting. And Michael Hoise, another independent developer, has built a Facebook application with the language. The app is called SmartTweets, and he built it just to explore the ins and outs of Go. But it now has over 120,000 users. "It's a stable language," he says. "It can handle the load."

Pike – and others – wouldn't mind seeing Go on Android. "It was built for servers and stuff like that, but one of the surprises was that the design of the language made it really nice for general purpose programming," Pike says. "It's been used for scripting, for user-interface code, for graphics – just about anything."

Programming purists take issue with the language. It's not as "beautiful" as they would like. It makes those "compromises" Pike speaks of. But some believe those compromises aren't compromises at all. "I like a lot of the design decisions they made in the language," says Martin Odersky, the creator of Scala, the language does concurrency atop the Java virtual machine and remade the Twitter back end. "Basically, I like all of them." ®

Securing Web Applications Made Simple and Scalable

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Apple fanbois SCREAM as update BRICKS their Macbook Airs
Ragegasm spills over as firmware upgrade kills machines
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
Captain Kirk sets phaser to SLAUGHTER after trying new Facebook app
William Shatner less-than-impressed by Zuck's celebrity-only app
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
prev story

Whitepapers

Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Reducing security risks from open source software
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.