Missing Person

This is a pattern I have discovered surprisingly often (you can also replace Patient with Customer and Doctor with Employee etc):

public interface Patient {

  String getFirstName();

  String getLastName();

  String getAddress();

  // ...

}

public interface Doctor {

  String getFirstName();

  String getLastName();

  String getAddress();

  // ...

}

Either doctors are very healthy, or they are so shy they want another identity as patients :)

Of course extra complexity isn't good either, but I have seen more often reason to extract the missing Person entity here than not to.

Originally published on 2007-10-05 at http://www.jroller.com/wipu/entry/missing_person under category Software Architecture