Tuesday, December 25, 2018

Data Neutrality

Persisting data is a double-edged sword.  The benefit is that the data continues to exist after power is lost.  The cost is that some space is consumed.  Luckily we live in the "Space Age" where storage space for data is dirt cheap.  Nevertheless, persisting data is still a side effect; it is an action that changes state.  As such, there must exist (at least in principle) a dual action to undo the effect.

When I review code, I want to be aware of all its side effects, and I check if there exists code to undo these side effects.  If an application automatically persists some data, it is not necessary that this application will eventually delete this data automatically, but if that is not the case, then I want it to be the case this application provides the user the ability to delete this data.

Consider collections of persisted data that can grow arbitrarily large.  A common example of this is an application's logs.  If an application will delete (automatically or manually) all such persisted data, then I consider this application "data neutral", which is a play on the phrase carbon neutral.  In this case, the only a constant amount of the application's data will never be deleted.  Otherwise, an application is data positive, which is a bad thing.  Eventually, such an application will consume all of its storage space, even if it began with lots of it.

Don't let your applications be data positive.  Ensure that they are data neutral.

Sunday, May 20, 2018

Troubleshooting "Not Sent. Tap to try again." error in Android Messages

I use Android Messages to send SMS messages on my phone.  Sometimes I have a problem sending a message to a specific person.  I can still send messages to others, and I can still receive messages from everyone.  When this happens, it says "Not Sent. Tap to try again." underneath the message (see an example screenshot) about 20 seconds after attempting to send the message.  Once this problem starts, it does not go away on its own.  It will always happen when trying to send a message from within the app as well as from the reply feature on the notification of a new incoming message from the specific person.  It will not happen if I tell the Google Assistant to send them a message to the specific person and then dictate that message.

Here is a good sequence of troubleshooting steps for this problem (which can also be found elsewhere).

  1. Restart phone
  2. Clear app cache
  3. Clear app data
  4. Uninstall then reinstall app
I have tried all of these troubleshooting steps, and none of them deleted my conversations.  They are probably backed up somewhere.

This problem has happened to me twice.  The first time, I think I solved it by uninstalling and reinstalling the app.  The second time, I know that restarting my phone didn't fix the problem.  What did fix it was both clearing the cache and clearing the data.  I didn't try just clearing the cache.  If I am so mildly unfortunate as to experience this problem again, then I should check if just clearing the cache suffices.