If you’re developing a web application, you might have heard of Node.JS and Golang (also known as “Go”). Both are gaining popularity, but in very different ways, and for very different reasons. They are part of a movement away from traditional server-side languages such as PHP and Java. Let’s take a look at what they are and how they compare.
What is Node.JS?
What is Golang (Go)?
According to the Go home page:
“Go is an open-source programming language that makes it easy to build simple, reliable, and efficient software”
Download Our Project Specification Template
It’s relatively new and developed by Google, so you know it’s going to be good. Rather than being an evolutionary language, the creators have done a complete rethink of programming. They’ve gone all the way back to the first-principles of C and built from there.
This has resulted in Go has some very unique properties. The most important is a simple and effective way of dealing with concurrent programming properties. And, potentially huge performance improvements over other languages and platforms.
While Go is still nowhere near as popular as Node.JS, it is gaining ground quickly. Apart from the creators, Google, some other huge projects have switched to using Go. Both Dropbox and Docker have now chosen Go to develop their massive, concurrent applications.
There are many factors that influence the performance of a programming language. Some of the ones we’ll be looking at here are:
- Raw performance
- Real-life performance
- Concurrency / Parallel programming tools
- Tools for developers
- Learning curve
- Best practices and conventions
- Strength of the developer community
- Ease of finding good developers
Let’s take a look at how Node.JS and Go stack up side by side:
Nodejs vs Golang Comparison Chart
|Raw performance||Poor compared to Go, as seen here||Excellent|
|Real-life performance||Good in most applications||Excellent|
|Concurrency / Parallel Programming Tools||Not good for large scale concurrent applications||Excellent|
|Scalability||Difficult for very large scale applications||Excellent|
|Tools for developers||Exceptional||Far behind Node.JS|
|Learning curve||Very easy for most web developers||Intuitive, but you still need to learn a new language|
|Community||Massive! Isn’t going anywhere anytime soon||Small (but growing quickly)|
|Finding Developers||Ridiculously easy – you probably are one or have hired one before||Difficult|
It’s tempting to look at raw performance data and assume Go is the one to go with. But in many situations, it simply doesn’t matter. For example, connecting to your database is often the bottleneck for your server performance. When this is the case, Node and Go perform at similar speeds.
Concurrency and Scalability
This is where Go really shines. The reason the guys at Google, Docker, and Dropbox use Go is that they have very large applications that need things to be done in parallel.
Go has a completely different approach to concurrent programming than other languages. It manages threads with things called ‘goroutines’ that handle communication in parallel very effectively. This means concurrent tasks that normally get very complicated, can be done simply and intuitively with Go. Take a look at these survey results from Go.org.
Tools for Developers and Community
Read How We Helped a Marketing Company to Build a Back-Office Custom Ads Dashboard
Go does have some nice libraries and packages to use, but it doesn’t look like it will catch up with Node.JS anytime soon. As a developer, you’ll be doing a lot more of the programming groundwork.
The Node.JS community is awesome and far bigger than Go’s. It’s safe to say that Node.JS isn’t going anywhere soon.
Best Practices and Conventions
- A “that will do” attitude
- Scalability issues with callbacks (see callback hell)
This can be a problem for developers and those that hire developers. It’s hard to break old habits, and it’s hard to find developers with good habits.
Go fundamentally encourages good programming practice. Google designed it so that large teams could work on large projects effectively and easily. As you are programming, Go seems to guide you into making smart choices as a developer.
Go is much newer and has a tiny fraction of the developers. This means you probably don’t have a Go expert floating around your office. And, finding a skilled developer will be more difficult and expensive. However, in the long run, the time invested in a highly elegant, scalable tool for your back-end might just pay off.
Convincing Your Team
The popularity of Node.JS means most developers won’t need much convincing to use it. In the Go 2016 Survey, they found that developers were overwhelmingly happy with the ease-of-use and performance of Go, but found it difficult to convince others of the same.
This is an important factor. If you are the one suggesting using a whole new idea to your team, you’ll be responsible if things don’t work out!
Which is Best?
This depends on many factors like
- Type of project
- Your current skill level (or developers)
- The size you intend to scale to in the future
- Many more