Tijmen - Software.

2024 #30: Quality & SOLID design


We have been talking a lot around the architecture of our application at Print.com.

  1. https://lethain.com/quality/

  2. https://dave.cheney.net/2016/08/20/solid-go-design Dave makes the SOLID principles directly applicable to Go. It’s easy to forget the principles when your deep into it.

Look at code reviews for:

Single Responsibility Principle (SRP): Code should have one responsibility so that it has fewer reasons to change.

Packages like utils or common often become a dumping ground for code and thus change often. Purely, in Unix philosohy, a package has a single responsibility and is in itself a small Go application.

Open/Closed Principle (OCP): It should be easy to extend functionality without modifying existing code. This principle is explained a bit worse. Have to read up a bit on embedding and when it is appropriate. (https://go.dev/doc/effective_go#embedding) Liskov Substitution Principle (LSP): An implementation of an interface should be substitutable for another implementation. The whole hexagonal architecture is based on this principle. Interface Segregation Principle (ISP): Dependency Inversion Principle (DIP):