GopherCon 2023: Clean Up Your GOOOP: How to Break OOP Muscle Memory - Dylan Bourque

Опубликовано: 03 Январь 2025
на канале: Gopher Academy
3,466
119

Many Gophers, maybe even most of us, came to Go from other languages. Often those were object-oriented languages like C++, Java, or C#. That OOP world is filled with 40 years of patterns and idioms, and people who wanted to become “experts” in those languages spent a lot of time learning those patterns and committing them to mental muscle memory.

It’s likely that most of us have read the Gang of Four Design Patterns book. I think it’s actually assigned reading at some universities! There’s also the sage wisdom of Uncle Bob Martin. Others are out there, but you get the picture. The gotcha, though, is that those sources are all rooted in Object Oriented Design with its emphasis on classes, inheritance, virtual methods, and such. We’re all Gophers now, though, and Go is not really an OO language.

In this talk, we will take a tour around common constructs, patterns, and idioms from Object Oriented Programming and explore how to translate them to idiomatic Go while avoiding the traps and pitfalls that come from directly translating existing C++/Java/C# code.