title: Coredata: Strategy Pattern Implementation
body: <p>I'm trying to implement the Strategy pattern using Core Data and Objective C.</p>
  
  <p>To simplify, I have, say, a multilingual <code>Text</code> entity, which has several attributes, such as a <code>Date</code> for last saved, and a <code>NSSString</code> for author etc etc. I want to add a reference to a <code>Language</code> entity, which could be one of several subclasses, such as <code>French</code>, <code>Italian</code> and so on, holding an <code>NSString</code> of text in the language of the class name. Each of the <code>Language</code> subclasses can implement their own <code>translateTo</code> and <code>translateFrom</code> methods and the <code>Text</code> instance doesn't need to worry about it. Simple Strategy Pattern.</p>
  
  <p><a href="http://yuml.me/1caedd69" rel="nofollow noreferrer">Created by yuml.me http://yuml.me/1caedd69</a></p>
  
  <p>I'm really struggling to set up this kind of relationship with Core Data, where a certain <code>Text</code> entity can be set up with its own <code>Language</code> implementation depending on the details of the instance.</p>
  
  <p>I suppose in a nutshell, what I'm trying to do is create a "has-a" relationship, where the entity inside the <code>Text</code> entity can be one of several subtypes of <code>Language</code>.</p>
  
  <p>Core Data is quite new to me, so if I'm completely missing the point here, or have missed something glaringly obvious, please let me know.</p>