input code:
public interface Course {
public int units();
public int numOfStudents();
public int maxNumStudents();
public boolean registered(Student s);
public void register(Student s);
}
public interface Student {
public void register(Course c);
public int totalUnits();
}
in the example code im trying to describe two separate objects (interfaces / classes / all), which, on the one hand, should be (I would like, at least) loosely coupled, but, on the other hand, depend on each other and require certain knowledge of each other.
in the above scenario, I need a third class that actually integrates them into a working system. its ugly, because at the moment the above definition is as weakly connected as it can be - student.register (c) changes only the student object, and course.register (s) changes only the course object. therefore, the concatenating class must run both s.register (c) and c.register (s).
although if I reinstall the entire register () logic into one class, then I will bind them tightly.
?