Developer encodes ancient Chinese astrology system in Go, finds domain modeling lessons
A software engineer spent evenings over the past year building a Go-based engine to compute Zi Wei Dou Shu, a Chinese astrology system dating to the Song dynasty. The project involved modeling a complex directed graph of twelve palaces and up to 48 transformation edges. Recurring bugs stemmed not from crashes or nil errors, but from data structures that failed to capture distinctions the tradition itself made — producing fluent yet factually wrong output. A key example involved self-transformations, where a palace's energy lands back on itself, carrying a meaning opposite to an outbound flight. The developer found that encoding such distinctions directly into types, rather than relying on runtime guards, was the only fix that held across multiple downstream consumers.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in