Skip to content

Commit

Permalink
Merge pull request #197 from ElginL/ug-delete-command
Browse files Browse the repository at this point in the history
Update Developer Guide delete command
  • Loading branch information
ElginL authored Oct 21, 2022
2 parents 4edb35b + 1fa7ecd commit ca2b808
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
67 changes: 53 additions & 14 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ The following activity diagram summarizes what happens when a user executes the

The proposed sort mechanism is facilitated by `BuyCommand`. It extends `Command` and `BuyCommandParser` which extends from `Parser`.
To invoke the buy command, `BuyCommandParser` will parse the arguments from the user input via `BuyCommandParser#parse()` and returns the buy command
if the arguements are valid.
if the arguments are valid.

`BuyCommand` implements the `BuyCommandParser#execute()` operation which executes the command and returns the result message in a
`CommandResult` object.
Expand Down Expand Up @@ -363,9 +363,48 @@ The following sequence diagram shows how the edit operation works in Logic Manag

_{more aspects and alternatives to be added}_

### Delete Client/Transaction/Remark feature

#### Current Implementation

The deletion mechanism for `clients`, `transactions`, and `remarks` is facilitated by a `DeleteCommandParser` and `DeleteCommand`.

The following class diagram shows the parent-child relation of `DeleteClientCommand`, `DeleteTransactionCommand`, `DeleteRemarkCommand` relative to the `DeleteCommand`. The concrete classes consists of the logic to delete an item stated by the name of their command.

![DeleteCommandClassDiagram](images/DeleteCommandClassDiagram.png)

The `DeleteCommandParser` will take in the `userInput`, parse it, and return the correct concrete command type that is either `DeleteClientCommand`, `DeleteTransactionCommand`, or `DeleteRemarkCommand` which will be executed to achieve the deletion functionality.

This process of deleting the first client in the list is depicted by the following sequence diagram (for user input `delete 1 m/client`):

![DeleteSequenceDiagram](images/DeleteSequenceDiagram.png)
<div markdown="span" class="alert alert-info">:information_source: **Note:** The lifeline for `FilterTransCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.

</div>

The process for deleting `transaction` and `remark` is almost the same as the process stated above, with just the following changes:
- For delete transaction:
- `userInput` is changed to `delete 1 m/transaction`
- `parse("1 m/transaction")` returns `d`, which is a `DeleteTransactionCommand`
- `deleteClient(1)` is changed to `deleteTransaction(1)`
- For delete remark:
- `userInput` is changed to `delete 1 m/remark`
- `parse("1 m/remark")` returns `d`, which is a `DeleteRemarkCommand`
- `deleteClient(1)` is changed to `deleteRemark(1)`

#### Design Considerations:

**Aspect: How delete executes:**

* **Alternative 1 (current choice):** Delete either Client/Transaction/Remark specified by `mode (m) flag` selected by `index`
* Pros: Easy to implement and lesser commands overall since flag is used to specify each command.
* Cons: May be more clunky to use as users have to type in a longer command.

* **Alternative 2:** Create separate individual commands to Delete Client/Transaction/Remark, e.g. `deleteClient 1`, `deleteTransaction 1`, `deleteRemark 1`.
* Pros: More intuitive to use, shorter command to type.
* Cons: Adds more valid commands that the user can use, which may not be very user-friendly since they have to remember more commands. Also, there will be much more classes and code.

--------------------------------------------------------------------------------------------------------------------
=======
>>>>>>> 603a3ffa50adbaa8fe3b88806f6eb85969e07a05

## **Documentation, logging, testing, configuration, dev-ops**

Expand Down Expand Up @@ -402,17 +441,17 @@ _{more aspects and alternatives to be added}_

Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unlikely to have) - `*`

| Priority | As a …​ | I want to …​ | So that I can…​ |
|----------|--------------------------|-----------------------------------------------------|--------------------------------------------------------------------|
| `* * *` | business owner | choose which client and company to delete | save only relevant clients and company to remove clutter |
| `* * *` | forgetful business owner | see usage instructions | refer to instructions when I forget how to use the application |
| `* * *` | new business owner | simply search for contacts | retrieve only the essential details I need |
| `* * *` | new business owner | view a client's details and company | easily know who to contact for that client |
| `* * *` | busy business owner | quickly retrieve the data of the client | save time without having to go through multiple layers |
| `* * *` | new business owner | create a new client input | keep track of all the new clients I work with |
| `* * *` | new business owner | add a company to a client | know who to contact in that client |
| `* *` | careless business owner | edit the details of company | correct the mistakes that I did |
| `* *` | efficient business owner | sort the search result by price | quickly know which client I have made the most transaction with |
| Priority | As a …​ | I want to …​ | So that I can…​ |
|----------|--------------------------|-------------------------------------------|-----------------------------------------------------------------|
| `* * *` | business owner | choose which client and company to delete | save only relevant clients and company to remove clutter |
| `* * *` | forgetful business owner | see usage instructions | refer to instructions when I forget how to use the application |
| `* * *` | new business owner | simply search for contacts | retrieve only the essential details I need |
| `* * *` | new business owner | view a client's details and company | easily know who to contact for that client |
| `* * *` | busy business owner | quickly retrieve the data of the client | save time without having to go through multiple layers |
| `* * *` | new business owner | create a new client input | keep track of all the new clients I work with |
| `* * *` | new business owner | add a company to a client | know who to contact in that client |
| `* *` | careless business owner | edit the details of company | correct the mistakes that I did |
| `* *` | efficient business owner | sort the search result by price | quickly know which client I have made the most transaction with |

*{More to be added}*

Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":JeeqTrackerParser" as JeeqTrackerParser LOGIC_COLOR
participant ":DeleteCommandParser" as DeleteCommandParser LOGIC_COLOR
participant "d:DeleteCommand" as DeleteCommand LOGIC_COLOR
participant "d:DeleteClientCommand" as DeleteCommand 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("delete 1")
[-> LogicManager : execute("delete 1 m/client")
activate LogicManager

LogicManager -> JeeqTrackerParser : parseCommand("delete 1")
LogicManager -> JeeqTrackerParser : parseCommand("delete 1 m/client")
activate JeeqTrackerParser

create DeleteCommandParser
Expand All @@ -26,7 +26,7 @@ activate DeleteCommandParser
DeleteCommandParser --> JeeqTrackerParser
deactivate DeleteCommandParser

JeeqTrackerParser -> DeleteCommandParser : parse("1")
JeeqTrackerParser -> DeleteCommandParser : parse("1 m/client")
activate DeleteCommandParser

create DeleteCommand
Expand Down
Binary file modified docs/images/DeleteSequenceDiagram.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 ca2b808

Please sign in to comment.