Forward Compatibility
The ability of an older version of a system to accept input produced by newer versions, usually by safely ignoring what it does not understand.
Also known as: Forwards Compatibility, Forward Compatible, Upward Compatibility, Must-Ignore Rule
Category: Software Development
Tags: software-development, software-engineering, compatibility, api-design, software-architecture, evolution
Explanation
Forward compatibility is the harder half of compatibility. Backward compatibility asks new code to understand old data, and you know exactly what the old data looks like. Forward compatibility asks old code to cope with data from a future it knows nothing about. You can only get it by designing for the unknown from day one.
**How systems achieve it**:
- **The must-ignore rule**: Skip what you don't recognize. Browsers ignore unknown HTML tags and unknown CSS properties. HTTP clients and servers ignore unknown headers. That single rule let the web evolve for thirty years
- **Preserve what you don't understand**: When you read a record, change one field and write it back, keep the unknown fields. Protocol Buffers does this. Otherwise an old service silently deletes data that a newer service wrote
- **Reserved space and extension points**: Version fields, reserved bits, extension blocks. They only work when everyone handles them correctly (see Protocol Ossification)
- **Must-understand markers**: Sometimes ignoring isn't safe. A flag that says "reject this if you don't understand it" covers those cases
- **Unknown enum values**: Treat a value you don't know as "unknown" or as a default, not as a crash
**Where you need it**:
- **Rolling upgrades**: During a deployment, old instances receive messages from new instances
- **Mobile and desktop clients**: Old app versions stay in use for years and talk to current servers
- **Stored data**: Old readers meet files written by newer writers
- **Event streams**: Consumers lag behind producers
**Link with Postel's Law**:
The must-ignore rule is the healthy core of "be liberal in what you accept". The difference is precision. Ignoring a well-formed element that you don't know is a rule that every implementation can apply the same way. Guessing the meaning of malformed input is not.
**Limits**:
Forward compatibility can't cover a change of meaning. If a new version redefines an existing field, old readers will misread it without noticing.
Related Concepts
← Back to all concepts