Glossary

Encapsulation

Encapsulation is hiding the internal implementation details of an object and providing controlled access through a public interface. External code knows only what the object does, not how.

Access modifiers

Why it matters

A class can change its internal implementation without affecting external code. Example: changed balance storage from int to a Money VO — external code is unaware because it only calls getBalance().

Getters and setters

Not mandatory — they are an implementation detail. Duplicating a field $name with a getter getName() for no reason violates DRY. Expose only what external code genuinely needs.