Can you use the data right away?

  • If you need the result of a method, can you use it right away?
  • Maybe return values are a better fit than getters
  • If you need multiple values as a result, maybe an object is helpful?
// With getters
payrollManager.fetchEmployeeInfo(2020);
double salary = payrollManager.getSalary();
double bonus = payrollManager.getBonus();

// With returns / objects
EmployeeInfo info = payrollManager.fetchEmployeeInfo(2020);
double salary = info.getSalary();
double bonus = info.getBonus();

10 / 22