Open API specification

Use REST with Open API

GraphQL is an overkill. REST is simple and easy to use. Open API is a specification that can be used to define RESTful APIs.

Android Logo

Android: Don't use stale views

In MusicSync, one of the views became complex and too slow to be inflated on the UI thread. So, I decided to do some Pooling around it to inflate it on the background thread and use it on the UI thread. This made the UI snappier, reducing multiple-second load times when opening some folders. However, soon I ended up with an edge case where re-opening the activity (and not the app) led to a semi-functional app. This edge case is hard as it gets triggered only in particular scenarios where the user destroys the activity via swipe up. At the same time, the app keeps running due to the attached foreground service that鈥檚 playing the media. And on activity re-creation, I got stale views! ...

Javascript package manager

Minimize Javascript in your codebase

Javascript isn鈥檛 a language. It is just a specification. Well, that鈥檚 true for many other languages like Python and Java. However, most languages have just one de facto implementation. For example, CPython for Python. Java has two major ones - Oracle鈥檚 JDK and Google鈥檚 Android Java. That鈥檚 not true for Javascript though.

Repairing database on the fly for millions of users

Repairing database on the fly for millions of users

This is a story of a messaging app used by billions of users. The app followed an extremely strong model of privacy. The app never persisted the user鈥檚 data on the servers. All the communication is end-to-end encrypted. A lot of users of this app, especially, on Android would regularly uninstall and reinstall the app. Now, to prevent these users from losing messages, the messages were backed up to the user鈥檚 SD card. In the Android security model, an SD card is a public storage space, accessible to all apps. So, to keep messages private, the backups were encrypted. ...

Google Cloud

It is hard to recommend Google Cloud

Google Domains A year back, I had to migrate my domain after Google decided to shut down Google Domains. I had to, not only, painfully setup multiple side-projects subdomain mappings again on a new domain registrar but also re-verify my domain and re-create those mappings on Google Cloud Run. Google Container Registry Google Container Registry is shutting down in 2025. It has been replaced with a new project called Artifact Registry. So, why is Container Registry being shut down? Probably because it 10X cheaper than Artifact Registry. ...

WordPress to Hugo

Migrating from WordPress to Hugo

For more than 10 years, this website has been running on WordPress. Over time I come to dislike it for multiple reasons.

When to commit Generated code to version control

When to commit Generated code to version control

Generated code, ideally, should not be committed to version control. Committing generated code can sometimes speed up testing and code generation but it is a design smell. It is better to cache generated code via CI caching. Committing generated code to version control is the worst as it is hard to even detect the difference. However, there are a few specific circumstances where committing generated code/config/data to version control is worth it. ...

Abstractions should be deep not wide

Abstractions should be deep not wide

Let鈥檚 say you are building a git analytics product. Your product supports GitHub and GitLab for now. It might support more products in the future. 90% of the codebase that supports GitHub and GitLab is identical. 10% is specific to GitHub and GitLab. There are two ways to build software abstractions here. The easy path to fall for is to have unified objects that take care of both GitHub and GitLab data. These objects would, however, behave 10% differently depending on whether it is GitHub or GitLab. Your codebase will be ridden with conditionals that trigger only for one or the other. ...

Homebrew - the missing package manager for macOS

How to add a new formula to homebrew package manager

I recently added adb-enhanced to the Homebrew package manager. Here are some of my learnings and future tips to smoothen up the process.

Too much documentation is harmful

Too much documentation is harmful

As code changes, documentation becomes stale over time. This happens at big companies. This happens at small companies. Unlike code, documentation is not compiled or tested. The code is executed. If the code execution fails or produces incorrect results, it is fixed with much higher urgency.