public class Member
{
Team team;
int p;
public void GoToTeam(Team team) // 1. how to name it?
{
this.team = team;
p = team.GetHashCode(); // some setup for team changing
}
public void AddMember_wrapper(Team team) // 2. most software users are members, do I need this?
{
team.AddMember(this);
}
}
public class Team
{
List<Member> members = new();
public void AddMember(Member member)
{
members.Add(member);
// and something more, member maps etc
}
}
Member has a GoToTeam function, which cannot work alone, without being called by functions like AddMember.
How to name these helper function in c#, to prevent it to be called alone by mistake?
A good class design would help. Like always Team do action to lower hierachies.
But member is the basic action unit. Do I need a ugly member.AddTeam_wrapper()?
Is there a more straightforward way to do this?
Like __GoToTeam in other languages.
I'm working on composite patterns.
A lot of classes are hierachically structured.
Methods are used to change their relationship.
It's easy to use a half-function by mistake, without a detailed documentation.
I want a good naming convention to describe these public methods and public but not standalone methods.
Thank you!
Aucun commentaire:
Enregistrer un commentaire