Skip to content

Commit

Permalink
Update UML diagram for Architechture sequence diagram, and Logic sequ…
Browse files Browse the repository at this point in the history
…ence diagram
  • Loading branch information
jellywaiyan committed Oct 25, 2023
1 parent 4bf1a2c commit 9a130d1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
24 changes: 12 additions & 12 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The bulk of the app's work is done by the following four components:

**How the architecture components interact with each other**

The *Sequence Diagram* below shows how the components interact with each other for the scenario where the user issues the command `delete 1`.
The *Sequence Diagram* below shows how the components interact with each other for the scenario where the user issues the command `delete-a 1`.

<img src="images/ArchitectureSequenceDiagram.png" width="574" />

Expand Down Expand Up @@ -91,27 +91,27 @@ Here's a (partial) class diagram of the `Logic` component:

<img src="images/LogicClassDiagram.png" width="550"/>

The sequence diagram below illustrates the interactions within the `Logic` component, taking `execute("delete 1")` API call as an example.
How the `Logic` component works:

![Interactions Inside the Logic Component for the `delete 1` Command](images/DeleteSequenceDiagram.png)
1. When `Logic` is called upon to execute a command, it is passed to an `AddressBookParser` object which in turn creates a parser that matches the command (e.g., `AddAssignmentCommandParser`) and uses it to parse the command.
1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `AddAssignmentCommand`) which is executed by the `LogicManager`.
1. The command can communicate with the `Model` when it is executed (e.g. to add an assignment).
1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`.

<div markdown="span" class="alert alert-info">:information_source: **Note:** The lifeline for `DeleteCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
</div>
The sequence diagram below illustrates the interactions within the `Logic` component, taking `execute("delete 1")` API call as an example.

How the `Logic` component works:
![Interactions Inside the Logic Component for the `delete-a 1` Command](images/DeleteSequenceDiagram.png)

1. When `Logic` is called upon to execute a command, it is passed to an `AddressBookParser` object which in turn creates a parser that matches the command (e.g., `DeleteCommandParser`) and uses it to parse the command.
1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `DeleteCommand`) which is executed by the `LogicManager`.
1. The command can communicate with the `Model` when it is executed (e.g. to delete a person).
1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`.
<div markdown="span" class="alert alert-info">:information_source: **Note:** The lifeline for `DeleteAssignmentCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
</div>

Here are the other classes in `Logic` (omitted from the class diagram above) that are used for parsing a user command:

<img src="images/ParserClasses.png" width="600"/>

How the parsing works:
* When called upon to parse a user command, the `AddressBookParser` class creates an `XYZCommandParser` (`XYZ` is a placeholder for the specific command name e.g., `AddCommandParser`) which uses the other classes shown above to parse the user command and create a `XYZCommand` object (e.g., `AddCommand`) which the `AddressBookParser` returns back as a `Command` object.
* All `XYZCommandParser` classes (e.g., `AddCommandParser`, `DeleteCommandParser`, ...) inherit from the `Parser` interface so that they can be treated similarly where possible e.g, during testing.
* When called upon to parse a user command, the `AddressBookParser` class creates an `XYZCommandParser` (`XYZ` is a placeholder for the specific command name e.g., `AddAssignmentCommandParser`) which uses the other classes shown above to parse the user command and create a `XYZCommand` object (e.g., `AddAssignmentCommand`) which the `AddressBookParser` returns back as a `Command` object.
* All `XYZCommandParser` classes (e.g., `AddAssignmentCommandParser`, `DeleteAssignmentCommandParser`, ...) inherit from the `Parser` interface so that they can be treated similarly where possible e.g, during testing.

### Model component
**API** : [`Model.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/model/Model.java)
Expand Down
6 changes: 3 additions & 3 deletions docs/diagrams/ArchitectureSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Participant ":Logic" as logic LOGIC_COLOR
Participant ":Model" as model MODEL_COLOR
Participant ":Storage" as storage STORAGE_COLOR

user -[USER_COLOR]> ui : "delete 1"
user -[USER_COLOR]> ui : "delete-a 1"
activate ui UI_COLOR

ui -[UI_COLOR]> logic : execute("delete 1")
ui -[UI_COLOR]> logic : execute("delete-a 1")
activate logic LOGIC_COLOR

logic -[LOGIC_COLOR]> model : deletePerson(p)
logic -[LOGIC_COLOR]> model : deleteAssignment(a)
activate model MODEL_COLOR

model -[MODEL_COLOR]-> logic
Expand Down
56 changes: 28 additions & 28 deletions docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,65 @@ skinparam ArrowFontStyle plain
box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":DeleteCommandParser" as DeleteCommandParser LOGIC_COLOR
participant "d:DeleteCommand" as DeleteCommand LOGIC_COLOR
participant ":DeleteAssignmentCommandParser" as DeleteAssignmentCommandParser LOGIC_COLOR
participant "d:DeleteAssignmentCommand" as DeleteAssignmentCommand 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-a 1")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delete 1")
LogicManager -> AddressBookParser : parseCommand("delete-a 1")
activate AddressBookParser

create DeleteCommandParser
AddressBookParser -> DeleteCommandParser
activate DeleteCommandParser
create DeleteAssignmentCommandParser
AddressBookParser -> DeleteAssignmentCommandParser
activate DeleteAssignmentCommandParser

DeleteCommandParser --> AddressBookParser
deactivate DeleteCommandParser
DeleteAssignmentCommandParser --> AddressBookParser
deactivate DeleteAssignmentCommandParser

AddressBookParser -> DeleteCommandParser : parse("1")
activate DeleteCommandParser
AddressBookParser -> DeleteAssignmentCommandParser : parse("1")
activate DeleteAssignmentCommandParser

create DeleteCommand
DeleteCommandParser -> DeleteCommand
activate DeleteCommand
create DeleteAssignmentCommand
DeleteAssignmentCommandParser -> DeleteAssignmentCommand
activate DeleteAssignmentCommand

DeleteCommand --> DeleteCommandParser : d
deactivate DeleteCommand
DeleteAssignmentCommand --> DeleteAssignmentCommandParser : d
deactivate DeleteAssignmentCommand

DeleteCommandParser --> AddressBookParser : d
deactivate DeleteCommandParser
DeleteAssignmentCommandParser --> AddressBookParser : d
deactivate DeleteAssignmentCommand
'Hidden arrow to position the destroy marker below the end of the activation bar.
DeleteCommandParser -[hidden]-> AddressBookParser
destroy DeleteCommandParser
DeleteAssignmentCommandParser -[hidden]-> AddressBookParser
destroy DeleteAssignmentCommandParser

AddressBookParser --> LogicManager : d
deactivate AddressBookParser

LogicManager -> DeleteCommand : execute()
activate DeleteCommand
LogicManager -> DeleteAssignmentCommand : execute()
activate DeleteAssignmentCommand

DeleteCommand -> Model : deletePerson(1)
DeleteAssignmentCommand -> Model : deleteAssignment(1)
activate Model

Model --> DeleteCommand
Model --> DeleteAssignmentCommand
deactivate Model

create CommandResult
DeleteCommand -> CommandResult
DeleteAssignmentCommand -> CommandResult
activate CommandResult

CommandResult --> DeleteCommand
CommandResult --> DeleteAssignmentCommand
deactivate CommandResult

DeleteCommand --> LogicManager : result
deactivate DeleteCommand
DeleteAssignmentCommand --> LogicManager : result
deactivate DeleteAssignmentCommand

[<--LogicManager
deactivate LogicManager
Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/LogicClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ LogicManager --> Storage
Storage --[hidden] Model
Command .[hidden]up.> Storage
Command .right.> Model
note right of XYZCommand: XYZCommand = AddCommand, \nFindCommand, etc
note right of XYZCommand: XYZCommand = AddAssignmentCommand, \nFindAssignmentCommand, etc

Logic ..> CommandResult
LogicManager .down.> CommandResult
Expand Down
Binary file modified docs/images/ArchitectureSequenceDiagram.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/DeleteSequenceDiagram.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/LogicClassDiagram.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 9a130d1

Please sign in to comment.