MongoDB abstraction in Go using generics
Generics had been one of the most requested language features in Go since the first day of of it’s open source release. After more than a decade of waiting, the Go team finally introduced Generics in March 2022 as part of Go 1.18 release. Quoting the Go team: “Generics are the biggest change we’ve made to Go since the first open source release”. In this post, I’ll demonstrate the capabilities of Generics through a practical example taken from one of the projects I worked on. We will see how Generics helped me reduce redundant code, build nice abstractions and increased readability when working with Mongo DB.
How computers actually do many things together
In programming, it’s very common to want to do multiple things “together”. For example, if we want to load a person’s tweets and Reddit posts, we probably want to call the Twitter API and Reddit API together instead of waiting for one to finish before calling the next.
But what does doing it “together” really mean? Is the computer really doing two things at the same time? Are we really doing anything when we’re waiting for a response from an API? What if we have multiple cores? Those are the kind of questions we’ll explore in this post.
Type-Safe Queries with Plain Typescript
Typescript is God-sent. It turns a frustrating, toy-like language into one of the best languages ever. But it really doesn’t get the love it deserves. It’s often seen as just a slight improvement on the JavaScript situation by adding support for basic static typing. But Typescript’s type system is far from basic. In fact, it’s one of the most expressive, yet elegant, type systems out there.