diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 7565afaaec..1b319d3684 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -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. ### 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). @@ -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: @@ -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** + +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 @@ -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: - +The following sequence diagram shows how the view transaction operation works: + ### `budget` Feature diff --git a/docs/diagrams/AddTransactionSequenceDiagram.puml b/docs/diagrams/AddTransactionSequenceDiagram.puml index adee7fb001..8d07dd27b8 100644 --- a/docs/diagrams/AddTransactionSequenceDiagram.puml +++ b/docs/diagrams/AddTransactionSequenceDiagram.puml @@ -37,7 +37,7 @@ deactivate parser nuscents -> AddCommand : execute() activate AddCommand -AddCommand -> TransactionList : add() +AddCommand -> TransactionList : addTransaction(transaction) activate TransactionList TransactionList --> AddCommand @@ -47,5 +47,6 @@ AddCommand --> nuscents deactivate AddCommand nuscents --> user +destroy AddCommand deactivate nuscents @enduml \ No newline at end of file diff --git a/docs/diagrams/ArchitectureDiagram.puml b/docs/diagrams/ArchitectureDiagram.puml index 9388540846..9ddd9b5809 100644 --- a/docs/diagrams/ArchitectureDiagram.puml +++ b/docs/diagrams/ArchitectureDiagram.puml @@ -10,7 +10,7 @@ Package " "<>{ Class UI UI_COLOR Class Parser PARSER_COLOR Class Nuscents #FDDA0D - Class Model #4169E1 + Class Data #4169E1 Class Commands #CCCCFF Class Storage STORAGE_COLOR } @@ -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 \ No newline at end of file diff --git a/docs/diagrams/DataClassDiagram.puml b/docs/diagrams/DataClassDiagram.puml new file mode 100644 index 0000000000..50be95c4c8 --- /dev/null +++ b/docs/diagrams/DataClassDiagram.puml @@ -0,0 +1,24 @@ +@startuml +!include style.puml +skinparam arrowThickness 1.1 + +Package Data as DataPackage <>{ + Package Transaction as TransactionPackage <>{ + 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 \ No newline at end of file diff --git a/docs/images/AddAllowanceScreenshot.png b/docs/images/AddAllowanceScreenshot.png deleted file mode 100644 index f730548ae9..0000000000 Binary files a/docs/images/AddAllowanceScreenshot.png and /dev/null differ diff --git a/docs/images/AddExpenseScreenshot.png b/docs/images/AddExpenseScreenshot.png deleted file mode 100644 index 290440ba38..0000000000 Binary files a/docs/images/AddExpenseScreenshot.png and /dev/null differ diff --git a/docs/images/AddTransactionSequenceDiagram.png b/docs/images/AddTransactionSequenceDiagram.png index e2fe630a1e..3e1bf533d5 100644 Binary files a/docs/images/AddTransactionSequenceDiagram.png and b/docs/images/AddTransactionSequenceDiagram.png differ diff --git a/docs/images/ArchitectureDiagram.png b/docs/images/ArchitectureDiagram.png index b2248d00ec..d19aaac494 100644 Binary files a/docs/images/ArchitectureDiagram.png and b/docs/images/ArchitectureDiagram.png differ diff --git a/docs/images/DataClassDiagram.png b/docs/images/DataClassDiagram.png new file mode 100644 index 0000000000..92edbd26c3 Binary files /dev/null and b/docs/images/DataClassDiagram.png differ diff --git a/docs/images/Delete.png b/docs/images/Delete.png deleted file mode 100644 index 8f70e89269..0000000000 Binary files a/docs/images/Delete.png and /dev/null differ diff --git a/docs/images/List.png b/docs/images/List.png deleted file mode 100644 index 315d92d342..0000000000 Binary files a/docs/images/List.png and /dev/null differ diff --git a/docs/images/View.png b/docs/images/View.png deleted file mode 100644 index 8604298d65..0000000000 Binary files a/docs/images/View.png and /dev/null differ