Make Logical Dependencies Physical

Modules dependent on other modules shouldn't make `Logical` assumptions about the other module; they should be explicitly asked for in code.

public class HourlyReporter {
  private HourlyReportFormatter formatter;
  private final int PAGE_SIZE=55;
  public void generateReport(employees) {
    for (HourlyEmployee e : employees) {
      addLineItemToPage(e);
      if(page.size() == PAGE_SIZE) {
        printAndClearItemList();
      }
    }
}

The HourlyReporter assumes that the PAGE_SIZE is 55. This should be the formatterś concern, not the managerś. The HourlyReporter is making a logical assumption that should be the job of the formatter's instead, which should contain a method getMaxPageSize() for the HourlyReporter to use.



bj 2019-09-22