NodeJS || Golang

With Obvious Bias

By Bryan Moyles / TelTech Systems

What is NodeJS?

NodeJS is a software platform that leverages Javascript as a server-side language to build scalable networking applications in a single-threaded event loop.

What is Golang?

Golang is a language recently developed in 2007 by Google to overcome obstacles inherited by other languages with concurrency being a central component.

What I'd Like To Show

This discussion focuses on every day usage of NodeJS vs Golang. We will not be submitting fancy benchmarking reports or suggesting any performance benefits of one over the other.

Point #1

NodeJS is notoriously known for its "callback hell" for ALL I/O operations, causing the developer to think in a new way with how to handle typical sequential programming.

To show the point, let's ping Google, then Yahoo, then MSN.

NodeJS Sequential

Golang Sequential

Redeeming Factor

NodeJS Seq

Seq is a library intended to help make NodeJS a little more "intuitive" for sequential programming.

Point #2

Simultaneously performing a non-blocking operation with a blocking operation in NodeJS is impossible!

This breaks every fundamental paradigm of NodeJS running on a single thread.

NodeJS Async & Blocking

Golang Async & Blocking

Redeeming Factor

NodeJS Child Process

As ugly as this is, it is a "redeeming" factor if you REALLY need to do what we just covered.

Point #3

Multi I/O operation timeout using the first response for "efficiency". Asynchronously ping multiple endpoints and use the first response, timing out after 2.5 seconds.

NodeJS First Of

Golang First Of

Point #4

Classes in NodeJS are a band-aid topic through prototype inheritance. While classes don't exist in Go, interfaces are implicitly satisfied when a struct implements all methods.

NodeJS "Classes"

Golang "Classes"

Redeeming Factor

I personally believe that prototyping is great for simple objects, but once you stretch out and start getting comfortable, prototyping becomes very clunky.

Side-note For Golang

Golang does not come with explicit inits or constructs as you would typically define in other languages. You have to create factory functions that create structs on their own.

Reasons For NodeJS

  • Non-existent learning curve
  • Strong community and great libraries
  • Large pool of developers

Reasons For Golang

  • Incredibly Simple Concurrency
  • Growing community and great libraries
  • Large pool of developers

Adoption Trend

Q & A

By Bryan Moyles / TelTech Systems
{ We're Hiring! }