Low-Level / Object-Oriented Design / Stage 1 · Interfaces and invariants
Give each type an invariant and a narrow interface
"Already know" meets prerequisites. "Not relevant" removes the topic from your total but leaves what builds on it waiting.
Self-check
- Model a deck of cards in the language you use most. State each type's invariant in one sentence, expose only the operations a caller needs, and write a test that an invalid move (dealing from an empty deck) is refused.
- Evidence to include: Keep the types with their invariants written above them, the public interface, and the failing-move test with its output.
Try it without the material first, then compare. Save your answer in your notes below. Report a problem with this self-check
Learning activities
2 activities- Not done5 min
- Not done5 min