#EastBayGo: Pareto Efficiencies and AOP with GoWeave

east-bay-go

Special thanks to James Daisa for the base image! CC BY 2.0

The other night we headed over to the TurnItIn offices to get nerdy about Go. They hosted the first speaker-led event for the EastBayGo group. Full disclosure: I was one of the speakers!

The Talks

The Easiest Way to Develop with Go

My talk was about a 19th century Italian philosopher, and how his ideas apply to the decisions we make when picking tools for modern software.

The idea is the Pareto Efficiency. It’s common to run into situations where it’s impossible to improve thing A without making a thing B worse. This effect, called a Pareto efficiency, illustrates the type of decisions developers have to make all the time.

Want a solution that utilizes your hardware better? You’ll pay for the efficiency with a mental tax on your developers. As an example, see Assembly.

Want a solution that’s easier for developers to reason about? You’re probably paying for that by running a tool that’s a bit slower.

“Wait, isn’t this a meetup about Go?” Good question, voice in my head. Why am I talking about Italian philosophers and Docker? I find it interesting that Go and Docker make a lot of the same tradeoffs. They’re pretty dang fast, but some speed is occasionally traded for developer friendliness.

I’d argue that the developer friendliness is the reason why both shine. So, why not use Docker and Go together? Iron.io CTO Travis Reeder recently posted a piece on how to do this. The Go 1.5 vendoring change makes this easier than ever. If you value speed and ease of use, Docker + Go are a natural pairing.

The latter half of the talk was a demo of Iron.io’s own Docker + Go workflow. Check out the slides at: https://speakerdeck.com/pgburt/the-easiest-way-to-develop-with-go

Pareto efficiency

Compile-time Code Weaving with Go

Ian Eyberg, founder of DeferPanic, spoke about the recent open source project, GoWeave.

What is GoWeave? It’s a way to automatically scan and modify code at compile time. It’s enormously useful for chunks of code that seem to appear everywhere. Think logging, monitoring, or error handling + detection.

You might be thinking, “wait a minute… that sounds a lot like Aspect Oriented Programming. BURN THE HERETICS!” AOP was a hot topic in the Java world a few years back. It’s a powerful way to add to code. But, that also means you can (really powerfully) screw things up.

Unsurprisingly, AOP quickly fell out of favor. Ian addressed this head on in his talk. “Coding is a tool first and foremost. My ultimately goal is to get something done.” If AOP fits well for a project, why not take advantage?

Ian also did a great job of surveying the current landscape of AOP-like solutions. This included a quick look at go fmt, go fix, go cover, and go generate. Although all of these worked pretty well, they didn’t quite fit the needs of some of DeferPanic’s projects. Hence, GoWeave was born.

If you’re interested in seeing more examples, head on over to the gitHub repo.

Ian’s presentation also had excellent slides. For visual learners, I highly recommend giving his deck a look: https://speakerdeck.com/eyberg/compile-time-code-weaving-with-go

Aspect Oriented Programming with GoWeave

So long, and Thanks for All the Fish

Thanks to TurnItIn for hosting, and the amazing sushi spread.

Hats off to LaunchDarkly for putting together a great event! If you’re in the Bay Area, and interested in Go, you should keep your eyes peeled for the next one.

See you there!