17 hours ago
- Refinement allows changing database schema or behavior while preserving external properties, using mapping functions.
- Example 1: Migrating is_activated boolean to nullable activated_at column, using a refinement mapping to maintain compatibility.
- Example 2: Switching to an event sourcing model with user_events table, computing activated_at from events via a mapping.
- Refinement preserves external properties only if specific constraints (e.g., mutability rules) are respected.
- When constraints like C1 (no deactivation) exist, refinement may fail if the new model allows deactivation (e.g., via events).
- Refinement is a powerful but hard-to-learn formal method concept; introducing it in familiar contexts like databases may help.
- Refinement mappings relate to database views as both abstract underlying data for compatibility.