David Harting

April 12, 2021

A great compiler makes abstractions cheap

One of the core aesthetics of golang is that a mediocre abstractions is worse than no abstraction. I think that is a fair take, earned through experience, and shared by many programmers that I admire.

However, with an expressive type system and a loyal compiler at your back, we need not fear abstraction!

When you trust the compiler, you are free to create types that reflect your mental model right now. Readers of the code get to interact with this living model. As new information or requirements update your mental model, you can update the types to reflect that. Complete the refactor by simply chasing down compilation errors.

This is a happy place to be, and it is why I deeply enjoy working in TypeScript. I wish that every programmer experiences the joy of algebraic types and strict null checking. ❤️