Skip to main content

Sudarsan's Blog

Tag: Clean Code

Why types are elegant

I’ve been working with Go(for work) and Rust(for fun) lately. I got pulled into the two languages for different reasons (easy concurrency and memory safety respectively) and ended up staying for a totally different reason altogether. Their type systems.

Composition instead of inheritance feels elegant, right and very readable. I’m going to talk about something that happened today when I was very thankful for composition and typing itself.

A colleague and I ran into a problem that quickly devolved into an argument and as it is with professional software engineers, wanton namecalling. For work, I’d written a common request making library. It wasn’t anything special. It would branch off of a http.Client and make requests and responses and parse them to specific interfaced outputs that we used for our internal client sdks.