What is the best design

The problem statement is

The Annual sports day for a company is held annualy.

Each department of the company can represent members to take part in various events.

An event can be official/demonstration. Official events earn medals. An event also can be a team event or a individual event.

A department can represent only two member for an individual event, and a maximum of 1 team per each team event.

I have created a uml diagram for this problem statement. My dilemma is how best to represent the relation between Team , Event(official/demo) and medals.

The model i prefer is

1. Event Class - Which has a property for official/demonstration event

2. Event Type- Team/Individual

3. EventToEventType association = EventId, EventTypeId

4. Team Class -

5. EventToTeamRelation - EventToEventTypeId, TeamId

Could some one help with the best possible solution

[934 byte] By [rudolfcastelinoa] at [2007-11-26 17:58:27]
# 1

> The problem statement is

>

> The Annual sports day for a company is held annualy.

You mean "annually"?

> Each department of the company can represent members

> to take part in various events.

>

> An event can be official/demonstration. Official

> events earn medals. An event also can be a team event

> or a individual event.

>

> A department can represent only two member for an

> individual event, and a maximum of 1 team per each

> team event.

>

> I have created a uml diagram for this problem

> statement. My dilemma is how best to represent the

> relation between Team , Event(official/demo) and

> medals.

>

> The model i prefer is

>

> 1. Event Class - Which has a property for

> official/demonstration event

> 2. Event Type- Team/Individual

> 3. EventToEventType association = EventId,

> EventTypeId

> 4. Team Class -

> 5. EventToTeamRelation - EventToEventTypeId, TeamId

>

> Could some one help with the best possible solution

Define "best".

Why do you need objects to represent the relationships? Why isn't parent/child good enough?

I see there can be Individuals and Teams entered. A Team HAS-A Set of Individuals associated with it. I don't see that in your description. I think you might need a Department class, too. A Company can be a collection of Departments.

It sounds like an Event has many Medals. Event ought to be a superclass, with IndividualEvent and TeamEvent subclasses. IndividualEvent will have a Set of Individuals entered, while a TeamEvent will have a Set of Teams entered. You'll embed the rules for max number of Individuals and Teams per Department.

You can do a lot more with this model than you've posted here.

%

duffymoa at 2007-7-9 5:11:46 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

I typically use a worksheet like:

Use Cases:

company_admin -> (maintain events)

dept_mbr -> (participate in sports event)

dept_admin -> (submit mbr to indv_event)

dept_admin -> (submit team to team_event)

where each of the above use case being associated with the following data relationships:

company_admin -> (maintain events)

company -> (*)dept ( "company has many departments" )

company -> (*)event

event -> (0 or 1)official_event

event -> (0 or 1)demo_event

event -> (0 or 1)team_event

event -> (0 or 1)individual_event

mbr -> (participate in sports event)

sports_event -> (*)mbr

dept_admin -> (submit mbr to individual_event)

dept -> (*)mbr

individual_event -> (*)mbr

dept_admin -> (submit team to team_event)

dept -> (*)team

team_event -> (*)team

The above worksheet suggests the following class relationships:

EventDTO << has a >> IndividualEventDTO

EventDTO << has a >> TeamEventDTO

OfficialEventDTO << is a >> EventDTO

DemoEventDTO << is a >> EventDTO

OfficialEventDTO << has many >> MedalDTO

TeamEventDTO << has many >> TeamDTO

IndividualEventDTO << has many >> MemberDTO

DepartmentBO can enforce business rules like "A department can represent only two member for an individual event, and a maximum of 1 team per each team event".

annamuda at 2007-7-9 5:11:46 > top of Java-index,Other Topics,Patterns & OO Design...