J. R. Swab

Achieve SOLID Design in Go

Categories: [Technology]

The following information is a compilation of Wikipedia and the 2016 speech by Dave Cheney (link at the bottom). If I am missing anything or have the wrong idea please message me.

Single responsibility principle

A class should only have a single responsibility, that is, only changes to one part of the software's specification should be able to affect the specification of the class.

Open–closed principle

"Software entities ... should be open for extension, but closed for modification." - Bertrand Meyer

Liskov substitution principle "Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program." (See also design by contract.)

"Require no more, promise no less" - Jim Weirich

Interface segregation principle

More specific interfaces are better than a few general-purpose interfaces. "Clients should not be forced to depend on methods they do not use." - Robert C. Martin Functions and methods should only depend on the behavior they need.

Dependency inversion principle

One should "depend upon abstractions, not concretions."

Speech by Dave Cheney