Skip to content

Commit

Permalink
add sequence diagram for find command
Browse files Browse the repository at this point in the history
  • Loading branch information
Kappaccinoh committed Apr 12, 2024
1 parent 25d308f commit 7bef28d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ The activity diagram below demonstrates this error handling process in more deta
* Step 6. The `execute` method in `FindCommand` executes and calls `updateFilteredPersonList` in model to get a filtered list of person entries, both `patient` and `doctor` entries can be displayed.
* Step 7. A Success message gets printed onto the results display to notify user and the list of matching results is produced.

The sequence diagram below closely describes the interaction between the various components during the execution of the `DeleteAppointmentCommand`.

<img src="images/FindPersonSequenceDiagram.png" width="800" />

Alternative implementations considered
1. The following sections describes the behaviour of querying `doctor` and `patient` entries by separate commands by all of the entry's fields, both following a very similar logic to how the `find` command is implemented. We might consider using flags to be more precise with our searches, (e.g a -doctor or -patient flag to indicate we wish to search for only `doctor` and `patient` entries respectively) so as to avoid the need to create additional commands. However, we felt that this approach overloaded the `find` method too much, and overcomplicated the `find` command's usage.
2. Even if the `find` command was to be overloaded with flags, we foresaw that the creation of distinct commands to fit the flags parsed by the `find` command was unavoidable. As such, it was prudent to start with the implementation of the distinct commands first (as described in the following sections, each tied to a specific command), and leave the overloading of the `find` command as a later increment.
Expand Down
65 changes: 65 additions & 0 deletions docs/diagrams/FindPersonSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@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 ":FindCommandParser" as FindCommandParser LOGIC_COLOR
participant "e:FindCommand" as FindCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("find ...")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("find ...")
activate AddressBookParser

create FindCommandParser
AddressBookParser -> FindCommandParser
activate FindCommandParser

create FindCommand
FindCommandParser -> FindCommand : : parse("find ...")
activate FindCommand

FindCommand --> FindCommandParser
deactivate FindCommand

FindCommandParser --> AddressBookParser
deactivate FindCommandParser

'Hidden arrow to position the destroy marker below the end of the activation bar.
FindCommandParser -[hidden]-> AddressBookParser
destroy FindCommandParser

AddressBookParser --> LogicManager
deactivate AddressBookParser

LogicManager -> FindCommand : execute()
activate FindCommand

FindCommand -> Model : find(person)
activate Model

Model --> FindCommand
deactivate Model

create CommandResult
FindCommand -> CommandResult
activate CommandResult

CommandResult --> FindCommand : result
deactivate CommandResult

FindCommand --> LogicManager : result
deactivate FindCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file added docs/images/FindPersonSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7bef28d

Please sign in to comment.