开发者

What dataclasses should I create in a 3-tier project?

I have a relatively small project and I'm using a 3 tier architecture. Now I'm thinking about on how to split up some of the fu开发者_Go百科nctions in different data classes.

For example I have a User class and a Group class. My User class has a User.GetGroups function and my Group class has a Group.GetUsers function. Would I put the first in the UserData class as UserData.GetGroups or in GroupData.GetGroupsForUser or perhaps a completely separate UserGoupData class?


Why not do both of your suggestions? Regarding GroupData.GetGroupsForUser: just the phrase "ForUser" makes me think "if it's for the user, why not put it on the user object?"

I would just do User.Groups, and Group.Users. I think both of your examples make sense.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜