سؤال

Seasoned with ER schemas I'm having a doubt with associations from passing to UML Class Diagram.

Consider this simple scenario:

You have to create a software system for a soccer team.
A team has almost 11 players and a player can play for just 1 team. You want to know:
-about the player: name, surname,role, team for who he plays, team/s for who he played and starting-end year
-about the team: name, city

Is this a correct uml class diagram for this situation?

My doubt is about the info "A team has almost 11 players":

  • this info implies a bidirectional association Player-Team or due to the fact that we are not interested having a team to a reference to the players it has to be 1-way?My doubt comes because in this case I found only bidirectional associations.

  • Does it make sense an association class in a one-way association?

هل كانت مفيدة؟

المحلول

As you have set it, you will have to make a non-class construction inside Player and Team, that will do the class' work.

I would advice another structure.

All info will be contained in the Participation class, that will be mapped to DB table or a file. All other interesting info on team and player will be got by functions.

enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top