Last week I wrote about some truthiness edge cases in JavaScript. This time, I have a quick tidbit on elegantly handling null/undefined values.

null — called the “Billion-Dollar Mistake” by its inventor, C.A.R. Hoare — most programmers are probably intimately familiar with this (and why it might be categorized as a mistake!)

We’ve certainly all written some code like this:

if(foo != null) {
// Do something with foo

But, what if foo is an object with multiple levels of nested objects? You’d probably agree that it gets a little cumbersome to write something like this:

if(foo != null)…

Last time I shared a quick tidbit about running individual unit tests. This time, I want to share a few interesting things I learned while debugging a failing unit test.

If you’ve used JavaScript for any length of time, you may have encountered its slightly special behavior around boolean expressions. In many other languages, if statements can only contain boolean expressions — either a boolean variable, or some other expression which returns a boolean value, such as: greater than, less than, equal to, not equal to, etc.

However, in JavaScript, ALL variables themselves are inherently true/false — this is known…

Last week I wrote about React Fragments. This week, I have a quick tidbit about running tests in VS Code.

I hope you all had a restful long weekend! I’ve written about the importance of vacation before, and in this pandemic that just seems to keep on going (although hopefully we’re starting to see the end), it’s more important now than ever to prioritize your health and take care of yourself!

As you may have noticed, since I’ve been writing about it a bunch recently, my current project is using React Native. We’re using Jest for our unit tests, and…

Last time, I wrote about defining constants in TypeScript. This week, I want to share what I learned about React Fragments!

To many of my readers who are Android developers, you already know all about Fragments from the standpoint of building Android UI. However, in the React/React Native world, Fragments serve an entirely different purpose.

First, an example — say you want to define a method (or component) that returns some elements, for example:

const Stack = createStackNavigator()const SomeComponent = () => {
return (

A likely first implementation of getScreens() would return an…

Last time I wrote about how to write safe enums in TypeScript. This week’s tidbit is also TypeScript related — how to define constants!

Defining a constant in TypeScript can be pretty simple — you can just write something like const SOME_CONSTANT="FOO";. However, that const keyword only works if you’re defining variables at file-scope or inside a function. What if you want to group your constants under some kind of named object (as is common in other languages such as Java, C++, etc.)

The obvious way (and what I did to start), was simply to define an object to contain…

Last time I wrote about how to get started with React Native. This week, I have a quick tidbit about writing safe enums in TypeScript!

Many programming languages have support for enums, but they work slightly differently in TypeScript.

It’s really simple to define and use an enum — you can do so like this:

enum MyEnum {
function foo(enum: MyEnum) {}foo(MyEnum.A);

What really surprised me is that it’s also perfectly valid to do this:


WHY?!!? To be honest, this really makes no sense to me at all. If I’ve gone through all the…

Last time I shared a few IDE-related tidbits. This week, I have some quick tidbits on getting started with React Native!

My latest project is using React Native (with TypeScript), so I’ve been doing a lot of studying and preparation.

One of the tutorials I went through had me set up a fresh project using React Native’s TypeScript template. Unfortunately, I discovered that it wouldn’t build for iOS! After a little searching, it turns out there’s a known issue:

In my sample project, I took the approach of commenting out the “Flipper” dependency, which allowed the app to build…

In my last post, I wrote about the RxJava share operator. This week, I have a few quick IDE tidbits!

I’ve written about some fun IDE plugins before in Tidbit #6, but I recently got a new work laptop, and in the process of reinstalling Android Studio discovered a new one!

Previously I had been using the NyanCat progress bar (because work should be fun!), but when I found out there’s a MARIO PROGRESS BAR I knew I needed to check it out:

If Mario isn’t your thing, that’s ok — there are a LOT of different options, depending on…

Last week, I wrote about dashboards and celebrated 2 years of Matt’s Tidbits! This time, I want to share… about sharing!

Have you ever written code that looks like this?

If so, you may have run into issues — what if a particular caller of start() forgets to call stop(), or possibly worse — calls it more than once? These types of problems are very common, especially in multi-threaded environments.

If you add on the layer of trying to incorporate reference counting with RxJava, the problem becomes even more complex. …

Last time, I shared some tools for automating common actions to help you focus better. This week, I have a few tidbits to share about dashboards.

Back in 2019, in my 2nd tidbit, I mentioned a handy tool — the Android distribution dashboard. Since then, Google has made some changes, and some of the helpful data that shows you installation percentages for different versions of Android is no longer there!

To clarify — the dashboard page is still there:

But, Google has moved the information around usage of different versions of Android into Android Studio itself. …

Matthew Groves

Digital Products NE Mobile Capability Co-Lead & Senior Software Engineer in Cambridge, MA —

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