Skip to content

Commit

Permalink
Merge pull request AY2324S1-CS2113-T18-4#164 from spaceman03/develope…
Browse files Browse the repository at this point in the history
…r-guide

Update DG design section
  • Loading branch information
spaceman03 authored Nov 13, 2023
2 parents 64b8f9f + 314fbac commit eface2b
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 16 deletions.
33 changes: 23 additions & 10 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ requirements, glossary and instructions for testing
## Design

### Architecture

The ***Architecture Diagram*** given below explains the high-level design of the 🪙NUScents🪙 App.
It depicts and provides a quick overview of how the core components interact with each other.

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

### Main Components:
[**`Nuscents`**](https://github.com/AY2324S1-CS2113-T18-4/tp/blob/master/src/main/java/seedu/nuscents/Nuscents.java) is in charge of the app launch and shut down.
* At app launch, it initializes the other components in the correct sequence, and connects them up with each other.
* At shut down, it shuts down the other components and invokes cleanup methods where necessary.

The bulk of the app's work is done by the following five components:

1. **User Interface (UI):**
- Optimized for use via a Command Line Interface (CLI).
Expand All @@ -27,10 +33,7 @@ It depicts and provides a quick overview of how the core components interact wit
4. **Data:**
- Manages financial data and performs operations based on user commands.

5. **NUScents:**
- Central orchestrator coordinating UI, Commands, Parser, and Data.

6. **Storage:**
5. **Storage:**
- Persists financial data to a file or database.

### Interaction Flow:
Expand All @@ -54,6 +57,16 @@ It depicts and provides a quick overview of how the core components interact wit
- **Storage Interaction with Data:**
- The Storage component interacts with the Data for data retrieval or storage.

**UI Component**
The `ui` packages consists of the `Ui` class and the `Messages` class.
The UI component prompts and reads commands from the user and sends the command to `Parser` package to be executed.

**Data Component**
<img src="images/DataClassDiagram.png" width="500" />
The Data component stores the transaction data i.e., all `Transaction` objects in a `TransactionList` object.

Each `Transaction` object stores the information for an `Allowance` or an `Expense`.

## **Implementation**

### `add` Transaction Feature
Expand Down Expand Up @@ -180,14 +193,14 @@ This section describes each component's role for the `filter` feature:
5. **UI**: Displays the filtered transactions using the showFilterMessage method or a not found message using showFilterNotFoundMessage(category) if no matching transactions are found.

#### III. Usage Scenario Example
**Step 1**: User inputs filter entertainment to filter transactions by the 'entertainment' category. The Parser identifies the command and uses parseFilterCategory to extract 'entertainment' as the category.
**Step 2**: A FilterCommand object is created with the category set to 'entertainment'. This command is then passed to the Nuscents class.
**Step 3**: In Nuscents, the execute() method of the FilterCommand is called. It invokes the filterTransaction method on the TransactionList with the category 'entertainment'.
**Step 4**: TransactionList filters its transactions based on the 'entertainment' category. If matching transactions are found, it returns them; otherwise, it indicates that no transactions are found.
**Step 1**: User inputs filter entertainment to filter transactions by the 'entertainment' category. The Parser identifies the command and uses parseFilterCategory to extract 'entertainment' as the category.
**Step 2**: A FilterCommand object is created with the category set to 'entertainment'. This command is then passed to the Nuscents class.
**Step 3**: In Nuscents, the execute() method of the FilterCommand is called. It invokes the filterTransaction method on the TransactionList with the category 'entertainment'.
**Step 4**: TransactionList filters its transactions based on the 'entertainment' category. If matching transactions are found, it returns them; otherwise, it indicates that no transactions are found.
**Step 5**: Depending on the outcome in Step 4, Nuscents instructs the UI to either display the list of filtered transactions and their net balance (using showFilterMessage) or to show a message indicating no transactions were found in the specified category (using showFilterNotFoundMessage).

The following sequence diagram shows how the filter transaction operation works:
<img src="images/FilterSequenceDiagram.png" width="600" />
The following sequence diagram shows how the view transaction operation works:
<img src="images/FilterSequenceDiagram.png" width="800" />

### `budget` Feature

Expand Down
3 changes: 2 additions & 1 deletion docs/diagrams/AddTransactionSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ deactivate parser
nuscents -> AddCommand : execute()
activate AddCommand

AddCommand -> TransactionList : add()
AddCommand -> TransactionList : addTransaction(transaction)
activate TransactionList

TransactionList --> AddCommand
Expand All @@ -47,5 +47,6 @@ AddCommand --> nuscents
deactivate AddCommand

nuscents --> user
destroy AddCommand
deactivate nuscents
@enduml
10 changes: 5 additions & 5 deletions docs/diagrams/ArchitectureDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Package " "<<Rectangle>>{
Class UI UI_COLOR
Class Parser PARSER_COLOR
Class Nuscents #FDDA0D
Class Model #4169E1
Class Data #4169E1
Class Commands #CCCCFF
Class Storage STORAGE_COLOR
}
Expand All @@ -23,12 +23,12 @@ Nuscents -[#E4D00A]> UI
Nuscents -[#E4D00A]> Commands
Nuscents -[#E4D00A]> Parser
UI -[#green]-> Commands
UI -[#green]> Model
UI -[#green]> Data
Commands -[#CCCCFF]> Parser
Commands -[#CCCCFF]> Model
Parser --[PARSER_COLOR]> Model
Commands -[#CCCCFF]> Data
Parser --[PARSER_COLOR]> Data

Storage -up[STORAGE_COLOR].> Model
Storage -up[STORAGE_COLOR].> Data
Storage .left[STORAGE_COLOR].>File
User ..> UI
@enduml
24 changes: 24 additions & 0 deletions docs/diagrams/DataClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml
!include style.puml
skinparam arrowThickness 1.1

Package Data as DataPackage <<Rectangle>>{
Package Transaction as TransactionPackage <<Rectangle>>{
Class Transaction
Class Allowance
Class Expense
Interface TransactionCategory
Enum ExpenseCategory
Enum AllowanceCategory
}
Class TransactionList
}

Allowance -up-|> Transaction
Expense -up-|> Transaction
ExpenseCategory .up.> TransactionCategory
AllowanceCategory .up.> TransactionCategory
TransactionList *-- "*" Transaction
Transaction -> "1" TransactionCategory

@enduml
Binary file removed docs/images/AddAllowanceScreenshot.png
Binary file not shown.
Binary file removed docs/images/AddExpenseScreenshot.png
Binary file not shown.
Binary file modified docs/images/AddTransactionSequenceDiagram.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/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/DataClassDiagram.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 removed docs/images/Delete.png
Binary file not shown.
Binary file removed docs/images/List.png
Binary file not shown.
Binary file removed docs/images/View.png
Binary file not shown.

0 comments on commit eface2b

Please sign in to comment.