# Encapsulation

Record: `arch:encapsulation`
Kind: principle
Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)
Severity: mandatory
Scope: class, module, component
Canonical: https://banes-lab.com/ontology#arch-encapsulation

## Repair

- Refactored by: Hide Field, Introduce Method, Restrict Visibility
- Detected by: public state, excessive setters, external invariant manipulation
- Violated by: public mutable fields, leaky getters, direct state mutation
- Measured by: public surface area, mutation exposure
- Enforced by: visibility rules, linting, API review

## requires

- [Information Hiding](https://banes-lab.com/records/arch/information-hiding.md)
- [Stable Interfaces](https://banes-lab.com/records/arch/stable-interfaces.md)

## reinforces

- [Abstraction](https://banes-lab.com/records/arch/abstraction.md)
- [Low Coupling](https://banes-lab.com/records/arch/low-coupling.md)

## enables

- [Change Isolation](https://banes-lab.com/records/lex/change-isolation.md)
- [Invariant Protection](https://banes-lab.com/records/lex/invariant-protection.md)

## conflicts-with

- [Exposed Internals](https://banes-lab.com/records/lex/exposed-internals.md)
- [Anemic Encapsulation](https://banes-lab.com/records/lex/anemic-encapsulation.md)
- [Feature Envy](https://banes-lab.com/records/arch/feature-envy.md)

## tensions-with

- [Debuggability](https://banes-lab.com/records/lex/debuggability.md)

## tensions

- [Encapsulation Debuggability](https://banes-lab.com/records/tension/debuggability-encapsulation.md)

## referenced-by

- [Command Pattern](https://banes-lab.com/records/arch/command-pattern.md)
- [Iterator Pattern](https://banes-lab.com/records/arch/iterator-pattern.md)
- [Memento Pattern](https://banes-lab.com/records/arch/memento-pattern.md)
- [Invariants](https://banes-lab.com/records/arch/invariants.md)
- [High Cohesion](https://banes-lab.com/records/arch/high-cohesion.md)
- [Information Hiding](https://banes-lab.com/records/arch/information-hiding.md)
- [Factory Pattern](https://banes-lab.com/records/arch/factory-pattern.md)
- [Explicit Boundaries](https://banes-lab.com/records/arch/explicit-boundaries.md)
- [Aggregate](https://banes-lab.com/records/arch/aggregate.md)
- [Value Object](https://banes-lab.com/records/arch/value-object.md)
- [Entity](https://banes-lab.com/records/arch/entity.md)
- [Introspection](https://banes-lab.com/records/arch/introspection.md)
- [Facade Pattern](https://banes-lab.com/records/arch/facade-pattern.md)
- [Proxy Pattern](https://banes-lab.com/records/arch/proxy-pattern.md)
- [State Isolation](https://banes-lab.com/records/arch/state-isolation.md)
