Skip to content
papuh

Building apps

Improvements and the bug that taught me most

How the app grew with use, four versions in one evening, and a wrong entered value that showed double. The tests were green and it was still wrong.

Treatment decisions are made by a doctor. This describes building an app, not advice.

The app grows with use

I installed the first version at the end of October. A week later I went through the things I had missed while using it with the AI, in one evening. Not big features, more small things around logging an injection. The routine was always the same: a short request, the AI changes the code and adds a test, all tests run and the new version is built. That evening produced versions 0.2 to 0.5. The first three went straight to the phone; the last one waited until I connected the phone again.

Version 0.2: what I missed when logging

  • The last injection right in the log dialog. The dialog for a new entry has a card with the last injection: date, amount, pen and injection site.
  • The last site marked “last time”. The app does not preselect the next injection site; it only shows where the last one was. Choosing the other side is up to me.
  • A prefilled amount. The calculator follows the active pen and prefills the amount from the prescribed amount I entered for the pen as my doctor set it. If the pen has none, it takes it from the last injection from the same type of pen.
  • A test notification. A button in Settings that sends a reminder right away, and a list of all scheduled reminders. I wanted to see that reminders really arrive.

After this version there were 21 tests. The new version installed over the old one and all entries stayed.

The bug

The same evening it turned out that the Calculator and the button on Home were showing twice what they should.

The calculation was fine. The tests were green. The problem was in the data. A pen that had one strength in its name had half of that saved in the app. So the app calculated precisely, just with a wrong value stored for the pen. It could not be seen on the screen, because at the pen I read the name, not the stored strength.

The injection log was fine. The pen’s strength had changed only after those entries.

This is a bug that tests do not protect you from. A test checks that the app calculates correctly with the values it gets. It does not check that a value entered by a person matches reality.

What we changed in version 0.3

  • Fixing the data. The AI corrected the strength directly in the app’s data file on the phone. Before that it put a copy of the original file next to it, so the change could be reversed.
  • The pen name follows the strength. For the preset pen type the editor keeps the name in line with the strength. Reason: the name is what I read at the pen. When the name and the value say two different things, people believe the name.
  • A warning when the strength changes. When the strength of an existing pen changes, the app says so explicitly and does not let it happen silently.

With this version I also verified the test notification. It arrived.

Version 0.4: remove what has done its job

I then had the test notification removed. It had done its job, reminders work, and another button in Settings would only get in the way. The list of scheduled reminders stayed; I use that.

This is part of working with an AI too: not everything that gets built has to stay.

Version 0.5

The last version that evening added one more optional field to the pen, which is explicitly my own estimate and the app labels it as such. The app claims nothing about it and blocks nothing based on it; it only shows what follows from it according to my log. There were 24 tests.

What working with an AI looks like in practice

After that evening I have a clearer idea of working with an AI:

  • Short requests. One thing at a time, described by what I miss when using the app, not by how to program it.
  • Checking on the phone after every version. Tests tell me whether the calculation is right. Whether it makes sense in the hand, only I can tell.
  • Every decision written down with its reason. Why the name follows the strength, why the app does not preselect the injection site. A month later I would not know otherwise.

Why this is the reason I do not give the app to others

The pen strength bug is exactly what I am afraid of with an app for other people. The app calculated precisely, the tests were green and nothing looked odd on the screen. Someone who did not build the app and does not know what result to expect for their own pen could take double for the correct result.

More on why the app is not available for download is in part six.