Encapsulation
easy 35 minPut the data and the methods that work on it into one unit, and let outside code reach the data only through those methods.
Watch lesson4:51
What each level should show
The same question is judged differently for mid, senior and staff.
Junior
Must show
- Definition and one example
- Access modifiers
- Private field with a checked method
Will be probed on
- Why not public?
- What does UML minus mean?
Stands out
Names the rule that the class protects.
Mid
Must show
- Actions instead of setters
- Difference from abstraction
- When a plain record is better
Will be probed on
- Are getters enough?
- One rule or two copies?
Stands out
Shares one private rule between the question and the action.
Senior
Must show
- Swaps the inside and says what can still break
- Class, package or module as the unit
- Private is not security
Will be probed on
- Ledger change
- Protected fields, serialization
Stands out
Runs one test suite against two implementations.
Staff
Must show
- Migrates a published member without an outage
- Guards the border in the build
- Knows what becomes public by use
Will be probed on
- 200 callers
- Service walls and shared tables
Stands out
Counts files touched per change to see if the hiding pays.