Take a User class and the idea that a User is to be profiled. I see four ways to handle this:
Write the code for the profile into the User class. I am dismissing this right away.
Create a Profile class and make it a property of the User class.
Write a User class (with the boiler-plate name, address stuff), write a Profile class, and write a UserProfile class - UserProfile is the union of User and Profile.
Write a User class and a Profile class that each have an ID property and let the ID act as the intersection. This way the User and Profile are independent and another class, possibly an abstract class with nothing but static methods handles the logic that describes the connection.
Choices 3 and 4 each require at least three classes. For this case, which is the best choice? If possible to generalize this, would it generally be better to use one of these possibilities?
User
is to be profiled", what does that mean? What does yourProfile
class model?