Generics in Go

Generics in Go were added about a year back in Go 1.18. In my experience they are great and they fix one of the biggest roadblocks in terms of writing reusable code in Go. I’ll illustrate that with an example. First, do ensure that you have at least Go 1.18 Bash 1 2 $ go version go version go1.19.1 darwin/amd64 Let’s consider a simple case of implementing a Map function in Go that maps an array (well, a slice) to another array (again, actually, a slice)....

Book Summary: Woke, Inc.: Inside Corporate America's Social Justice Scam by Vivek Ramaswamy

The book takes a nuanced take on the uncanny marriage of corporate America and the “woke” social justice movements. The author, Vivek, was born to an immigrant Indian family, studied at Harvard, worked on wall street, and started his own biotechnology company before writing this book.

Common pitfalls of GitHub Actions

If you create GitHub Actions via GitHub’s UI by going to the URL of the form `https://github.com///actions/new`, it provides templates for setting up the build. However, the template is broken. There are four problems with the default template

White Tank

A day at Joshua Tree National Park

Joshua Tree National Park, about a three-hour drive from the city of Los Angeles, is home to Joshua Trees. If you have a day to spend, I would recommend a hike followed by the viewpoints.

Inheritance in Go language

Go language does not have the concept of a class directly. It, however, has a concept of an interface as well as a struct. I’ll illustrate how this can be used to build most of the inheritance constructs that a language like Java or C++ offers.

Colorful vegetarian food

A week in Kenya

This was my first trip to Africa. I have been to Egypt before. But Egypt has a more middle-eastern vibe to it than an African one. Compared to Egypt, in Kenya, almost everyone speaks English. And compared to Egypt, much less touting. Kenya is known for its world-famous Masai Mara reserve. Apart from seeing the big five animals (lion, leopard, rhino, elephant, and Cape buffalo), I would recommend a trip to the coastal city of Mombasa.

Bad and good ways to test code

Writing tests at an early-stage startup is always heatedly debated. If a function has one call, adding a unit test doubles the number of calls, this not only doubles the current work but even slows down future code changes 2X! Further, if the code is not finalized, it is legitimate to ask why even bother writing test code. Here’s a better way to write tests

GraphQL vs gRPC

RPC calls allow one service to call functions in another service as if it is a part of the same service. And unlike a REST API, one gets strong type checking. The two services can even be in different languages. gRPC is a great framework for implementing an RPC service. Another language-agnostic framework for making RPC calls is GraphQL. Many people don’t think of GraphQL that way, however, it can serve the same purpose....

The different layers of a web applications

There are three mandatory layers of any non-trivial user-facing web application. Storage, compute and view. The view is the front-end website and the mobile app(s). The storage is the database layer like MySQL or Mongo DB. The compute layer is the actual backend service serving the web content and related APIs.

The biggest impact of ChatGPT

In the decade of the 2010s, after Facebook became mainstream, social became a building block for websites. A lot of websites added a concept of user profiles consisting of a name, a display picture, a profile description, and the ability to see/follow the activity stream of other users. Slowly, this became the standard expectation. ChatGPT will have a similar impact. More and more users will get used to asking questions in natural language....