Skip to content

Commit

Permalink
Merge branch 'master' into editDg
Browse files Browse the repository at this point in the history
  • Loading branch information
crvstalphua authored Nov 6, 2022
2 parents 05bef84 + c511604 commit c96468d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down Expand Up @@ -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.

<div markdown="span" class="alert alert-info">
: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.
Expand All @@ -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**
Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/DefaultViewSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ deactivate AddressBookParser
LogicManager -> SetClientDefaultViewCommand : execute()
activate SetClientDefaultViewCommand

SetClientDefaultViewCommand --> Model : setDefaultView(CLIENTS)
SetClientDefaultViewCommand --> Model : setDefaultView(CLIENT)
activate Model

Model --> SetClientDefaultViewCommand
Expand Down
9 changes: 5 additions & 4 deletions docs/diagrams/PinSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
Binary file modified docs/images/DefaultViewSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/PinSequenceDiagram.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 c96468d

Please sign in to comment.