Overview
PCC is a command line GUI which has a prompt. Users can key in commands into the prompt to manage athletes, Powerlifting competitions and athletes' participation in competitions. As a brief introduction, Powerlifting comprises 3 movements: The Squat, The Bench Press and The Deadlift. Powerlifting athletes aim to achieve the maximum weights attempted for the 3 movements mentioned above to win a Powerlifting competition.
Summary of contributions
-
Major enhancement 1: added Add/Edit/Delete Competitions
-
What it does: Allows the user to add new competitions, edit information for existing competitions and delete obsolete competition information.
-
Justification: Allows users to add/edit competitions with valid start and end dates. Delete command ensures the programme is not cluttered with unused competition data.
-
Highlights: The key feature here is the date validation for adding and editing competitions with the help of an auxiliary class: CustomDate class. Please read my contribution to the DG to understand what I have meant by valid start and end dates. Furthermore, the DG explains how CustomDate class aids in validating the dates.
-
-
Major enhancement 2: added Rank athletes for a given competition session
-
What it does: Allows the user to generate a report card for an athlete for a given competition setting.
-
Justification: Allows the coach or an athlete to know what are the best weights attempted for the bench press, deadlift and squat. Also, the coach or an athlete can know the position of an athlete to relative to his or her competitors.
-
-
Code contributed*: [Functional code]
-
Other contributions:
Contributions to the User Guide
Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users. |
Context: Outside Of Competition (Out-session)
Commands related to competition
Commands related to managing competitions outside of a competition setting shall be introduced first.
Adding a new competition: addCompetition
Format: addCompetition n/COMPETITION NAME startDate/START DATE OF COMPETITION endDate/END DATE OF COMPETITION
Example:
addCompetition n/IPF World Championships startDate/12/02/1995 endDate/15/02/1995
Deleting an existing competition: deleteCompetition
Deletes the competition identified by the index number, used in Competition list (shown in the GUI)
Format: deleteCompetition INDEX
Example:
deleteCompetition 1
Finding an existing competition: findCompetition
Finds and lists all competitions in the system whose name or dates contains any of the argument keywords. Keyword matching is case insensitive.
Format: findCompetition [KEYWORD 1] … [KEYWORD N]
Example:
findCompetition NUS Open 2019
Editing information of a competition: editCompetition
Edits the details of the competition identified by the index number, used in the Competition list (shown in the GUI). Existing values will be overwritten by the input values. In addition to INDEX, you must supply a value for at least one of the following fields:
-
COMPETITION NAME
-
START DATE OF COMPETITION
-
END DATE OF COMPETITION
Format: editCompetition INDEX (must be a positive integer) [n/COMPETITION NAME] [startDate/START DATE OF COMPETITION] [endDate/END DATE OF COMPETITION]
Examples:
1.When all fields are supplied:
-
editCompetition 1 n/IPF World Championships startDate/12/02/1995 endDate/15/02/1995
2.When only 1 field is supplied:
-
editCompetition 1 n/IPF World Championships
-
editCompetition 1 endDate/15/02/1995
Getting the rank of a person (athlete) for a given competition: rank
Retrieves the rank of a person relative other competitors in the competition.
Format: rank n/NAME
Example:
-
rank n/Ho
Contributions to the Developer Guide
Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project. |
Competition features
There are 4 competition/person features: adding, deleting, editing and listing competitions. The features are briefly described below. The crux of adding and editing a competition commands is the CustomDate class , the CustomDate class is important for validating the starting and ending dates for a competition event. The date validation process will be discussed in detail in words and with the aid of class and sequence diagrams.
Adding a competition
To add a competition, a user supplies the name of a competition and its start and end dates. But, the start date must be equal or before end date.
Deleting a competition
To delete a competition, a user supplies the index of that competition. The index of a competition will be displayed in the user interface of that programme.
Editing a competition
A user has the choice of editing one or more of the following competition fields:the competition name, start and end dates of a competition. But, similar to adding a competition, the edited start date must be equal or before the edited end date.
Listing a competition
To list all competitions stored in the programme.
Choice of Design Pattern
Similar to the Rank feature.
Implementation
As mentioned earlier, editing or adding competitions require start date to be equal or before the end date. To ensure the dates given for a competition are valid, we created a CustomDate class. Please see the following class diagram for more information on the association between CustomDate and Competition classes.
To see the mechanism of the date validation process, please see the following sequence diagram.
Pros of CustomDate:
-
Note that DATE_FORMAT is hard-coded by us (class diagram cannot explicitly show this), this ensures our programme maintains a consistent date format for all competitions.
-
By storing a Date object in the CustomDate class, we enable ParserUtil to call the before() method of the Date class to check for valid dates. Please the sequence diagram for the addCompetitionCommand, which provides illustration on how this is achieved.
Cons of CustomDate:
-
We need to ensure functions/classes which rely on CustomDate can catch and handle errors due to inappropriate date properly. This means that any changes to CustomDate in the future requires some work to propagate the changes to the rest of the code base.
-
Users may wish to have their own date format.
Alternative:
We have considered using only the Java Date object, but we think it will be neater to have a CustomDate class to package a date object and its associated date format string in a CustomDate object. Furthermore, we can recycle the functions available in the CustomDate class for person features too (read the next section).
Rank feature
A RankCommand class is created to facilitate ranking of an athlete for a given competition he or she participates in.
Implementation
RankCommand extends the Command Abstract Class, the rationale is explained in Choice of Design Pattern
sub-section of the Rank feature.
Rank feature has 2 sequential checks: 1. Checks if a competition session is ongoing, rank command can only be used if a competition session persists. 2. Checks if an athlete participates in a competition, rank command can only be used if an athlete participates in a competition.
Finally, the feature returns an athlete’s report card for a competition. For example,
Athlete: Alex Yeoh Competition: NUS Powerlifting Open 2019 Rank: 1 Total Score: 1 Max Squat: 1 Max Bench Press: 0 Max Deadlift: 0
When the rank feature is used, RankCommand interacts with other classes to return an athlete’s report card. See the sequence diagram for a high level depiction of how RankCommand interacts with other classes.
Choice of Design Pattern
Original AB3 code base uses a Command Design Pattern, which facilitates execution of different commands, without the programme knowing which type of command is being executed. Furthermore, the original AB3 code base achieves a Command Design Pattern by requiring different types of command classes to extend from a Command Abstract Class.
Due to time constraint and to achieve consistency with the Command Design Pattern of the original Code Base, we decide to apply the Command Design Pattern for the Rank command too.