Hacker News new | past | comments | ask | show | jobs | submit login

They really are optional though. This is inherent in the problem if you want to support arbitrary past and future versions. You need to decide what to do when the data is missing. Open file formats are a difficult problem. [1]

I might define a different class for a validated object, so version skew only needs to be dealt with at the system edge.

Maybe you don’t actually have that problem because you can make a closed-world assumption? For example, you control all writers and aren’t saving any old-format data, like in a database that has a schema. In that case you can make fields required.

[1] https://acko.net/blog/on-variance-and-extensibility/




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: