diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 37701780916..5929709bf80 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -1,7 +1,7 @@ --- - layout: default.md - title: "Developer Guide" - pageNav: 3 +layout: default.md +title: "Developer Guide" +pageNav: 3 --- # AB-3 Developer Guide @@ -252,13 +252,13 @@ The following activity diagram summarizes what happens when a user executes a ne **Aspect: How undo & redo executes:** * **Alternative 1 (current choice):** Saves the entire address book. - * Pros: Easy to implement. - * Cons: May have performance issues in terms of memory usage. + * Pros: Easy to implement. + * Cons: May have performance issues in terms of memory usage. * **Alternative 2:** Individual command knows how to undo/redo by itself. - * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). - * Cons: We must ensure that the implementation of each individual command are correct. + * Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). + * Cons: We must ensure that the implementation of each individual command are correct. _{more aspects and alternatives to be added}_ @@ -266,6 +266,71 @@ _{more aspects and alternatives to be added}_ _{Explain here how the data archiving feature will be implemented}_ +### Addclient/Addlead feature + +#### Implementation + +The `Client` and `Lead` model extends from `Person`. + +The `addclient` and `addlead` commands are implemented as follows: + +The `execute()` command in `AddClientCommand` or `AddLeadCommand` is executed. + +The `execute()` command in `AddClientCommand` or `AddLeadCommand` calls the `addClient()` or `addLead()` method in `ModelManager`. + +The `addClient()` or `addLead()` method in `ModelManager` calls the `addClient()` or `addLead()` method in `AddressBook`. + +The `addClient()` or `addLead()` method in `AddressBook` adds the `Client` or `Lead` object to the `UniquePersonList persons`. + +Given below is an example usage scenario and how addclient and addlead behaves at each step. + +Step 1. The user launches the application for the first time. The `AddressBook` will be initialized. + +
+ before command +

Before any commands

+
+ +Step 2 - addclient. The user executes `addclient n/John Doe...` command add a person named John Doe into the AddressBook. The `addclient` command calls `Model#addClient()`, causing the address book to be updated. + +
+ after addclient command +

After addclient command

+
+ +Step 2 - addlead. The user executes `addlead n/John Doe...` command add a person named John Doe into the AddressBook. The `addlead` command calls `Model#addLead()`, causing the address book to be updated. + +
+ after addlead command +

After addlead command

+
+ +The following sequence diagram shows how the addclient operation works (Note that addlead works in the same way but calls `Model#addLead()` instead): + + + +The following activity diagram shows what happens when a user executes a new command: + + + +### \[Proposed\] Add Meeting Time feature + +#### Proposed Implementation + + +The user can specify a meeting time when executing `addclient` or `addlead` command with the `--meeting-time` flag. + +Alternatively, the user can enter the `addmeeting` command to add a meeting time to an existing client or lead. + +The `addmeeting` command takes in the `index` of the client or lead, and the meeting time in `dd/MM/yyyy HH:mm` format, e.g. `24/10/2023 12:00`. + +The following sequence diagram shows how the addMeeting operation works: + + + +The following activity diagram shows what happens when a user executes the addMeeting operation: + + -------------------------------------------------------------------------------------------------------------------- @@ -402,13 +467,13 @@ Use case ends **Extensions** * 2a. The person's information is empty - + Add person event information * 3a. The given index is invalid - + * 3a1 D.A.V.E. shows an error message Use case resumes at step 2 -** Use case: Add a New Person ** + ** Use case: Add a New Person ** **MSS** @@ -502,7 +567,7 @@ Use case ends. 4. The system should be able to scale gracefully to accommodate a growing number of users, clients, and data without significant performance degradation. 5. It should support easy integration with additional modules or features as the user base expands. 8. The user interface should be intuitive and user-friendly, ensuring that users can quickly learn and navigate the application. -*{More to be added}* + *{More to be added}* ### Glossary @@ -527,15 +592,15 @@ testers are expected to do more *exploratory* testing. 1. Initial launch - 1. Download the jar file and copy into an empty folder + 1. Download the jar file and copy into an empty folder - 1. Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum. + 1. Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum. 1. Saving window preferences - 1. Resize the window to an optimum size. Move the window to a different location. Close the window. + 1. Resize the window to an optimum size. Move the window to a different location. Close the window. - 1. Re-launch the app by double-clicking the jar file.
+ 1. Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained. 1. _{ more test cases …​ }_ @@ -544,16 +609,16 @@ testers are expected to do more *exploratory* testing. 1. Deleting a person while all persons are being shown - 1. Prerequisites: List all persons using the `list` command. Multiple persons in the list. + 1. Prerequisites: List all persons using the `list` command. Multiple persons in the list. - 1. Test case: `delete 1`
- Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. + 1. Test case: `delete 1`
+ Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated. - 1. Test case: `delete 0`
- Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. + 1. Test case: `delete 0`
+ Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. - 1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)
- Expected: Similar to previous. + 1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)
+ Expected: Similar to previous. 1. _{ more test cases …​ }_ @@ -574,6 +639,6 @@ testers are expected to do more *exploratory* testing. 1. Dealing with missing/corrupted data files - 1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_ + 1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_ 1. _{ more test cases …​ }_ diff --git a/docs/diagrams/AddClientActivityDiagram.png b/docs/diagrams/AddClientActivityDiagram.png new file mode 100644 index 00000000000..9730dcc860a Binary files /dev/null and b/docs/diagrams/AddClientActivityDiagram.png differ diff --git a/docs/diagrams/AddClientActivityDiagram.puml b/docs/diagrams/AddClientActivityDiagram.puml new file mode 100644 index 00000000000..c2b3c025044 --- /dev/null +++ b/docs/diagrams/AddClientActivityDiagram.puml @@ -0,0 +1,19 @@ +@startuml +skin rose +skinparam ActivityFontSize 15 +skinparam ArrowFontSize 12 +start +:User executes command; +:AddressBookParser parses command; + +'Since the beta syntax does not support placing the condition outside the +'diamond we place it as the true branch instead. + +if () then ([valid addclient command string]) + :Create new client; + :Add client to persons in AddressBook; + stop +else ([else]) + :Display error message; + stop +@enduml diff --git a/docs/diagrams/AddClientSequenceDiagram.png b/docs/diagrams/AddClientSequenceDiagram.png new file mode 100644 index 00000000000..b23f0a30714 Binary files /dev/null and b/docs/diagrams/AddClientSequenceDiagram.png differ diff --git a/docs/diagrams/AddClientSequenceDiagram.puml b/docs/diagrams/AddClientSequenceDiagram.puml new file mode 100644 index 00000000000..0c34e658fb7 --- /dev/null +++ b/docs/diagrams/AddClientSequenceDiagram.puml @@ -0,0 +1,50 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant "u:AddClientCommand" as AddClientCommand LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant ":Model" as Model MODEL_COLOR +participant ":AddressBook" as AddressBook MODEL_COLOR +end box +[-> LogicManager : execute(addclient n/...) +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand(addclient n/...) +activate AddressBookParser + +create AddClientCommand +AddressBookParser -> AddClientCommand +activate AddClientCommand + +AddClientCommand --> AddressBookParser +deactivate AddClientCommand + +AddressBookParser --> LogicManager : u +deactivate AddressBookParser + +LogicManager -> AddClientCommand : execute() +activate AddClientCommand + +AddClientCommand -> Model : addClient() +activate Model + +Model -> AddressBook : addClient() +activate AddressBook + +Model --> AddClientCommand +deactivate Model + +AddClientCommand --> LogicManager : result +deactivate AddClientCommand +AddClientCommand -[hidden]-> LogicManager : result +destroy AddClientCommand + +[<--LogicManager +deactivate LogicManager +@enduml diff --git a/docs/diagrams/AddMeetingTimeActivityDiagram.png b/docs/diagrams/AddMeetingTimeActivityDiagram.png new file mode 100644 index 00000000000..8ab42629979 Binary files /dev/null and b/docs/diagrams/AddMeetingTimeActivityDiagram.png differ diff --git a/docs/diagrams/AddMeetingTimeActivityDiagram.puml b/docs/diagrams/AddMeetingTimeActivityDiagram.puml new file mode 100644 index 00000000000..2c22db8a9df --- /dev/null +++ b/docs/diagrams/AddMeetingTimeActivityDiagram.puml @@ -0,0 +1,20 @@ +@startuml +skin rose +skinparam ActivityFontSize 15 +skinparam ArrowFontSize 12 +start +:User executes addmeeting command; +:AddressBookParser parses command; + +'Since the beta syntax does not support placing the condition outside the +'diamond we place it as the true branch instead. + +if () then ([valid addmeeting command string]) + :Finds Person in AddressBook to update; + :Creates updatedPerson with new meeting added; + :Set Person to updatedPerson in AddressBook; + stop +else ([else]) + :Display error message; + stop +@enduml diff --git a/docs/diagrams/AddMeetingTimeSequenceDiagram.png b/docs/diagrams/AddMeetingTimeSequenceDiagram.png new file mode 100644 index 00000000000..8855e3282fd Binary files /dev/null and b/docs/diagrams/AddMeetingTimeSequenceDiagram.png differ diff --git a/docs/diagrams/AddMeetingTimeSequenceDiagram.puml b/docs/diagrams/AddMeetingTimeSequenceDiagram.puml new file mode 100644 index 00000000000..e46411387ba --- /dev/null +++ b/docs/diagrams/AddMeetingTimeSequenceDiagram.puml @@ -0,0 +1,64 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant "u:AddMeetingTime" as AddMeetingTime LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant ":Model" as Model MODEL_COLOR +participant ":AddressBook" as AddressBook MODEL_COLOR +participant "updatedPerson:Person" as Person MODEL_COLOR +end box + +[-> LogicManager : execute(addmeeting ...) +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand(addmeeting ...) +activate AddressBookParser + +create AddMeetingTime +AddressBookParser -> AddMeetingTime +activate AddMeetingTime + +AddMeetingTime --> AddressBookParser +deactivate AddMeetingTime + +AddressBookParser --> LogicManager : u +deactivate AddressBookParser + +LogicManager -> AddMeetingTime : execute() +activate AddMeetingTime + +AddMeetingTime -> Model : addMeeting() +activate Model + +Model -> AddressBook : addMeeting() +activate AddressBook + +create Person +AddressBook -> Person +activate Person + +Person --> AddressBook +deactivate Person + +AddressBook --> AddressBook : setPerson(personToUpdate, updatedPerson) +AddressBook --> Model +deactivate AddressBook + +Model --> AddMeetingTime +deactivate Model + + +AddMeetingTime --> LogicManager : result +deactivate AddMeetingTime +AddMeetingTime -[hidden]-> LogicManager : result +destroy AddMeetingTime + +[<--LogicManager +deactivate LogicManager +@enduml diff --git a/docs/images/cleanaddressbook.png b/docs/images/cleanaddressbook.png new file mode 100644 index 00000000000..7b944f6f2ba Binary files /dev/null and b/docs/images/cleanaddressbook.png differ