Feeds

Google Go boldly goes where no code has gone before

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

Providing a secure and efficient Helpdesk

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." ®

Internet Security Threat Report 2014

More from The Register

next story
Microsoft on the Threshold of a new name for Windows next week
Rebranded OS reportedly set to be flung open by Redmond
SMASH the Bash bug! Apple and Red Hat scramble for patch batches
'Applying multiple security updates is extremely difficult'
Business is back, baby! Hasta la VISTA, Win 8... Oh, yeah, Windows 9
Forget touchscreen millennials, Microsoft goes for mouse crowd
Apple: SO sorry for the iOS 8.0.1 UPDATE BUNGLE HORROR
Apple kills 'upgrade'. Hey, Microsoft. You sure you want to be like these guys?
ARM gives Internet of Things a piece of its mind – the Cortex-M7
32-bit core packs some DSP for VIP IoT CPU LOL
Lotus Notes inventor Ozzie invents app to talk to people on your phone
Imagine that. Startup floats with voice collab app for Win iPhone
prev story

Whitepapers

Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.
Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.