Reflection — An Honest Take 8 min

Honest Take — Before You Begin

This module is where Go stops being "worse Ruby" and becomes something Ruby cannot be. And I mean that literally -- Ruby's Global VM Lock means that in all your years of Rails, you have never truly done concurrent programming. You have done parallel I/O with threads that cannot actually run CPU work simultaneously. You have done background jobs with Sidekiq, which is concurrency by process isolation. You have never spawned ten thousand lightweight tasks that genuinely execute at the same time on all your CPU cores.

Goroutines will feel like magic. go doSomething() -- that is it. No thread pools, no executor services, no callback hell. The Go runtime multiplexes goroutines onto OS threads for you. You can spawn a million of them and the runtime handles scheduling. Coming from Ruby, this will feel like cheating.

But channels are where it gets hard. Channels are Go's mechanism for goroutines to communicate, and they introduce an entire category of bugs you have never encountered. Deadlocks -- where two goroutines wait on each other forever. Goroutine leaks -- where a goroutine blocks on a channel that nobody will ever write to, and it just sits there consuming memory until your process dies. Race conditions that only manifest under production load and are nearly impossible to reproduce locally.

Concurrency in Go by Katherine Cox-Buday is one of the best concurrency books written in any language. It does not just teach you channels and select statements. It teaches you concurrency patterns -- pipelines, fan-out/fan-in, cancellation, timeouts -- that apply everywhere. This is the kind of knowledge that transfers to any language or system.

I will be honest: concurrency bugs are the hardest bugs you will ever debug. They are non-deterministic, timing-dependent, and often invisible in tests. The Go race detector (go test -race) is your best friend. Use it religiously. But accept that concurrent programming is a fundamentally different skill from sequential programming, and it takes time to build the intuition. This is not something you learn in a weekend.

Learning resources 5

That's the free preview. Sign in to continue this course.

Sign in to continue

New here? Make a desk →