Recently, I sat down to refactor a Go application with a high-level design objective in place. The application had two conceptually separate entities implemented in different files but mashed into a single package. I needed to separate them out into their own packages. I wasn’t using an IDE — just Emacs with basic formatting and non-contextual auto-complete aids.
I started out by creating a new directory for the package to be split out and moved the files that contained most of the relevant code into that directory, without thinking of the consequences. I could just invoke the compiler and let it guide me through the process of fitting the pieces of the puzzle together. One of the nice features of modern compilers is that they don’t continue dumping out errors beyond a limit. This allows fixing a program in small steps, going by the changes in errors produced by the compilers.
Continue reading “The Compiler as a Refactoring Aid”
Last week, I conducted a 2 day Go Workshop at my workplace. It was fun.
I started day 1 with the excellent Go at Google presentation by Rob Pike, followed by my own presentation of Go’s key features. The rest of Day 1 was spent taking the Go Tour.
The coolest thing I did was on day 2. I mirrored my laptop on the projector and went through a fresh install of Go from source on my [newly allocated] dev box. Everyone else had identical dev environments so they could follow what I was doing on-screen. At the end of it everyone had a functional Go workspace!
What’s even better, I showed them how super easy it is to create packages and use them in a program. From conducting the installation to demonstrating package creation, it only took 1 hour. This included 10 minutes fiddling with Vim settings for syntax highlighting — the most difficult part of the entire session 😉
Presenting slide decks is one thing. It’s a totally different experience when you do a live demo with no prior preparation except the confidence that what you’re about to demo will work without much fuss.
Go is a fresh new programming language, that has come out of Google and is primarily targeted towards server development. It is developed by some very accomplished computer scientists, like Ken Thompson and Rob Pike. I recently launched a significant new product built with Go at work, and it has proved itself out very well in terms of developer productivity and performance. So much so that many other teams are also giving it a go (oh, how punny this language’s name is).
Think about it. How often do you come across a programming innovation that improves productivity and computational performance? Continue reading “Why I Program in Go”