TDD, Continous Deployment, and Persistence - how to concile them?
<p>In my company we are refactoring some applications, and one of the aspects to be refactored are the classes of data representing "user objects", that is, objects that the user creates and must be persisted locally.</p>

<p>We are striving for Continuous Deployment workflow, such as the application should grow in functionality, while the installed base should grow in numbers.</p>

<p>But since the design of each class being serialized is defined by how they support use-cases, and given that design will change as features are better understood and modeled, how should we handle the local, client-side persisted objects - which are valuable assets from each user's perspective - when eventually the design "breaks"?</p>

<p>The following example is just for illustration, since the problem can take many possible forms, be it the changing of property type, or the adding/removal of properties. The class below has a <code>Platform</code> property that tells which platform a given device is compatible with:</p>

<pre><code>public class Device
{
    public PlatformEnum CompatiblePlatform {get; set;}
}
</code></pre>

<p>So, we deploy the system to some customers, which start to use it and persist a lot of <code>Device</code> instances to their file systems.</p>

<p>But eventually the need/possibility arises for each Device to be compatible with <em>more</em> than one <code>Platform</code>, and thus the class now contains a <em>collection</em> instead of a single value for <code>CompatiblePlatform</code>:</p>

<pre><code>public class Device
{
    public IEnumerable&lt;PlatformEnum&gt; CompatiblePlatforms {get; set;}
}
</code></pre>

<p>So now we have a problem: how to handle the considerable amount of serialized files, so that they are automagically loaded by the new version of the design?</p>

<p>And, more broadly, how should I try to concile "Design up front", in the case of design of serializable classes, with the "Emergent Design" of user-story-based ATDD? Should I use some sort of versioning, or should I take some well-known set of precautions?</p>