diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 54a0c8b9271..58c45dd9a48 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -16,11 +16,12 @@ title: Developer Guide - 3.5. [Storage Component](#storage-component) - 3.6. [Common Classes](#common-classes) 4. [Implementation](#implementation) - - 4.1. [Release v1.2](#release-v12) - - 4.1.1. [Delete Meeting feature](#edit-meeting-feature) - - 4.1.2. [Delete Meeting feature](#delete-meeting-feature) - - 4.2. [Release v1.3](#release-v13) - - 4.2.1 [Filter feature](#filter-feature) +- 4.1. [Release v1.2](#release-v12) + - 4.1.1. [Add Meeting feature](#add-meeting-feature) + - 4.1.2. [Edit Meeting feature](#edit-meeting-feature) + - 4.1.3. [Delete Meeting feature](#delete-meeting-feature) + - 4.2. [Release v1.3](#release-v13) + - 4.2.1 [Filter feature](#filter-feature) 5. [Appendix: Requirements](#appendix-requirements) 6. [Appendix: Instructions for manual testing](#appendix-instructions-for-manual-testing) 7. [Appendix: Planned enhancements](#appendix-planned-enhancements) @@ -181,6 +182,68 @@ This section describes some noteworthy details on how certain features are imple ### Release v1.2 +### Add Meeting feature + +#### Implementation + +**The `AddMeetingCommand` is implemented as such:** + +- `LogicManager`'s execute method is called with the command string which then calls the `parseCommand()` method of `AddressBookParser` +- `AddressBookParser` then creates a `AddMeetingCommandParser` which parses the user input and + returns a `AddMeetingCommand` +- The created `AddMeetingCommand` is then executed by the `LogicManager` +- `AddMeetingCommand` adds the meeting to the client's meeting list corresponding to the index provided by the user. +- The UniqueMeetingList object in the Model is updated with the new meeting +- `AddMeetingCommand` creates a `CommandResult` object and returns it to `LogicManager` +- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list with the added meeting + +**The `AddMeetingCommandParser` is implemented as such:** + +- Takes in a `String` input from the user +- Splits the given `String` and checks if there is more than 1 string provided + - If more than 1 string was provided, throws `ParseException` + -Parser then checks if required prefixes are provided + - If not, throws `ParseException` +- Parser then checks if an empty string was provided + - If yes, throws `ParseException` +- Parser then checks if duplicate prefixes are provided + - If yes, throws `ParseException` +- Parser then checks if the date, time, description and client index are valid + - If not, throws `ParseException` +- If no exception was thrown, the index corresponding to the `Person`, the date, time and description are used to create a `AddMeetingCommand` object + +#### Sequence Diagram + +The following activity diagrams show how the `AddMeetingCommand` and `AddMeetingCommandParser` are executed in the event of valid and invalid user input. + +The first diagram shows how the AddMeetingCommandParser works when valid and invalid user input is given:
+AddMeetingCommandParser activity diagram + +The second diagram shows how the AddMeetingCommand is executed when the user inputs a valid and invalid command:
+AddMeetingCommand activity diagram + + +#### Design considerations: + +**Aspect: How add meeting executes:** + +- **Alternative 1 (current choice):** Adds the meeting based on the client index, date, time and description provided by the user + - Pros: + * More realistic as we would need to consider for conflicting meetings for the same client. + * Easier to visualise the different scenarios that could happen. + - Cons: + * More complex to implement. + * More error-prone as the user needs to provide the date and time. + +- **Alternative 2:** Adds the meeting based on the date and time provided by the user + - Pros: + * More flexible. + * More user-friendly. + - Cons: + * Unable to add meetings based on other criteria such as client index, description, etc. + * Less realistic as we would need to consider for conflicting meetings for the same client. + + ### Edit Meeting feature #### Implementation @@ -234,23 +297,22 @@ The following activity diagram summarises what happens when a user executes the - `DeleteMeetingCommand` deletes the meeting of the client corresponding to the indices provided by the user. - `DeleteMeetingCommand` creates a `CommandResult` object and returns it to `LogicManager` -- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list without the deleted meeting +- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list without + the deleted meeting **The `DeleteMeetingCommandParser` is implemented as such:** - Takes in a `String` input from the user -- Splits the given `String` and checks if the prefixes `clientIndex/` and `meetingIndex/` are provided - - If not, throws `ParseException` -- Parser checks if any duplicate prefixes are provided - - If yes, throws `ParseException` +- Splits the given `String` and checks if there is more than 1 string provided + - If more than 1 string was provided, throws `ParseException` - Parser then checks if an empty string was provided - If yes, throws `ParseException` -- If no exception was thrown, the indices corresponding to the `Person` and the `Meeting` +- If no exception was thrown, the indices corresponding to the `Person` and the `Meeting` are used to create a `DeleteMeetingCommand` object #### Sequence Diagram -The following sequence diagrams show how the `DeleteMeetingCommand` is executed when the user +The following sequence diagrams show how the `DeleteMeetingCommand` is executed when the user inputs the command `deleteMeeting clientIndex/2 meetingIndex/2`. The first diagram shows how the command goes through the `Logic` component:
@@ -519,7 +581,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli - **Use Case**: A description of a specific user goal or task and the steps required to achieve it. - **Mainstream OS**: Windows, Linux, Unix, MacOS - **Private contact detail**: A contact detail that is not meant to be shared with others -- **CLI**: A command line interface (CLI) is a software mechanism you use to interact with your +- **CLI**: A command line interface (CLI) is a software mechanism you use to interact with your operating system using your keyboard. --- @@ -624,7 +686,7 @@ testers are expected to do more *exploratory* testing. 3. Test case: `filter [invalid tag]` Expected: Shows all clients. Error details that tag provided does not belong to any client. - + 4. Test case: `filter [tag_1] [tag_2]` Expected: Error thrown to tell user to only input a singular Tag @@ -638,7 +700,10 @@ testers are expected to do more *exploratory* testing. 1. Test case: ` addMeeting clientIndex/1 dt/02-01-2030 12:00 d/sign life plan`
Expected: A new meeting is added to the list. The meeting's details are shown in the list, and the status bar shows the meeting's details. - + 1. Test case: `addMeeting clientIndex/0 dt/02-01-2030 12:00 d/sign life plan`
+ Expected: Meeting is not added. Index should be one-based. Error details shown in the status message. + 1. Test case: `addMeeting clientIndex/2 dt/02-01-2030 12:00 d/sign life plan`
+ Expected: Meeting is added to the list as different client with the same description at the same date and time is allowed. The meeting's details are shown in the list, and the status bar shows the meeting's details. 1. Test case: `addMeeting clientIndex/1 dt/02-01-2024 12:00 d/sign life plan`
Expected: Meeting is not added because the date has already elapsed. Error details shown in status message. diff --git a/docs/diagrams/AddMeetingCommandActivityDiagram.puml b/docs/diagrams/AddMeetingCommandActivityDiagram.puml new file mode 100644 index 00000000000..2c8ec323380 --- /dev/null +++ b/docs/diagrams/AddMeetingCommandActivityDiagram.puml @@ -0,0 +1,24 @@ +@startuml +skin rose +skinparam ActivityFontSize 15 +skinparam ArrowFontSize 12 +start +:User executes AddMeeting command; + +if () then ([Invalid parameters]) + -Error: Invalid command format + stop +else ([Valid parameters]) + if () then ([Duplicate meeting]) + -Error: This meeting either already exists in the address book or you are already booked for this timing + stop + else ([Meeting not duplicate]) + :Add new meeting to client's meeting list; + :Add new meeting to UniqueMeetingList; + :Commit changes to AddressBook; + :Save AddressBook state; + stop + + +endif +@enduml diff --git a/docs/diagrams/AddMeetingCommandParserActivityDiagram.puml b/docs/diagrams/AddMeetingCommandParserActivityDiagram.puml new file mode 100644 index 00000000000..42097d3eb47 --- /dev/null +++ b/docs/diagrams/AddMeetingCommandParserActivityDiagram.puml @@ -0,0 +1,39 @@ +@startuml +skin rose +skinparam ActivityFontSize 15 +skinparam ArrowFontSize 12 +start +:Create AddMeetingCommandParser object; + +if () then ([clientIndex not present]) + :Throw ParseException; + stop +else ([clientIndex present]) + if () then ([clientIndex not valid]) + :Throw ParseException; + stop + else ([clientIndex valid]) + :Parse ClientIndex; + if () then ([datetime not present]) + :Throw ParseException; + stop + else ([datetime present]) + :Parse DateTime; + if () then ([datetime not valid]) + :Throw ParseException; + stop + else ([datetime valid]) + :Parse Description; + if () then ([description not present]) + :Throw ParseException; + stop + else ([description present]) + if () then ([description not valid]) + :Throw ParseException; + stop + else ([description valid]) + :Create AddMeetingCommand object; + stop + +endif +@enduml diff --git a/docs/images/AddMeetingCommandActivityDiagram.png b/docs/images/AddMeetingCommandActivityDiagram.png new file mode 100644 index 00000000000..0d7261129e6 Binary files /dev/null and b/docs/images/AddMeetingCommandActivityDiagram.png differ diff --git a/docs/images/AddMeetingCommandParserActivityDiagram.png b/docs/images/AddMeetingCommandParserActivityDiagram.png new file mode 100644 index 00000000000..8d113a3ac20 Binary files /dev/null and b/docs/images/AddMeetingCommandParserActivityDiagram.png differ