12 Benefits of Golang For Enterprise Systems

http://www.brendaningram.com/blog/4-brendans-blog/19-12-benefits-of-golang-for-enterprise-systems

12 Benefits of Golang For Enterprise Systems



The Go programming language (commonly known as Golang,and for the purposes of this article referring to version 1.2 or newer) was conceived by Google in late 2007,and released in November 2009. Go was created primarily as a systems programming language. That is to say that Go is not currently designed for creating desktop user interfaces.

In the world of programming languages,Go is relatively new. However,in the few short years it has been in the public domain,it has rapidly grown in popularity as organisations rediscover the benefits of a lightweight,highly performing,and fun programming language. As part of my day-to-day role I have been evaluating Golang as a potential replacement to some of our existing Microsoft stack applications.

These are the key benefits that Go provides in an enterprise environment:

1. An Overview Of The Go Programming Language

Hint: As you are embarking on your own journey into the fun land of Go,use the term "Golang" when you are doing Internet searches. Search phrases such as "Go Syntax" or "Go examples" don't bring back targetted results as well as "Golang Syntax" or "Golang examples" et cetera.

2. C Level Performance

Golang is within a close margin of the performance level of C code (which is itself an extremely high performance language). It is certainly closer to the performance of native languages than other enterprise level languages such as Java,Scala,Erlang et al. Again,keep in mind that this statement applies to Go1.2 - earlier versions of Go had very minimal optimisation within the compiler. The current version is very fast,and it will only get faster as the language gets more mature.

"Go is like a better C,from the guys that didn’t bring you C++" — Ikai Lan

3. Fast Compilation

The Golang compiler was designed to compile programs very quickly. Extremely large programs with massively high LOC counts compile seemingly instantly - afterall,Golang was designed by Google to solve Google problems,and Google has big problems! At Google,code and cpu cores are both measured in the millions. My own proof of concept tests have shown that Go programs compile with impressive speed. In fact,it has been said that Go programs compile so quickly that the language can almost be treated as a runtime interpreted language.

4. Multi Platform

The Golang compiler allows you to compile executables for multiple platforms out of the Box. In an enterprise environment that has its environments pretty well fixed in place,there isn't much benefit in this,however it does offer enterprise a level of future proofing. For example,our hardware is currently Windows based,however we can build these new systems in Go while we continue to evaluate whether we will move to Linux. If the decision is made to move to Linux,no extra work is required other than compiling the program into Linux executables.

5. Unit Testing & Benchmarking

These are first class citizens and core elements of the Go programming language. Check out my recent post about Golang benchmarking for a practical example of how useful these features are.

6. Concurrency Supported At Language Level

Concurrency is the ability to execute multiple computations simultaneuously. In today's modern multicore and high-load computing environment,concurrency is a critical language feature,and one in which languages such as Java struggle immensely.

Google have summed things up nicely with their motto: "Don't communicate by sharing memory,share memory by communicating."

7. Code Style - gofmt

gofmt formats Go programs.

It doesn't get much simpler than that! Check out Google's page about gofmt,and Google's gofmt blog post that shows a few practical examples. In reality,what this means is that your code is always nicely formatted,and coding standards can be easily maintained throughout the organisation.

8. Built-In Documentation - godoc

godoc extracts and generates documentation for Go programs

Again,just like the rest of Go,it doesn't get any simpler. Communicating the purpose of API's and programs within an organisation is important. When you need to communicate to 3rd parties,it is critical. godoc creates a structured documentation resource that you can share internally,or externally. Check out godoc.org for some documentation examples.

9. Garbage Collection

In C and C++,programmers spend a lot of time and energy on allocating and freeing memory. The designers of Go wanted to remove that complication,and ensure Go programmers could concentrate on more productive tasks. As such,they implemented garbage collection.

As a developer,this is a very good thing. Sure,garbage collection comes with its own set of issues,but those are dealt with by the language implementer while the programmer is free to reap the other many benefits of Go.

10. Comprehensive Standard Library

This is a massive factor for any organisation or individual looking to take on a new language. The Go standard library is very comprehensive. Check out the list of packages in Go. Standard library functionality includes important things like compression,cryptography,numerous data structures,sql driver,JSON and XML parsing,templating,networking,and a LOT more.

11. Fun Language,Shallow Learning Curve

Good programmers will always be good programmers. They will be able to learn pretty much any language. Personally,it's been a long time since I did any C programming,however I have been a C# programmer for 14 years (started with the beta versions),and have dabbled with varIoUs other languages along the way.

Over the short period of 2 weeks,I went from zero knowledge of Go,to writing an MVC style web application featuring routing,authentication,reading records from a database (RethinkDB),entering data into a form and saving it back into the database,and a few other little niceties. In addition,in those 2 weeks I had to refresh my knowledge of Linux (I did all this on a Debian VM running in VirtualBox),and also had to start from scratch with RethinkDB. You can't argue with productivity like that!

"After Go,programming in anything else seems as difficult as balancing the State of California’s budget." — Charles Thompson

One of the most useful books I have found to learn Go is The Way to Go: A Thorough Introduction to the Go Programming Language - best of all,it's only about $3.00 on your Kindle!

12. Numerous Enterprise Case Studies

The more I research Go,the more impressed I am. These 12 benefits are just the highlights. There are many more benefits that I could list,but if I did that,this article would never finish. Instead,have a read of these case studies from organisations that really know what they're talking about:

iron.io

"In retrospect,it was a great decision to choose Go as it's allowed us to build great products,to grow and scale,and attract grade A talent." — Read Case Study

bitly.com

"We identified early on that Go had all the makings of a language that could supersede some of the places we would have traditionally turned to C and some of the places where we wanted to move away from Python." — Read Case Study

torbit.com

"We process over 6 billion performance metrics a day and our goal is to keep our customers’ data safe forever." — Read Case Study

conformal.com

"In summary,Go makes hacking fun again by doing away with intellectual masturbation and terrible,terrible tools. It compiles super fast and runs at native speeds. Any C expert can pick it up over the course of a few weeks and with its awesome data representation features I believe we could rewrite a product such as Cyphertite in 25% as many lines of code." — Read Case Study

That's just my selection of 4 case studies about the benefits of Go. If you are interested in reading further,many more case studies can be found at "The Case For Go".

相关文章

程序目录结构 简单实现,用户登录后返回一个jwt的token,下次请求带上token请求用户信息接口并返回信息...
本篇博客的主要内容是用go写一个简单的Proof-of-Work共识机制,不涉及到网络通信环节,只是一个本地的简...
简介 默克尔树(MerkleTree)是一种典型的二叉树结构,其主要特点为: 最下面的叶节点包含存储数据或其...
接下来学习并发编程, 并发编程是go语言最有特色的地方, go对并发编程是原生支持. goroutine是go中最近本...
先普及一下, 什么是广度优先搜索 广度优先搜索类似于树的层次遍历。从图中的某一顶点出发,遍历每一个顶...
第一天: 接口的定义和实现 第二天: 一. go语言是面向接口编程. 在学习继承的时候说过, go语言只有封装,...