SOLID Design in Go

Ever seen comments such as If you like design patterns, use Java, not Go?

In this chapter, we will address this common sentiment regarding software design patterns and how they fit with developing high-quality Go applications.

Our goal in this chapter is to understand the following topics:

  • Why many Gophers eschew Java
  • Why Go does not support inheritance
  • The principles of good software design
  • How to apply the single responsibility principle in Go
  • The open/closed principle
  • Duck typing in Go
  • How to model behavior in Go using interfaces
  • How to compose software using the interface segregation principle
  • Inner type promotion and how to embed interfaces

Get Learning Functional Programming in Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.