Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sept 200592.3913 Ron McFadyen1 Class Diagram Comparing different models Well examine the ternary association from last day, and two other models. Often.

Similar presentations


Presentation on theme: "Sept 200592.3913 Ron McFadyen1 Class Diagram Comparing different models Well examine the ternary association from last day, and two other models. Often."— Presentation transcript:

1 Sept 200592.3913 Ron McFadyen1 Class Diagram Comparing different models Well examine the ternary association from last day, and two other models. Often ternary examples appear in texts without any real context. We will think now of the goalie statistics in a larger framework. To determine which model is best or better means we have to consider the business rules that are reflected in a model. What business rules do we need in a hypothetical system?

2 Sept 200592.3913 Ron McFadyen2 Class Diagram N-ary associations Consider a team, its goalies, and the season. We could record the performance of each goalie for each team and each season. Team Year * Player * * goalie Record goalsFor goalsAgainst Wins Losses ties season team Model A – from last day A ternary association capturing an interaction amongst 3 objects. This model may only be good for capturing goalie statistics by team, by season

3 Sept 200592.3913 Ron McFadyen3 Class Diagram Now, consider binary associations only Consider some other business rules: BR: Each season teams register to participate in the sports league. TeamYear ** Note that we could use an association class for additional attributes to describe the association, or for the association participate in associations Note that this business rule wasnt covered in the Model A seasonteam Model B

4 Sept 200592.3913 Ron McFadyen4 Class Diagram Using binary associations Consider business rules: BR: Each year each registered team has players and some of these will play as goalies. Note that a goalie could play on multiple teams each year. Player * goalie TeamYear ** RegTeam seasonteam *playsAsGoalie registers Model B Now we are also capturing the fact that registered teams have goalies

5 Sept 200592.3913 Ron McFadyen5 Class Diagram Using binary associations Consider business rules: BR: Each registered team keeps statistics for each goalie Player * goalie Record goalsFor goalsAgainst Wins Losses ties TeamYear ** RegTeam * seasonteam Model B

6 Sept 200592.3913 Ron McFadyen6 Class Diagram Using binary associations Its clear with this model that we are recording registered teams separately from the performance statistics of goalies. Model A does not facilitate team-related information. RegTeam is a place to keep information such as president, colours, homeField Player * goalie Record goalsFor goalsAgainst Wins Losses ties team TeamYear ** RegTeam * seasonteam Model B

7 Sept 200592.3913 Ron McFadyen7 Class Diagram Model C, another alternative One binary association between Year and Team, and a 3-ary (ternary) association amongst Year, Team, and Player Player * goalie Record goalsFor goalsAgainst Wins Losses ties team TeamYear ** * seasonteam * season RegTeam Which model is better, model B or model C? Does model C allow some connections that model B does not?


Download ppt "Sept 200592.3913 Ron McFadyen1 Class Diagram Comparing different models Well examine the ternary association from last day, and two other models. Often."

Similar presentations


Ads by Google