diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index a97686ae1b..3c67468491 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -4,9 +4,96 @@ {list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} -## Design +## 1. Introduction +Welcome to the Developer Guide for BudgetBuddy! This guide has been created to help you current and future +developers of Budget understand how BudgetBuddy works and aid developers in easily adding new features, +fix bugs. In this guide, it will go over the main parts of the app, how they work together, +and why we made them that way. -## Implementation +## 2. Setup Guide +This section describes how to set up the coding environment, along with the tools needed to work on BudgetBuddy + +### 2.1. Prerequisites +1. JDK 11 +2. IntelliJ IDEA + +## 3.Design + +### 3.1 Architecture +The following diagram provides a rough overview of how BudgetBuddy is built + +![Diagram of overview of BudgetBuddy](diagrams/Introduction.jpg) + +`BudgetBuddy` is the main class of the application and directly interacts with the user, passing along the input +into the Parser. The `Parser` creates a `CommandCreator` object depending on the user's input. The `CommandCreator` +object then creates the `Command` object. This `Command` will be executed in `BudgetBuddy`. The `Command` object +utilizes methods and the class present in the `Application Classes`, which will be explained in more +detail in the following sections. + +#### 3.2 Parser Class +The main functionality of the Parser Class is to determine the type of `CommandCreator` object to initialize, and +return the created `Command` object created by the `CommandCreator` back to `BudgetBuddy` + +#### 3.3 Ui Class +The Ui Class is used to print certain elements to the CLI. In particular, it consists of the Welcome Message, +Goodbye Message, Divider Lines and all the corresponding commands' command format. + +#### 3.5 CommandCreator Class +The CommandCreator class contains multiple subclasses, which corresponding to a specific function of the application. +Within the CommandCreator classes, it handles making sense of the user input, obtaining the relevant parameters to be +used in the created `Command` class. + +#### 3.4 Command Class +The Command class, similar to the CommandCreator class, contains multiple subclasses, all corresponding to a specific +function of the application. In this case, each CommandCreator class would be associated to their relevant Commands. +Here is a table of all CommandCreator class and the Commands that they can create. + +"Insert Table Here" + +#### 3.5 Storage Class +The Storage Class handles the loading and saving of the Expenses and Savings in BudgetBuddy. + +### 3.6 Application Classes +The classes present in this group of `Application Classes` refers to certain elements which serves a purpose more +towards the `user` instead of application itself. They represent data of the user's financial transactions, +including expenses and savings, along with mechanisms for organizing and managing this data in meaningful ways. + +##### 3.6.1 Transaction +This is an abstract class, which is the superclass for both the Expense and Saving Classes. It contains common variables +such as Currency, Category and Amount. + +##### 3.6.2 Expense +This class holds details regarding an expense a user has. Within this class, it has 4 class-level variables : +`String category`, `LocalDate dateAdded` , `String description` and `Double amount`. The variables and their relevance +are as follows : + +##### 3.6.3 ExpenseList +This class represents a list of expenses. Within this class, it has 2 class-level variables : +`ArrayList expenses` and `ArrayList categories`, The variables and there relevance are as follows : + +This class also contains the methods to handle any user interactions with the list of expenses. The methods and a +brief explanation on their functionality is as follows : + +##### 3.6.4 Saving +This class holds details regarding a saving a user has. Within this class, it has 3 class-level variables : +`String category`, `LocalDate dateAdded`, `Double amount`. The variables and their relevance +are as follows : + +##### 3.6.5 SavingList +This class represents a list of savings. Within this class, it has 2 class-level variables : +`ArrayList expenses` and `ArrayList categories`, The variables and there relevance are as follows : + +This class also contains the methods to handle any user interactions with the list of savings. The methods and a +brief explanation on their functionality is as follows : + +##### 3.6.6 RecurringExpenseList +Explain what it does + +##### 3.6.7 RecurringExpensesList +Explain what it does + + +## 4. Implementation ### Edit Expense Feature The Edit Expense feature allows users to edit their previously added expenses, specifically the `category`, `amount`, @@ -18,7 +105,7 @@ an `ExpenseList` object, `category`, `index`, `amount` and `description`. The re | Class Attribute | Variable Type | Relevance | |-----------------|---------------|-----------------------------------------------------------------------| | expenses | ExpenseList | ExpenseList Object containing the list of expenses that can be edited | -| category | String | The edited category for the expense in the spciefied index | +| category | String | The edited category for the expense in the specified index | | index | Integer | The index of the expense to be edited from `ExpenseList` | | amount | Double | The edited amount the expense in the specified index should be | | description | String | The edited description for the expense in the specified index | @@ -33,7 +120,7 @@ utilizes the following method from the `ExpenseList` class to edit the expense. The following UML Sequence diagram below shows how the Edit Expense Feature Command is executed when a user inputs a valid edit expense command: -![EditExpenseSequence.png](team%2FEditExpenseSequence.png) +![EditExpenseSequence.png](team/EditExpenseSequence.png) The following is a step by step explanation of the processes that occur for an example input: `edit expense c/Transport i/2 a/40 d/GRAB` @@ -54,19 +141,19 @@ category to "Transport," amount to 40.0, and description to "GRAB." ### Listing feature (List Savings) The Listing Savings Feature enables users to view their savings, potentially filtered by a specific category. This functionality is orchestrated by the `ListSavingsCommand` class, which is initialized by the `Parser` class. Within the `ListSavingsCommand` object, the `Parser` provides it with an `SavingList` object, along with an optional `filterCategory`. The relevance of these class attributes in `ListSavingsCommand` is detailed in the following table: -| Class Attribute | Variable Type | Relevance | -|-----------------|---------------|---------------------------------------------------------------------------------| -| savings | SavingList | The `SavingList` object containing the list of savings to be displayed or filtered | -| filterCategory | String | The category to filter the savings by, if provided | +| Class Attribute | Variable Type | Relevance | +|-----------------|---------------|-------------------------------------------------------------------------------------| +| savings | SavingList | The `SavingLi st` object containing the list of savings to be displayed or filtered | +| filterCategory | String | The category to filter the savings by, if provided | When `BudgetBuddy` invokes the `execute()` method via `command.execute()`, the `ListSavingsCommand` object uses several methods from the `SavingList` class to perform its tasks: -| Method | Return Type | Relevance | -|------------------|--------------------|-------------------------------------------------------------------| -| getSavings() | ArrayList | Retrieves the list of all savings from the `SavingList` | -| findTotalSavings() | void | Calculates the total amount of savings stored in `SavingList` | -| listSavings() | void | Prints the savings, filtered by `filterCategory`, to the CLI | -| calculateRemainingSavings() | double | Calculates the remaining amount after deducting total expenses | +| Method | Return Type | Relevance | +|-----------------------------|--------------------|----------------------------------------------------------------| +| getSavings() | ArrayList | Retrieves the list of all savings from the `SavingList` | +| findTotalSavings() | void | Calculates the total amount of savings stored in `SavingList` | +| listSavings() | void | Prints the savings, filtered by `filterCategory`, to the CLI | +| calculateRemainingSavings() | double | Calculates the remaining amount after deducting total expenses | The Listing Savings feature follows these steps when a user inputs a command to list savings: 1. The user inputs `list savings [optional: filterCategory]`. This input is processed by the `Parser` class in `BudgetBuddy`, which creates a `ListSavingsCommand` object with `savings` set to the current `SavingList` and `filterCategory` to the user-specified category, if any. @@ -110,12 +197,12 @@ The sequence diagram for the Listing Expenses feature would illustrate the above ### Currency Converter feature The Currency Converter Feature allows users to convert the currency of expenses and savings. This feature is facilitated by the `ChangeCurrencyCommand` class, initialized by the `Parser` class with `CurrencyConverter`, `ExpenseList`, and `SavingList` objects, alongside the `newCurrency` to convert to. The importance of these class attributes is as follows: -| Class Attribute | Variable Type | Relevance | -|------------------|-------------------|-----------------------------------------------------------------------------------| -| currencyConverter| CurrencyConverter | The object responsible for currency conversion calculations | -| expenseList | ExpenseList | Contains the expenses whose currency will be converted | -| savingList | SavingList | Contains the savings whose currency will be converted | -| newCurrency | Currency | The new currency to which the amounts will be converted | +| Class Attribute | Variable Type | Relevance | +|-------------------|-------------------|-------------------------------------------------------------| +| currencyConverter | CurrencyConverter | The object responsible for currency conversion calculations | +| expenseList | ExpenseList | Contains the expenses whose currency will be converted | +| savingList | SavingList | Contains the savings whose currency will be converted | +| newCurrency | Currency | The new currency to which the amounts will be converted | When `BudgetBuddy` calls `command.execute()`, `ChangeCurrencyCommand` employs the following methods from `CurrencyConverter` to convert the currency of all financial records: @@ -225,30 +312,30 @@ E.g `find expenses d/bruno` the provided user input 4. The `Parser` then calls `FindExpensesCommandCreator#createCommand()`. 5. `FindExpensesCommandCreator#createCommand()` then calls `FindExpensesCommandCreator#handleFindExpensesCommand()` -4. Within `handleFindExpensesCommand(input)`, the first check would be the check for the existence of any combination of +6. Within `handleFindExpensesCommand(input)`, the first check would be the check for the existence of any combination of `d/ , morethan/ and lessthan/`. If none of these combinations were found, it immediately returns `null` -5. This is then followed by a second check `checkForDuplicateParameters()`, which checks for duplicates of parameters +7. This is then followed by a second check `checkForDuplicateParameters()`, which checks for duplicates of parameters in the user input. It duplicates are found, similarly, it immediately returns `null`. -5. If the checks in `4.` and `5` is passed, Three variables would be initialized. +8. If the checks in `4.` and `5` is passed, Three variables would be initialized. * | Variable Name | Variable Type | |---------------|---------------| | description | String | | minAmount | Double | | maxAmount | Double | -6. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable +9. Depending on which parameters were present, the corresponding input would be extracted and placed into each variable using the `FindExpensesCommandCreator#parse*()`, where `*` represents the variable name we wish to obtain. -7. Should the values of `minAmount` and `maxAmount` not be empty, a check is done to ensure `minAmount` is less than +10. Should the values of `minAmount` and `maxAmount` not be empty, a check is done to ensure `minAmount` is less than or equals to `maxAmount`. If this check does not pass, the function immediately returns `null` -8. Finally, `FindExpensesCommandCreator#handleFindExpensesCommand()` creates and returns a -`FindExpensesCommand` containg the extracted description, minAmount and maxAmount,to -9. `FindExpensesCommandCreator#createCommand()`, which is returned to, `Parser#parseCommand()` +11. Finally, `FindExpensesCommandCreator#handleFindExpensesCommand()` creates and returns a +`FindExpensesCommand` containing the extracted description, minAmount and maxAmount +12. `FindExpensesCommandCreator#createCommand()`, which is returned to, `Parser#parseCommand()` , which is then returned to `BudgetBuddy` The following UML Sequence diagram below shows how the Find Feature command works when a user provides a **valid** find expenses command: -![Sequence diagram for Find Feature](diagrams/sequenceDiagram_FindExpenses.jpg) +![Sequence diagram for Find Feature](diagrams/SequenceDiagram_FindExpenses.jpg) The following is an example of the processes that occur when the user uses the find expenses feature: @@ -266,28 +353,39 @@ class from `BudgetBuddy`, which constructs a `FindExpenseCommand` Object with `e 4. `execute()`then calls `ExpenseList#filterexpenses`, which returns the filtered expenses based on the `description`, `minAmount` and `maxAmount` into the `filteredExpenses` variable. 5. If `filteredExpenses` is empty, "No Matching Expenses Found" is printed and `execute` ends here. -5. If `filteredExpenses` is not empty, `execute()` then initializes a new variable `filteredExpenseList` +6. If `filteredExpenses` is not empty, `execute()` then initializes a new variable `filteredExpenseList` of type `ExpenseList` with `filteredExpenses` initialized as the `expenses` Class attribute. -6. Finally `execute()` calls `filteredExpenseList#listexpenses()` to print filtered expenses into the CLI. +7. Finally `execute()` calls `filteredExpenseList#listexpenses()` to print filtered expenses into the CLI. -## Product scope -### Target user profile -{Describe the target user profile} +## 5. Product scope + +### Target user profile +This product is for users who can type fast, and wishes to handle and track their current and future +expenses on a singular platform. ### Value proposition +BudgetBuddy is faster and more efficient way to track and calculate current and future expenses if a user is able to +type fast. It also provides the ability to deal with finances on a singular platform. -{Describe the value proposition: what problem does it solve?} +## 6. User Stories ## User Stories -| Version | As a ... | I want to ... | So that I can ... | -|---------|-------------------|----------------------------------------------------------|------------------------------------------------------------------| -| v1.0 | user | be able to view my expenses | track my prior expenditures and plan future expenses accordingly | -| v1.0 | user | be able to view my savings | plan my budget accordingly | -| v1.0 | user | be able to view my expenses by their relevant categories | control my spending | -| v1.0 | user | be able to identify my largest savings category | allocate necessary saved funds | -| v2.0 | frequent traveler | log my expenses in multiple currencies | accurately track my expenses across different countries | +| Version | As a ... | I want to ... | So that I can ... | +|---------|-------------------|-----------------------------------------------------------|------------------------------------------------------------------| +| v1.0 | user | be able to view my expenses | track my prior expenditures and plan future expenses accordingly | +| v1.0 | user | be able to view my savings | plan my budget accordingly | +| v1.0 | user | be able to view my expenses by their relevant categories | control my spending | +| v1.0 | user | be able to identify my largest savings category | allocate necessary saved funds | +| v1.0 | user | add expenses | track my spending | +| v1.0 | user | Categorise my expenses | manage my finances more efficiently | +| v1.0 | user | Edit or delete expenses | remove any incorrectly added items | +| v1.0 | user | allocate saved funds | know how much I will have left after expenses | +| v1.0 | User | See what commands i can use | I know how to use the application | +| v2.0 | user | Plan my budget | Avoid overspending | +| v2.0 | frequent traveler | log my expenses in multiple currencies | accurately track my expenses across different countries | + ## Non-Functional Requirements diff --git a/docs/diagrams/Introduction.jpg b/docs/diagrams/Introduction.jpg new file mode 100644 index 0000000000..8e56209d35 Binary files /dev/null and b/docs/diagrams/Introduction.jpg differ