Skip to content
JournalTORIS / FIELD NOTES

← Blog Project notes

Between scene1 and a UUID: Rethinking the Role of IDs in an Education Viewer

On the identifier problem of scene and content IDs in an education viewer, and why treating order, reference, and display number as one value makes edits hard.

2 min read Read the Korean original

Joohwan Yu · Founder, Full Stack Developer

Toris · Published

Contents

When I built the JSON for the education viewer, some IDs had to be set by hand, like scene1 and scene2, while others could be generated as UUIDs. At first it looked like a difference in how strings are generated. But as the work continued, the point turned out to be not the name but who references that value.

An identifier that looks like order

When a scene name includes a number, it’s easy to assume it equals the array order. But the problem changes once you insert a scene in front or add a cover. There’s no guarantee that the third scene on screen is the third item of the learning problems. If an external tool references a particular scene, changing the screen order can turn into changing references.

At the time, while composing scenes and their internal content in CreateJson, I needed to distinguish values to generate automatically from values the caller has to supply. If you switch everything to UUIDs, you miss the existing convention, and if you make everything sequential numbers, even content that should be handled independently gets tied to order.

If I did it now, I would write down three things separately

ValueRole to give itWhen it changes
Scene IDConnecting saved state and external referencesWhen the scene’s identity changes
Array positionCurrent playback orderWhen a scene is moved
Display numberThe learning number the user seesWhen the rules for including covers and questions change

This table doesn’t mean the implementation at the time was exactly like this. It is a re-organization of the questions from then into today’s design criteria. If the existing format requires scene1, I would first keep compatibility, but put a boundary in place so the rules for interpreting the number don’t spread across several components.

When it’s generated was part of the contract too

More important than the UUID itself is when it’s generated. An ID generated once when the content is first created and an ID generated whenever the screen is redrawn lead to entirely different results. The latter may not connect to saved solving state. The JSON generator was a tool for producing data, and also a tool for creating the promise between the later screen and storage.

Through this work I learned to tell apart names that are easy for people to read from names that a system will reference for a long time. Settling a small ID rule first was not over-design. It was work to secure the freedom to reorder content later.

Related post: Experience developing an education content platform

Advertisement