title: What's the difference between data and code?
body: <p>To take an example, consider a set of discounts available to a supermarket shopper. </p>
  
  <p>We could define these rules as data in some standard fashion (lists of qualifying items, applicable dates, coupon codes) and write generic code to handle these. Or, we could write each as a chunk of code, which checks for the appropriate things given the customer's shopping list and returns any applicable discounts. </p>
  
  <p>You could reasonably store the rules as objects, serialised into Blobs or stored in code files, so that each rule could choose its own division between data and code, to allow for future rules that wouldn't fit the type of generic processor considered above.</p>
  
  <p>It's often easy to criticise code that mixes data in, via if statements that check for 6 different things that should be in a file or a database, but is there a rule that helps in the edge cases?</p>
  
  <p>Or is this the point of Object Oriented design, to stop us worrying about the line between data and code?</p>
  
  <p>To clarify, the underlying question is this: How would you code the above example? Is there a rule of thumb that made you decide what is data and what is code?</p>
  
  <p>(Note: I know, code can be compiled, but in a world of dynamic languages and JIT compilation, even that is a blurry concept.)</p>