I have three classes: User
, Conversation
and Message
:
Message properties:
User sender;
// Some more
Conversation properties:
List<Message> messages;
List<User> participants;
// Some more
I want to show in the program the creator of the conversation. I wonder if It is bad programming to add a creator
property to the Conversation
class, so I could access it easily and the code would become more readable.:
List<Message> messages;
List<User> participants;
User creator
{
get
{
return participants[0];
}
}
// Use of the property:
conversationObj.creator;
// Instead Of:
conversation.participants[0];
Is it considered data duplication because I could get it directly from the participants
property? Or data duplication is wrong only when designing a database?
Thanks.