-
Notifications
You must be signed in to change notification settings - Fork 155
Why Go
We started working on early prototype versions of embd (it was called go-rpi back then) when we were working on TheBot. A simple crowd controlled remote controlled car which transmitted a video feed (at 4 fps no less) back to the driver.
Yes, we could have built the same thing stitching together a bunch of Python scripts, but what would have been the fun in that. The "batteries included" approach did not attract us one bit.
We had been toying around with Go lately and were itching to build something in it.
Go is a general-purpose language designed with systems programming in mind. It is strongly typed and garbage-collected and has explicit support for concurrent programming - Golang.org
The ability to do concurrent programming is baked right into the language. Serving a web API can be done in a few lines by levering the standard library. The static duck typing gives the feel of a scripting language. The fact that the produced binaries are fast, self contained (no need to install a Go runtime on the target platform, just copy the file over and you are good) is the icing on the top. The dev experience also is a win by itself. It's uncharacteristic for a Go program to take more than a few seconds (I usually see sub 1 second build times on my Late 2013 MacBook Pro) So that means your TDD cycle will not suffer as it tends to the moment the build/test/report goes past a certain threshold (~10 secs.) Built in ability to cross-compile to multiple OS / processor architectures helps a bunch too.
Needless to say, the combination looked very potent, except for one major problem: the lack of a solid hardware I/O library which we could leverage. There were a few valiant efforts here and there (and we would then later discover hwio, which was a big inspiration) but nothing that really stood out. Yes, this would potentially make a one night stand into a much bigger thing, but the opportunity to create something to fill this void was very attractive.
Besides that, the benefits of using Go for building this far outweighed everything else:
- low memory usage
- self contained binary
- extremely capable standard library
- strong typing with a scripted feel
- growing ecosystem of open source packages
- safe and garbage collected (+ pointers for direct memory manipulation)
- concurrency as a language feature (allows for direct representation of the real world)
We are sure we have missed a few, so do let us know.