# Null Semantics Drift

> A defect in which null, empty, zero and missing are used interchangeably for one field.

Record: `architecture:null-semantics-drift`
Kind: anti-pattern
Layer: [Enforcement Core](https://banes-lab.com/records/layer/enforcement-core.md)
Severity: discouraged
Scope: semantic_consistency
Canonical: https://banes-lab.com/ontology#architecture-null-semantics-drift

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Exception Control Flow](https://banes-lab.com/records/architecture/exception-control-flow.md) and before [Anemic Domain Model](https://banes-lab.com/records/architecture/anemic-domain-model.md).

## Repair

- Refactored by: define_absence_semantics, use_option_result, schema_nullability, normalize_input
- Detected by: null_and_empty_string_same_field, optional_field_without_semantics, truthy_checks_for_domain_state
- Violated by: Use null, undefined, empty string, zero, false, missing field, and empty collection interchangeably.
- Measured by: fields with more than one representation of absence
- Enforced by: schema nullability rules, strict null checking

## Severity

- [discouraged](https://banes-lab.com/records/vocabulary/severity-discouraged.md)

## Category

- [Anti-patterns](https://banes-lab.com/records/architecture-category/anti-patterns.md)

## Force

- [Semantic consistency](https://banes-lab.com/records/force/semantic-consistency.md)

## Negated by

- [Null Object Pattern](https://banes-lab.com/records/architecture/null-object-pattern.md)

## Linked from

- [Anti-patterns](https://banes-lab.com/ontology/principles/architecture-category-anti-patterns.md)
- [Behavioral Patterns](https://banes-lab.com/ontology/principles/architecture-category-behavioral-patterns.md)
- [Failure shapes](https://banes-lab.com/ontology/reasoning/the-failure-shapes.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The forces](https://banes-lab.com/ontology/schema/the-forces.md)
