diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index fb97e3486ff..62754a54ef0 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -187,7 +187,7 @@ The following activity diagram summarizes what happens when a user executes a li ![ListActivityDiagram](images/ListActivityDiagram.png) -#### Design considerations: +#### Design considerations **Aspect: How list executes:** @@ -432,7 +432,7 @@ Given below is an example usage scenario and how the pin mechanism behaves at ea Step 1. The user creates an entity with a unique ID. The entity is unpinned by default and will be displayed according to the current sorting order. -Step 2. The user executes `client -p 3` to pin the 3rd client in the project book. The `PinClientCommand` is executed and calls `togglePinned()`, toggling the `Pin` attribute of the 5th client from `false` to `true`. This is followed by a call to `Model#sortClientsByCurrentCategory()` and `Model#sortClientsByPin()`, which displays the sorted client list with pinned clients (now including the 4th client) at the top. +Step 2. The user executes `client -p 3` to pin the 3rd client in the project book. The `PinClientCommand` is executed and calls `Client#togglePin()`, toggling the `Pin` attribute of the 5th client from `false` to `true`. This is followed by a call to `Model#sortClientsByCurrentCategory()` and `Model#sortClientsByPin()`, which displays the sorted client list with pinned clients (now including the 4th client) at the top.
:information_source: **Note:** If the current client is already pinned, `Client#togglePin()` will toggle the `Pin` attribute of the client from `true` to `false` and call the latest sort order, causing the client to be displayed in its original position. @@ -451,17 +451,18 @@ The following activity diagram summarizes what happens when a user executes a pi ![PinActivityDiagram](images/PinActivityDiagram.png) -#### Design considerations: +#### Design considerations **Aspect: How entities can be unpinned:** -* **Alternative 1 (current choice):** The `togglePinned()` method is called which sets the `Pin` attribute from `true` back to `false`. The same command used to pin is also used to unpin the entity. +* **Alternative 1 (current choice):** The same command e.g. `PinClientCommand` used to pin the entity is also used to unpin the entity. * Pros: Less duplication of code and less commands for the user to remember. * Cons: Lesser separation of responsibilities as the same command is used for different (but similar) functionality. -* **Alternative 2:** An additional unpin command is created e.g. `UnpinClientCommand`, `UnpinProjectCommand`, `UnpinIssueCommand`. Different pin commands `setPinned()`, `setUnpinned()` are used to pin and unpin the entity. +* **Alternative 2:** An additional separate unpin command is created e.g. `UnpinClientCommand`. * Pros: Better separation of responsibilities as one command is used to pin and the other is used to unpin the entity. There is no overlap. * Cons: More duplication of code, additional command for user to remember with roughly the same functionality. + -------------------------------------------------------------------------------------------------------------------- ## **Documentation, logging, testing, configuration, dev-ops** diff --git a/docs/diagrams/DefaultViewSequenceDiagram.puml b/docs/diagrams/DefaultViewSequenceDiagram.puml index 901814a0457..11b2eb0352f 100644 --- a/docs/diagrams/DefaultViewSequenceDiagram.puml +++ b/docs/diagrams/DefaultViewSequenceDiagram.puml @@ -43,7 +43,7 @@ deactivate AddressBookParser LogicManager -> SetClientDefaultViewCommand : execute() activate SetClientDefaultViewCommand -SetClientDefaultViewCommand --> Model : setDefaultView(CLIENTS) +SetClientDefaultViewCommand --> Model : setDefaultView(CLIENT) activate Model Model --> SetClientDefaultViewCommand diff --git a/docs/diagrams/PinSequenceDiagram.puml b/docs/diagrams/PinSequenceDiagram.puml index 3d4215ca742..3f547914374 100644 --- a/docs/diagrams/PinSequenceDiagram.puml +++ b/docs/diagrams/PinSequenceDiagram.puml @@ -11,6 +11,7 @@ end box box Model MODEL_COLOR_T1 participant ":Model" as Model MODEL_COLOR +participant ":Client" as Client MODEL_COLOR end box --> LogicManager : execute("client -p 3") @@ -43,11 +44,11 @@ deactivate AddressBookParser LogicManager -> PinClientCommand : execute() activate PinClientCommand -PinClientCommand --> Model : togglePinned(3) -activate Model +PinClientCommand --> Client : togglePin() +activate Client -Model --> PinClientCommand -deactivate Model +Client --> PinClientCommand +deactivate Client PinClientCommand --> Model : sortClientsByCurrentCategory() activate Model diff --git a/docs/images/DefaultViewSequenceDiagram.png b/docs/images/DefaultViewSequenceDiagram.png index edc84826a0e..86009061ea7 100644 Binary files a/docs/images/DefaultViewSequenceDiagram.png and b/docs/images/DefaultViewSequenceDiagram.png differ diff --git a/docs/images/PinSequenceDiagram.png b/docs/images/PinSequenceDiagram.png index bac92d03ef1..b5938712790 100644 Binary files a/docs/images/PinSequenceDiagram.png and b/docs/images/PinSequenceDiagram.png differ