At PDC (and before that on ObjectSpaces project), this was a hot discussion topic. What approach is better: attributes or external source like an XML file. I would like to open up this topic beyond the 1:1 conversations at PDC to the blogosphere. I will start with a small backgrounder and you tell us which one makes more sense to you.

Advantage attributes

  1. Really simple for the basic cases. No need to create or consult (e.g. for debugging) another source file. Works with current tools that handle attributes.
  2. Easy access to mapping metadata without additional APIs.
  3. Requires recompilation for changes. No, this is not a mistake. Despite situations that make recompilation problematic, usually having a compiler check things is better than getting run-time exceptions

Advantage external mapping

  1. Same classes can be mapped to multiple data models using different mapping files (this includes different DB/table/column names, different server vendors etc.)
  2. Avoids clutter in source code, especially in case of complex mapping
  3. Hides database-specific information from users of object model
  4. Some schema changes can be handled without recompilation (IMO, the class of changes that can be handled is often exaggerated)

Of course, a natural question is why not support both? Well, as a user, which one should I choose? How do I decide? Do I need to learn both ways? As builders of the ORM component, do we split out resources on two things that achieve more or less the same result instead of focusing on one?

So what do you think. Do you have compelling scenarios that cannot be handled using one of the options?