Let's assume i have two classes which look like this:
public class Human {
private String name;
private String id;
private List<Bike> bikes;
}
public class Bike {
private String model;
private String id;
private String type;
}
Now, is it a good idea to put String humanID
into bike class? I can do pretty every operation with current structure, but if for example i get bike object and want to know his owner, i need to iterate over humans collection. On the other hand if i put humanID inside bike, i feel it would be kinda redundant information, because relation(agregation) itself tells who is the owner. So can someone explain which one is the right approach and why?