Construction
Lecture Oo20
Gymnastics System Example Cont’d
References
The Booch Method Guide, for Rose 2.0 Fowler & Scott, UML Distilled Applying
the Standard Object Modeling Language, AWL, 1997, Chapt 2
Teaching Points
Design activities Implementation classes
Review
How would you protect your architecture from a change in DBMS?
What is an executable release plan?
Design Activities
Reapplication of the micro process but at a greater level of detail
Less Abstract Specification and Implementation
perspectives used
Identify Key Abstraction
Now we identify abstractions in the solution domain
Classes needed to describe How we will solve the problem
Introduce controller classes
Relationships
Navigation paths specified where needed for association relationships
Some associations converted to aggregation or dependency
Container classes introduced for 1 to many relationships
Attributes
Specify field or reference Access control specified
Operations
Algorithms described in more detail Access control
Executable release: Scoring Report
Goal: Verification and successful use of navigational paths and score derivation logic for the scores of a competition.
Start Date: 26 Aug 98
Effort: 12 developer-weeks
Classes to be implemented: Competition, Event, Trial, RawScore, Team
Use Cases to be Implemented: Scoring
Inputs: Dummy database (validated in advance) with a meet, a competition, all events for that competition, all competing teams and gymnasts for the competition, and all trials and raw scores.
Outputs: The data needed to build the report on Figure 4-3, “Output of the Gymnastics System,” on page 25 of requirement spec. A DB utility dump of the raw input for comparison.
Meet: Town InvitationalCompetition: Women’s Senior TeamDate: 12/3/92
EventScores
Team Beam Vault Bar Floor
Flippers 41.5 40.3 44.6 43.7
Acrobats 42.2 38.5 41.0 40.6
Tumblers 37.3 39.8 42.3 41.3
Jugglers 36.8 41.0 37.4 39.6
: Meet
: Competition
: Event : Team
: Club : ResultsGenerator
Building the results report for a competition:
1. Get the title of the meet2. Get tehe date of the meet3. Get the name of the competition4. Get a list of events in the competition5. For each of the events get the name of the event6. Get a list of competing teams7. For each team in the competition get the team's club8. Get the club's name9. Get the team's overall score in the competition10. For each team in the competition get the team's score in the event.
1: getTitle( )2: getDate( )
3: getTitle( )
9: teamScore( )6: getTeams( )4: getEvents( )
5: getTitle( )10: teamScore( )
7: getClub( )
8: getName( )
ResultsGeneratorClub
name : String
getName()
(from People)
Meet
date : Datesite : Locationtitle : String
registerClub()getTitle()getDate()
Team
getName()getClub()
(from People)
1
*
1
*
competing teams
Competition
enterteam()individualScore()getTitle()teamScore()getTeams()getEvents()
1
1..*
1
1..*
contests*
* +participant
*+entrants
*
Event
addJudge()score()individualScore()teamScore()getTitle()
1
1..*
1
1..*
Scoring Algorithm
English:
Each judge rates each gymnast on the event and reports the score to a scorekeeper. The scorekeeper throws out the high and low scores and averages the rest. This is the gymnast’s score for the event.
Scoring Algorithm
Score score(){ Score net_score = scores.first(); //Iterate over the scores and sum while(!scores.done()) { net_score = net_score + scores.next(); scores.next(); } //Throw out the low and high net_score=net_score-(scores.min()+scores.max()); //average by scores used net_score=net_score/(scores.length()-2); return net_score;}
Introducing Container Classes
Trial
: Logical View::Contests::Tri
alScoreList
overallScore()
Gymnast
birthDate : Dategender : Booleanname : String
(from People)
RawScore
score : Double
(from Data Structures)
Event
addJudge()score()individualScore()teamScore()getTitle()
1
1
*
1
*performances
+scores *
1
*
1 *1 *
<RawScore>
<<bind>>
Gymnast
birthDate : Dategender : Booleanname : String
(from People)
T
List
first() : Tnext() : Tdone() : Booleanlength() : intadd(newElement : T)
(from Data Structures)
RawScoreList
RawScore
score : Score
(from Data Structures)
1
*
1
*
TrialScoreList
min()max()
Event
addJudge()score()individualScore()teamScore()getTitle()
Trial
addScore()score() 10..* 1
-competetor
0..*
1
1
-scores
0..*1
-trials
0..*1
1
1
Update Specifications
Class name: Trial
Category: Contests Documentation: A trial is a single performance of a gymnast at a given event. The gymnast may attempt multiple trials at the same event (i.e. on the same piece of equipment). Each trial is scored separately by the judging panel. Each judge's score is associated with the trial by using the method addScore(). The gymnast's resulting score for the trial is obtained by calling the method score().
External Documents: Export Control: Public Cardinality: n Hierarchy: Superclasses: none Associations:
competetor : Gymnast in association <unnamed> scores : TrialScoreList in association <unnamed> <no rolename> : Event in association <unnamed>
Public Interface: Operations: addScore score
State machine: No Concurrency: Sequential Persistence: Persistent
Operation name: addScore
Public member of: Trial Arguments:
Score newScore EventJudge scoringJudge
Documentation: Adds a score and judge pair (RawScore) to the trial's set of scores. The set of scores represents the raw set scores provided by the judging panel. Normally each member of the judging panel will provide one score.
Concurrency: Sequential
Operation name: score
Public member of: Trial Return Class: Score Documentation: Computes a trial's overall score based on dropping the highest and lowest scores and averaging the rest. { Score net_score = scores.first(); //Iterate over the scores and sum while(!scores.done()) { net_score = net_score + scores.next(); scores.next(); } //Throw out the low and high net_score=net_score-scores.min()+scores.max()); //average by scores used net_score=net_score/(scores.length()-2); return net_score; }
Concurrency: Sequential
Teaching Points
Design activities Implementation classes