Skip to content

Commit

Permalink
DG: Tweak the 'Architecture' section
Browse files Browse the repository at this point in the history
Main changes:
* Tweak the layout of the Architecture diagram (e.g., push the Commons
  component to the bottom as it is not an important component).
* Add a diagram to explain the presence of *Manager classes.
* Move the tip about PlantUML diagrams to the top of the Design section.
  • Loading branch information
damithc committed Jul 31, 2021
1 parent d6fb70e commit 087a766
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 14 deletions.
32 changes: 18 additions & 14 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ Refer to the guide [_Setting up and getting started_](SettingUp.md).

## **Design**

### Architecture
<div markdown="span" class="alert alert-primary">

<img src="images/ArchitectureDiagram.png" width="450" />
:bulb: **Tip:** The `.puml` files used to create diagrams in this document can be found in the [diagrams](https://github.com/se-edu/addressbook-level3/tree/master/docs/diagrams/) folder. Refer to the [_PlantUML Tutorial_ at se-edu/guides](https://se-education.org/guides/tutorials/plantUml.html) to learn how to create and edit diagrams.
</div>

The ***Architecture Diagram*** given above explains the high-level design of the App. Given below is a quick overview of each component.
### Architecture

<div markdown="span" class="alert alert-primary">
<img src="images/ArchitectureDiagram.png" width="280" />

:bulb: **Tip:** The `.puml` files used to create diagrams in this document can be found in the [diagrams](https://github.com/se-edu/addressbook-level3/tree/master/docs/diagrams/) folder. Refer to the [_PlantUML Tutorial_ at se-edu/guides](https://se-education.org/guides/tutorials/plantUml.html) to learn how to create and edit diagrams.
The ***Architecture Diagram*** given above explains the high-level design of the App.

</div>
Given below is a quick overview of main components and how they interact with each other.

**Main components of the architecture**

**`Main`** has two classes called [`Main`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/Main.java) and [`MainApp`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/MainApp.java). It is responsible for,
* At app launch: Initializes the components in the correct sequence, and connects them up with each other.
Expand All @@ -46,21 +49,22 @@ The rest of the App consists of four components.
* [**`Model`**](#model-component): Holds the data of the App in memory.
* [**`Storage`**](#storage-component): Reads data from, and writes data to, the hard disk.

Each of the four components,

* defines its *API* in an `interface` with the same name as the Component.
* exposes its functionality using a concrete `{Component Name}Manager` class (which implements the corresponding API `interface` mentioned in the previous point.

For example, the `Logic` component (see the class diagram given below) defines its API in the `Logic.java` interface and exposes its functionality using the `LogicManager.java` class which implements the `Logic` interface.

![Class Diagram of the Logic Component](images/LogicClassDiagram.png)

**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`.

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

Each of the four main components (also shown in the diagram above),

* defines its *API* in an `interface` with the same name as the Component.
* implements its functionality using a concrete `{Component Name}Manager` class (which follows the corresponding API `interface` mentioned in the previous point.

For example, the `Logic` component defines its API in the `Logic.java` interface and implements its functionality using the `LogicManager.java` class which follows the `Logic` interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.

<img src="images/ComponentManagers.png" width="300" />

The sections below give more details of each component.

### UI component
Expand Down
1 change: 1 addition & 0 deletions docs/diagrams/ArchitectureDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Main -[#grey]-> UI
Main -[#grey]-> Logic
Main -[#grey]-> Storage
Main -up[#grey]-> Model
Main -down[hidden]-> Commons

Storage -up[STORAGE_COLOR].> Model
Storage .right[STORAGE_COLOR].>File
Expand Down
31 changes: 31 additions & 0 deletions docs/diagrams/ComponentManagers.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1
skinparam arrowColor LOGIC_COLOR_T4
skinparam classBackgroundColor LOGIC_COLOR

package Logic {
Interface Logic <<Interface>>
Class LogicManager
}

package Model{
Interface Model <<Interface>>
Class ModelManager
}

package Storage{
Interface Storage <<Interface>>
Class StorageManager
}

Class HiddenOutside #FFFFFF
HiddenOutside ..> Logic

LogicManager .up.|> Logic
ModelManager .up.|> Model
StorageManager .up.|> Storage

LogicManager --> Model
LogicManager --> Storage
@enduml
Binary file modified docs/images/ArchitectureDiagram.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 added docs/images/ComponentManagers.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 087a766

Please sign in to comment.