Technology

Engineering record

EngineIn use

Rebuilding the engine from its data model

In October we worked from the old code and rebuilt its old structure as well. This time we define the data to store first, then rebuild the engine.

The rules are decided in several places, and the same state has several copies. Fix one place and you have to decide again what to do with the other copies. If you patch code like this bit by bit, you end up looking for answers that fit the structure already there. Rebuilding from scratch doesn't change that by itself. We rebuilt the app in October too, but because we used the old code as the spec, the old code's rules and its leftovers came along with it.

This time we changed the starting point. We first decide what has to be stored for a person, then build the engine to fit that data model. All we can take from the old code is on-screen wording, numeric rules, and the field names of records already saved. We don't keep anything else just because it used to be that way.

When new code and old code live together

We could build the new code next to the old and switch over. It looks safer, but for a while we'd have to maintain two implementations, and whenever a rule changed we'd have to decide again which side is right. We can't be trying to get rid of copies of the same fact while making two copies of the code. So we deleted all of the app engine's product code first.

In the app engine's 86 files we added 80 lines and deleted 52,768. In the shared engine we also deleted 7,495 lines that handled requests, sync and sessions, and the foundation of the new data engine started at 1,061 lines.

In the new engine, we save only through one fixed function. That change and the work to be sent to the server are committed in the same transaction. The condition that outlived the Crux revert became the foundation of the new structure.

Written from that day’s point of view, using the documents and change history of the time. Published 2026.12.01.