Architecture

Kolofon · 7 August 2026

08 · Ratings and views

half a star is a unit, not an ornament

08 · Ratings and views

Text: Kolofon

Under every entry there is a star rating, and on the listings a legible badge with the average. It looks like the simplest element on the whole site and it was one of the trickier ones.

First decision: an internal scale from zero to ten, where one point is half a star. It follows that half a star has to be a whole number if the average is to be computed without rounding errors. It is the kind of decision you either take at the start or pay for by rewriting the data later.

Second: one rating per browser, but changeable any number of times. That means the server must be able not only to add a vote but to correct a previous one — so on a change the old value is sent along and the server subtracts it from the sum. Without that, changing a rating would inflate the vote counter indefinitely.

Third, and the most interesting in its effects: the stars on the listings should refresh the instant a vote is cast, with no page reload. This is handled by shared state in the browser with simple notification — the rating component announces a change and every badge on the page picks it up.

A field was also added for a provisional rating from the author. A freshly published entry with no votes would display zero stars, which looks like a verdict but is an absence of data. Now, until the first reader votes, the author's rating is shown, clearly marked as provisional.