Learning Go: the Language and the Game
Coming from the world of Chess in terms of games, and Python when it comes to programming languages, learning Go was difficult. For those who don’t know, when I say ‘go’, I could be referring to two different things. One is a very old game which originates in East Asia. The other is a very new, strongly-typed programming language, which originates in Google. In this case, I’m referring to both.
And, while these two versions of Go were very different from anything I was used too, in the world of gaming and programming, the two of them shared some similarities, which I’ll share with you here.
Go: The Strongly-Typed Game
‘Strongly-typed’ normally refers to a programming language which requires explicit definitions. The same is the case for Go the language, but it’s also true for Go the game. Every move is well defined, and for this reason, requires careful practice to not make mistakes early on.
Go is all about brevity and efficiency
Unlike chess, where you start out with a set of pieces and attempt to remove your opponent’s; in Go, you start out with nothing, and attempt to achieve victory with as few pieces as possible, making it a very efficiency-driven game. Likewise, in the language, brevity is prized. And the more efficient your algorithm is, the better. Game: Take the least territory with the least number of stones. Language: Accomplish your intended function with the least amount of code.
Go: The Meticulous Programming Language
Go is meticulous. Everyone who knows anything about the game understands this. But so is the language. Both require a meticulous mindset, planning several steps, and potential steps, ahead. Whether that’s how to scope the most efficient way to code an algorithm, or how to prevent captures from the enemy.
Both were made for war!
We think of Chess as a war game, but the same is the case for Go. Go is a territorial game, based on surrounding and capturing the enemy. The players normally start by staking out their claims to parts of the board which they intend eventually to surround, and thereby make into territory. The fate of Tibet was supposedly once decided on a game of Go. In Sun Tzu’s Art of War, he uses a Go-like strategy in combat, deciding where to fight: avoiding where his enemy’s army is strongest, and attacking where it is weakest. The game is for warriors. And it’s also true of Golang. Learning the language feels like slowly staking more and more territory, before using your knowledge and codebase to surround a problem and capture it. If you have not staked your territory properly, if you have failed to take everything into account, and instead “attack” the problem too early, your code will fail. If you first attack the problem where it is strongest, rather than its weakest points and moving in slowly, you will fail. We can call this Sun Tzu’s Art of Coding.
Conclusion
Both the game and language are difficult, and need a different mindset from the norm to master. But they are also fascinating and addicting, once you get the hang of them. I will certainly be utilizing both in the future, and have already built an Go Crawler Utility (GoCU) API which works as a search engine for individual websites. Remember: avoid the problem where it is strongest, and attack where it is weakest!