I’ve been building a CLI for useCloudState.io, and I was wondering what the best way would be for the CLI to store an auth token in the users machine.

Following the lead from the excellent Heroku CLI, a .netrc file seemed to be the best choice.

A .netrc file typically…

I’ve been thinking about elegantly handling exceptions in synchronous Javascript code for a while.

I’m a fan of Either types and Future types. And my views about what’s “right” is heavily influenced by using them in production code-bases.

The Problem

I don’t like this code for two reasons.

  1. The let: implies…

Photo by Roman Kraft on Unsplash

I’ve been trialing out the state management strategies for React ever since the good old flux and backbone MVC days. I’ve seen projects go through adopting Redux, migrating some of that state to GraphQL-client based tools, and sometimes move into the Observables route or more novel ways of managing state.

Appetite for testing code generally depends on two variables:

  1. Coverage: The surface area of the behavior the test covers
  2. Effort: The effort in writing and maintaining the test

A perfect suite of tests would cover 100% of the behavior in code and take no effort in writing the test or…

Photo by Aubrey D’Arc on Unsplash

If you ever wanted to ask me why would you ever want to design a Graph Data Structure in a Relational Database (like MySQL or Postgres), and not use a Graph Database or NoSQL, it would be for a few specific reasons:

  1. SQL as a query language is widely used…

Photo by Amy Elting on Unsplash

Potential to harm

I believe that good software is easy to write when you eliminate language constructs that have the potential to harm. And I think switch-case is one of those things that have the potential to harm in a complex codebase.

Sure — vast majority of the the usages of switch-case had…

Photo by Philipp Berndt on Unsplash

Nullability is a hard problem. This is especially true for JavaScript/TypeScript. Front-ends and Web Servers (which makes up most of JavaScript usage) tend to work with a lot of JSON. And although it’s relatively easy to JSON.parse(myJSONString), …

Photo by Tomasz Frankowski on Unsplash

As someone who jumped on the Node.js train early on and wrestled with the callback hell, I quite liked promises. I still do, but more in an “it’s the best that we’ve got way”. So many times I’ve forgotten to catch a promise chain and it always decided to silently…


Typescript does a pretty good job of warning you against unused code in your modules, as long as you don’t export it. Once you do, all bets are off and Typescript compiler assumes exporting something implies usage.

So, as a Typescript project grows, it’s fairly common for these unused exports…

Nadeesha Cabral

Hi, I’m Nadeesha. I work with computers a lot. I write about software development, and a few other things.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store