Go

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Go, Java go!)
Line 36: Line 36:
=== [[Go]], [[Java]] [[go]]! ===
=== [[Go]], [[Java]] [[go]]! ===
-
[[Java]]!? That slow, interpreted [[language]] which eats enormous amount of memory to execute its [[JVM|virtual machine]] and feels like an [[OS|operating system]] on its own? That [[Java]] which every real [[OS]] level hacker hates? Yes, that one. Well, not exactly that [[Java]], but rather a [[SubstrateVM]]. Let's enumerate what [[Java]] is:
+
[[Java]]!? That slow, interpreted [[language]] which eats enormous amount of memory to execute its [[JVM|virtual machine]] and feels like an [[OS|operating system]] on its own? That [[Java]] which every real [[OS]] level hacker hates? Yes, that one. Well, not exactly that [[Java]], but rather a [[SubstrateVM]] - an ahead of time compiler. Let's enumerate what [[Java]] is:
* [[wikipedia:static typing|statically typed]]
* [[wikipedia:static typing|statically typed]]
-
* [[wikipedia:compiled language|compiled]] language in the tradition of [[C]]
+
* [[wikipedia:compiled language|compiled]] language + (together with [[SubstrateVM]]) in the tradition of [[C]]
* with [[wikipedia:memory safety|memory safety]]
* with [[wikipedia:memory safety|memory safety]]
* and [[wikipedia:garbage collection (computer science)|garbage collection]]
* and [[wikipedia:garbage collection (computer science)|garbage collection]]
-
* and [[wikipedia:structural type system|structural typing]]
+
* and [[OOP|object oriented typing]]
* with [[Monitor|multi-threading concepts]] built into the [[language]] since day one
* with [[Monitor|multi-threading concepts]] built into the [[language]] since day one
-
Does that sound familiar? Yes, the language has the same benefits as attributed to [[Go]]. Moreover (in combination with [[SubstrateVM]]) one also gets similar runtime behavior. [[SubstrateVM]] gives [[Java]] (and any other [[JVM]] language) following:
+
Does that sound familiar? Yes, the [[Java]] language has the same benefits as attributed to [[Go]]. Moreover (in combination with [[SubstrateVM]]) one also gets similar runtime behavior. [[SubstrateVM]] gives [[Java]] (and any other [[JVM]] language) following:
* instant startup
* instant startup
Line 51: Line 51:
* low memory consumption
* low memory consumption
-
If you have a pre-occupation against [[Java]] forget them. We'll use the best of [[Java]] (or any other [[JVM]] language like [[Kotlin]]) and combine them with [[SubstrateVM]] to form a system which is clearly way better than anything [[Go]] can provide.
+
If you have a pre-occupations against [[Java]] forget them. We'll use the best of [[Java]] (or any other [[JVM]] language like [[Kotlin]]) and combine them with [[SubstrateVM]] to form an ecosystem which is clearly better than anything [[Go]] can provide.

Revision as of 13:42, 24 September 2018

Go is a programming language developed by Google. When it was introduced in 2009, it was promoted as:

After the usual initial hype it kept some of its coolness. Primarily because of the rise of docker (as most of the docker ecosystem is written in Go).

Contents

Forget Go!

The above is probably all you need to know about Go. Because the goal of this post isn't to promote Go, the post is written to explain that you don't need Go at all. That there are better, faster, more approachable, more toolable alternative language. If you are a happy Go user, stick to it, but if you are considering to use Go for development of a new system, then the main take away is: Forget Go!, there is a better way.

Let's start by enumerating what are the problems with the Go language.

Slow

Go is slow. The same algorithm written in Go runs at least twice as slow than the same algorithm written in Java or C. I maintain a project to measure Turing Speed of various programming languages on a variant of Ancient and well known Sieve of Eratosthenes algorithm.

Hard for Coding

One of the original Go mottos was to Not require integrated development environments. I doubt that materialized. Coding, editing, debugging, fixing errors feels to me like editing Java twenty years ago. Do it in vi, go to command line, read the errors, try to fix them. Honestly, it is a disaster for productivity unless you want to hire the few most expensive experts that code Go for living.

There is an IDE that supports Go, but it even basic editing isn't for free. There is a LSP server, but your mileage may vary. Looks like Go is years behind any language adopted by the industry.

Proprietary

Go is proprietary. The whole stack is written from scratch and not based only anything the industry shares. It is not based on LLVM stack. It is not build around GCC infrastructure. It is written by Google from top to bottom.

This has a negative effect on features, as well as speed. The team paid for Go support isn't infinite, and thus is cannot address all the incoming requests at immediately. Yet it needs to reinvent everything (e.g. a wheel) again due to uniqueness of the Go implementation. As a result Go lacks in many features behind languages well adopted by the industry.

This is not to say everything in bad in Go. If you are working in an ecosystem that is build with Go (e.g. you are coding against Docker APIs or your are a Google employee), it may still be beneficial to use Go. But otherwise, let's consider Java!

Go, Java go!

Java!? That slow, interpreted language which eats enormous amount of memory to execute its virtual machine and feels like an operating system on its own? That Java which every real OS level hacker hates? Yes, that one. Well, not exactly that Java, but rather a SubstrateVM - an ahead of time compiler. Let's enumerate what Java is:

Does that sound familiar? Yes, the Java language has the same benefits as attributed to Go. Moreover (in combination with SubstrateVM) one also gets similar runtime behavior. SubstrateVM gives Java (and any other JVM language) following:

  • instant startup
  • no interpretter/dynamic compilation overhead
  • low memory consumption

If you have a pre-occupations against Java forget them. We'll use the best of Java (or any other JVM language like Kotlin) and combine them with SubstrateVM to form an ecosystem which is clearly better than anything Go can provide.

Personal tools
buy