← Back to Week 5

Derived or Stored?

Each getter belongs to a class with specific fields. Should it just return a stored field, or derive (calculate) the answer from the fields?

Score
0 / 0
Question
1 / 12

Class context

The getter in question:

Should this getter be stored or derived?

Final Score

Rule of thumb: if the value can be computed from existing fields, derive it — don't store the same truth twice.

← Know vs Do Sorter Pyramid Climber →