I think learning the detail of these Go constructs by transliterating OOP design patterns is good value. For example, above I mention being surprised to learn that a method will override an embedded struct’s function field with the same name. This may be useful for writing minimized Go code in cases where a proxy, interceptor, or decorator pattern is called for.
My question could be rephrased as “what problems are most important to you that these design patterns were made to solve?” I do think keeping the code solution as close to the problem geography as possible is right, and maybe design pattern thinking enables distraction from that, but that doesn’t make these concepts not worth learning. They’re recognition of problems too, not just solutions. Matt On Friday, February 2, 2018 at 9:35:42 PM UTC-6, as wrote: > > I would rank them mostly unused. There was a point someone made in the > past how choosing between design patterns is the equivalent of choosing > calling conventions for functions, I don't remember the source, but I agree > with the comparison. Most of these are superseded by struct and interface > composition, along with general interface use. I've recently seen a factory > in Go, it was rewritten into explicit declaration and this simplified the > code. The visitor "pattern" is just a function that gets called for a > traversed composite structure like a list or tree (see filepath.Walk). > > On Friday, February 2, 2018 at 9:03:54 AM UTC-8, matthe...@gmail.com > wrote: >> >> I’m looking at patterns summarized on Wikipedia from “Design Patterns: >> Elements of Reusable Object-Oriented Software” and writing out a few as the >> equivalent in Go. >> >> Visitor: https://play.golang.org/p/A5tNzxMmetH >> >> Abstract Factory: https://play.golang.org/p/SWwuX49eysd >> >> Factory Method: https://play.golang.org/p/FRgDBx2CLFf >> >> Facade: https://play.golang.org/p/forPdwy9VCi >> >> Proxy: https://play.golang.org/p/DFWuDPTOzEP >> >> I’m curious how more experienced people rank these and the other patterns. >> >> Matt >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.