Developing the Sumo Card Engine

3 minute read Published:

Why Go? - Sumo Card Core Development Decisions (Devblog 2)

Language Choice (Why Go?)

There are four main features of Go which are highly beneficial to this project. Going into this I want the application to be able to run on a “cloud” service (Google, AWS, or Oracle) and in a docker container. The easiest way to do this is to run the application as a self contained binary. Loading libraries and web servers (nginx + php) or (nginx + whatever..) is really becoming a hassle and the dependencies and size of containers is out of control. Using Go creates reasonably sized executables that do not require excessive libraries and fit well into a docker environment well.

Native Multi-byte Character Support

Since the core of this program is essentially a glorified quiz program for Japanese words, Japanese language support is a pretty important (perhaps the most important) requirement when choosing a programming language. Go provides excellent support for multi-byte encoding. For further reading about how this is achieved please read Rob Pike’s Blog about strings in go. It also contains a link to another article explaining some of the challenges dealing with multi-byte encoding.

Compiled Binary

Go creates compiled binaries which don’t require any shared libraries to be installed. This makes operations a breeze, we can simply use a bare bones docker container, map the ports and we’re ready to go. Go also has a robust http/https server built into the standard library which, for our purposes, eliminates the need for a separate http/http server (i.e. nginx, lighttpd or apache).

Excellent JSON Support

We will be building our dictionary using the API supplied by jisho.org and they provide JSON responses to our API requests. Go has easy to use built in support for encoding and decoding schema directly to data structures which makes data interchange very easy to implement, test, and manage. You can simply specify a schema in a Go data structure and the JSON package takes care of the rest.

go fmt

My favorite feature of Go is not its built in concurrency primitives, integrated unit testing, Go Interfaces, or even first class function support. It’s go fmt. It eliminates all of the religious arguments around spacing, line breaks, bracing and formatting. After you write a file in Go, just run it through go fmt and it’s perfect, uniform and consistent all the time. It really is the thing that sets Go apart from other languages for me.

These features of Go provide an excellent platform to create a readable and maintainable vocabulary training system. In the next article I will discuss the database layout, the initial choice of MySql over a NoSql implementation and designing the modules to allow for a quick migration if the MySql database begins to show signs of performance issues.