Categories: [Technology]

Tags: [software], [programming], [golang]

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.

Don't use "Catch all" packages.

Use "small, sharp tools" combined to tackle a larger task (UNIX philosophy)

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.)

Use Interfaces not concrete types

Simple Implementation

Common behavior

"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.

Isolate functions

Small, single operation functions are best

Accept interfaces, return structs

Dependency inversion principle

One should "depend upon abstractions, not concretions."