inheritance - How to remove this parallel hierarchy -


i'm trying find best design following scenario - application store results of dance competitions.

an event contains multiple rounds, each round contains number of performances (one per dance). each performance judged many judges, return scoresheet.

there 2 types of rounds, final round (containing 6 or less dance couples) or normal round (containing more 6 dance couples). each requires different behaviour , data.

in case of final round, each scoresheet contains ordered list of 6 couples in final showing couple judge placed 1st, 2nd etc. call these placings "a scoresheet contains 6 placings". placing contains couple number, , place couple is

in case of normal round, each scoresheet contains non-ordered set of m couples (m < number of couples entered round - exact value determined competition organiser). call these recalls: "a score sheet m recalls". recall not contain score or ranking

for example in final

  • 1st place: couple 56
  • 2nd place: couple 234
  • 3rd place: couple 198
  • 4th place: couple 98
  • 5th place: couple 3
  • 6th place: couple 125

for normal round following couples recalled 54,67,201,104,187,209,8,56,79,35,167,98

my naive-version of implemented as

event - has_one final_round, has_many rounds

final_round - has_many final_performances final_performance - has_many final_scoresheets final_scoresheet - has_many placings

round - has_many perforomances performance has_many scoresheets scoresheet has_many recalls

however not duplication requires, , have several parallel hierarchies (for round, performance , scoresheet) going pain maintain.

this requires little domain knowledge don't have, seems me ordered vs. non-ordered situation little bit irrelevant. if each couple has score, ordering in final round can deduced each couple's score, right? mean final round's data structure every other round's data structure, consisting of multiple (couple, score) sets.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -