So I have an application thats main purpose is to manage customers. My issue is that I'm not sure how to tie everything related to the customer together? For the sake of this post, let's pretend that a customer can have an unlimited number of emails. Below is what I was envisioning:
class Customer {
private int id;
private String name;
private List<Email> emails = new List<Email>();
public Customer(id, name) {
this.id = id;
this.name = name;
}
public addEmail(Email email) {
emails.Add(email);
}
public getEmails() {
return emails;
}
}
class Email {
string email;
public Email(email) {
this.email = email;
}
}
Customer newCustomer = new Customer(123, "Dummy Customer");
newCustomer.addEmail(new Email("[email protected]"));
I'm aiming towards this design because this way, say I need to make customers associated to a company representatives I could simply add another list member. Also, I tried Googling but I'm not really sure what this problem is called.
Here are some of the things I am unsure of:
- How rock solid is this design?
- As I add new entities to the customer class, wouldn't it get a bit large in terms of what it's responsible for?
Thank you.