New answers tagged serialization
Every time you make a code change that touches your serialization, you must add a new test case in your automated test suite that uses the new fields, or reads the old fields, etc. Over time you'll accumulate more and more coverage for your version transitions. As long as you run your test suite whenever you make changes you'll get notified when you stop ...
How do I automate something (possibly a test) that tells me when I need to write a migration script and when I need to change the data's version number? When your automated unit tests fail while importing old data into a newer model, that's one very clear indicator that you need to write a migration script/process.
tl;dr I suggest static methods, or even instance methods can be alright depending on the objects you're working with and how long lived they are as well as how stateful they are. Do not use properties for this. Properties should be as idempotent as possible (repeated access should return the same result constantly). If A property needs to execute logic to ...
Top 50 recent answers are included