Go 101 About, Architecture, Versions, Ecosystem

By pjain      Published July 29, 2019, 1:47 a.m. in blog Programming   

About

Go has pretty good compiler error messages, so having it slap your knuckles a few times helps speed the learning.

  • most people writing articles about Go would try to tag them with "golang" for search-ability ("golang" is also used for all the Go e-mail lists).

Why

Go is a compiled, statically typed language.

Go is designed to have a very basic, but fast language - has less cruft and support in std lang as compared to Py/Rb which are designed to make it easy to get things done for experts.

Go is about quick development of back end services at C/C++ performance levels.

  • Go Gives 3-20x performance in benchmarks vs Python.

Go might need a bit more effort, but over the lifetime of the code that small cost will more than pay for itself by using less resources, scaling better, fewer bugs (simple == fewer defects), stronger standard library (modern features and performant), easier deployments, better debug/perf tooling.

Why not

NOT Dynamic typed - so not that good for quick prototyping or the active-ORMish type reflection like RoR.

NOT scripting language it doesn't have a REPL - where Rb/Py do well.

Go takes a lot more time to develop in than Python.

It would be much more successful if they allowed a bit more syntactic sugar to make code more concise. It’s too opinionated in some ways but curiously missing conventions/guidance for things that impact readability. For example, there is no recommended line length so it’s common to have lines of code that require you to scroll horizontally (a lot!). They recommend/tolerate one-letter variable names (presumably to make things more concise) but why does that matter if we are now writing lines that are 200 characters long?

Use cases - Hi perf WS, BE-servers

Go is a server-side language so seems great for infrastructure, backends, devops, performance, scaling, systems, concurrency, network, databases, servers, CLIs, etc… there are few technical reasons to use Python over Go.

Go is going to be used where its features of performance and concurrency patterns are important. If horizontal scaling is important, Go will be a better choice. It will also do where speed is critical.

NOT for Most Large Web Apps>

In area of web development Python has a massive footprint and its actually growing. Here Go might take some footprint on concurrent/websocket application space, but it's really small piece of the cake. When hottest front-end js framework changes 3 times a week… so consider Nodejs rather than Go.

Popularity

2012 The TIOBE programming community index rates Go as not being in the top fifty languages used today. That seems strange since it was the "language of the year" in 2009.

TIOBE has always been a joke, and only even attempt to manage language chatter, not usage. It is based off job boards and internet search trends, and is highly susceptible to homonym confusion, which is especially harmul in the case of "go".

  • Github, which ranks Go as the 27th most popular language. https://github.com/languages/Go
  • however huge Ruby bias due to history

Perf tips by C integration

If speed is so important that Go isn’t fast enough, Go has an assembler that is processor agnostic (your code still needs to fit in the target) or you can code those sections in C and call them from Go. (There is a robust framework for integrating C code.)

Go vs Python esp 3.6+ Async, Type Annotations

  • Python is well established and has a significant community built up around it. For many applications, Python works well enough. Places where Python will be stronger for years or maybe forever.

Python has massive data science library support. It could take a decade to build similar ecosystem on a another language. Massive uptake of Python in world of finance is only making this stronger.

Python has huge ecosystem of system management and “glue” tools to use it as an automation language. I cannot see any admin would be eager to change the language. And why would they? Python libs do the job well.

There are still many more Python programmers than Go. There are still many more libraries and applications written in Python. With python, you can quickly prototype and develop a solution using the massive standard library or pip.

  • Python 3.6+ is fighting back

    We now have type annotations in python for functions and variables.

If we take out all the runtime implementations, and the library ecosystems and just look at the core language spec and it's standard library, Python is just too powerful, it might very well be the most practically useful and simple language today.

  • Async IO is a killer for Python - that obviates many of old Go and NodeJS benefits

Python - Safe bet for ML. (Anaconda libraries)

Python+ QL (hive/plsql/sql)

Go vs C/C++ - low level calls not so easy from Py/Java

Golang and C++ - If you want to be part of code migration team in Google ( someone from Google can validate).

Python,Golang and Java - Overkill. Any two will do.

Basically, if you learn C++ then you will also become familiar with the Standard C language. And Standard C exists almost 50 years and is still used a lot for operating systems and embedded programming. The C++ language has the best native interface to communicate with C libraries and both languages combined are often used to write compilers for other languages like Golang, Python and even Java.

Eventually for high perf you will want Java, Python and Golang to link with your C++ code, for which both use C-style functions. If you decide to use Java, well… Java has the same problem, only more complex. Java code is platform-independent and compiled Golang is not. That makes it harder to combine both.

CODE GEN OPTIMIZED in C++> Go is a very new language, and C++ has been around for quite some time. Because of this, C++ compilers produce significantly more optimized code than Go compliers, meaning C++ is (usually) faster than Go.[1] As Go compilers improve with time, we can expect to see this gap closing somewhat, but Go most likely won’t ever completely catch up. C++ was designed with performance in mind, and even though it lacks the built-in support for coroutines and concurrency that Go does, libraries can be leveraged to provide this. This speed difference between C++ and Go is usually inconsequential, and the faster development time with Go means it is often a better choice.

Go vs Java

  • Java can perform very well across wide variety of problems .. only avoid GC by obj-pools

Go vs Ruby, PHP

Ruby is an interpreted, dynamically typed language. Perhaps if Go gets some strong web frameworks, like Ruby has, then perhaps it will gain some traction for web apps, but they're really quite different languages.

Ruby quickly wraps a database as a web application in RoR for quick prototyping in a dynamic programming environment. But Go is all about static typing and this is not possible.


0 comments

There are no comments yet

Add new comment

Similar posts

Go Sample Full Apps

Go Quickstart

Go Reference, Cheatsheet

Go Setup Smarts