Create class based on roles

I am developing a application for sports clubs administraion. And my problem is that I have one primary class Member which contains all the "default" information (name, surname, gender...) and two other classes Coach and Practitioner which inherit from Member. A coach has some specific properties (salary, trainings held in current month...) wheres a practitioner has some others (isCompetitor, category ...)

The problem is that a Practitoner can also be a Trainer as well as the other way around. How can I model this into something that is better then having two entries for the same person?

Edit: this is how it looks now

Class Member {}
Class Coach:Member {}
Class Practitioner:Member {}


If you're only looking at them in one way at a time - so as one of a group of practitioners, or as one of a group of trainers - then you can create them as the specific type of member they are being viewed as at a time. If required, you can add a boolean property "IsTrainer" to practitioner and "IsPractitioner" to trainer, to indicate that there is more info about that person elsewhere.

This presumes you're only looking at them in one way at a time, and not getting a page with all info about the person.

You can create one class 'member' that contains a list of roles. Each role (coach and/or practitioner) inherit from a base class 'role' which contains all properties you now have in your member class. Coach and practitioner than have their own specific properties. So:

public class Member {

    public IList<Role> Roles { get; private set; }

    public Member(){
        Roles = new List<Role>();


public class Role {

    public string SomeGlobalProperty { get; set; }


public class Coach : Role {

    public string SomeSpecificProperty { get; set; }


public class Practitioner : Role {

    public string SomeSpecificProperty { get; set; }


SImeple: Realize that you basiaclly need to read an intro book into OOP.

A Member is a Member (and even that is disputable - acutally it is a Party, regardless of what it does).

It has different roles which are basically a collection of roles, all with start and end date.



I suggest reading "The Data Model Resource Book", volume 1 - they go into great detail about this standard problem and how most people get it wrong.

Need Your Help

Can I detect whether a submission is a self post using praw?

python api reddit

Is it possible to detect whether a user's submission on reddit is either a self-post or a link to an external URL?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.