Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DG changes #210

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ The ***Architecture Diagram*** given below explains the high-level design of the

**Main components of the architecture**

Here we provide the details of each of the main components.
**`Main`** has two classes called [`Main`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/Main.java) and [`MainApp`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/MainApp.java). It is responsible for,

**`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.
* At shut down: Shuts down the components and invokes cleanup methods where necessary.

[**`Commons`**](#common-classes) represents a collection of classes used by multiple other components.

FastTrack also consists of four other components.
FastTrack also consists of five other components.

* [**`UI`**](#ui-component): The UI of the App.
* [**`Logic`**](#logic-component): The command executor.
* [**`Model`**](#model-component): Holds the data of the App in memory.
* [**`AnalyticModel`**](#analyticmodel-component): Holds the data and outputs statistics based on the data in memory.
* [**`Storage`**](#storage-component): Reads data from, and writes data to, the hard disk.


Expand All @@ -88,7 +88,7 @@ The *Sequence Diagram* below shows how the components interact with each other f

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

Each of the four main components (also shown in the diagram above),
Each of the 5 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.)
Expand All @@ -103,7 +103,7 @@ The sections below give more details of each component.

This component is responsible for displaying and interacting with users of FastTrack through the GUI.

The **API** of this component is specified in [`Ui.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/Ui.java)
The **API** of this component is specified in [`Ui.java`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/ui/Ui.java)

#replace

Expand Down Expand Up @@ -137,19 +137,23 @@ The `UI` component,

### Logic component

**API** : [`Logic.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/logic/Logic.java)
**API** : [`Logic.java`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/logic/Logic.java)

Here's a (partial) class diagram of the `Logic` component:
Here's a (partial) class diagram of the `Logic` component, to help guide you along on how it works:

#ReplaceUMLHere

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

How the `Logic` component works:
1. When `Logic` is called upon to execute a command, it uses the `AddressBookParser` class to parse the user command.
1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `AddCommand`) which is executed by the `LogicManager`.
1. The command can communicate with the `Model` when it is executed (e.g. to add a person).
1. When `Logic` is called upon to execute a command, it uses the `ExpenseTrackerParser` class to parse the user command.
1. This results in a `Command` object (more precisely, an object of one of its subclasses' subclass e.g., `AddCategoryCommand`, which implements `AddCommand`) which is executed by the `LogicManager`.
1. The command can communicate with the `Model` when it is executed (e.g. to add a category).
1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`.

The Sequence Diagram below illustrates the interactions within the `Logic` component for the `execute("delete 1")` API call.
The Sequence Diagram below illustrates the interactions within the `Logic` component for the `execute("delcat 1")` API call.

#ReplaceUMLHere

![Interactions Inside the Logic Component for the `delete 1` Command](images/DeleteSequenceDiagram.png)

Expand All @@ -158,44 +162,65 @@ The Sequence Diagram below illustrates the interactions within the `Logic` compo

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

#ReplaceUMLHere

<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 `ExpenseTrackerParser` class creates an `XYZCommandParser` (`XYZ` is a placeholder for the specific command name e.g., `AddCategoryParser`) which uses the other classes shown above to parse the user command and create a `XYZCommand` object (e.g., `AddCategoryCommand`) which the `ExpenseTrackerParser` returns back as a `Command` object.
* All `XYZCommandParser` classes (e.g., `AddCategoryParser`, `DeleteCategoryParser`, ...) 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)
**API** : [`Model.java`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/model/Model.java)

#ReplaceUMLHere

<img src="images/ModelClassDiagram.png" width="450" />


The `Model` component,

* stores the expense tracker data i.e., all `Category` objects (which are contained in a `UniqueCategoryList` object).
* stores the currently 'selected' `Category` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Category>` that can be
* contains the expense tracker data i.e., all `Category` objects (which are contained in a `UniqueCategoryList` object), which is pulled from the `ReadOnlyExpenseTracker` instance.
* contains the currently 'selected' `Category` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Category>` that can be
'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores the expense tracker data i.e., all `Expense` objects (which are contained in a `ExpenseList` object).
* stores the currently 'selected' `Expense` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Expense>` that can be
* contains the expense tracker data i.e., all `Expense` objects (which are contained in a `ExpenseList` object), which is pulled from the `ReadOnlyExpenseTracker` instance.
* contains the currently 'selected' `Expense` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Expense>` that can be
'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)

* does not depend on any of the other four components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)

#Check if this is needed anymore
<div markdown="span" class="alert alert-info">:information_source: **Note:** An alternative (arguably, a more OOP) model is given below. It has a `Category` list in the `ExpenseTracker`, which `Expense` references. This allows `ExpenseTracker` to only require one `Category` object per unique expense, instead of each `Expense` needing their own `Category` objects.<br>

#ReplaceUMLHere

<img src="images/BetterModelClassDiagram.png" width="450" />

</div>

### AnalyticModel component

**API** : [`AnalyticModel.java`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/model/AnalyticModel.java)

#ReplaceUMLHere
#This requires brand-new UML diagram of how analyticmodel component works.

The `AnalyticModel` component,
* contains the expense tracker data (i.e. all `Expense` and `Category` objects, which are respectively contained in `ExpenseList` and `UniqueCategoryList` objects), which are pulled from the `ReadOnlyExpenseTracker` instance.
* calculates statistics based on the expense tracker data available.
* listens to any changes made to expense tracker data (by attaching listeners to the `ExpenseList`), thus dynamically updating statistics.



### Storage component

**API** : [`Storage.java`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/storage/Storage.java)
**API** : [`Storage.java`](https://github.com/AY2223S2-CS2103T-W09-2/tp/blob/master/src/main/java/seedu/address/storage/Storage.java)

#ReplaceUMLHere

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

The `Storage` component,
* can save both address book data and user preference data in json format, and read them back into corresponding objects.
* can save both expense tracker data and user preference data in json format, and read them back into corresponding objects.
* inherits from `ExpenseTrackerStorage`
* depends on some classes in the `Model` component (because the `Storage` component's job is to save/retrieve objects that belong to the `Model`)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import seedu.address.logic.commands.list.ListCategoryCommand;
import seedu.address.logic.commands.list.ListExpensesCommand;
import seedu.address.logic.commands.list.ListRecurringExpensesCommand;
import seedu.address.logic.parser.add.AddCategoryParser;
import seedu.address.logic.parser.add.AddCategoryCommandParser;
import seedu.address.logic.parser.add.AddExpenseCommandParser;
import seedu.address.logic.parser.add.AddRecurringExpenseParser;
import seedu.address.logic.parser.delete.DeleteCategoryParser;
import seedu.address.logic.parser.delete.DeleteCategoryCommandParser;
import seedu.address.logic.parser.delete.DeleteExpenseCommandParser;
import seedu.address.logic.parser.delete.DeleteRecurringExpenseParser;
import seedu.address.logic.parser.edit.EditCategoryParser;
import seedu.address.logic.parser.edit.EditCategoryCommandParser;
import seedu.address.logic.parser.edit.EditExpenseCommandParser;
import seedu.address.logic.parser.edit.EditRecurringExpenseManagerCommandParser;
import seedu.address.logic.parser.exceptions.ParseException;
Expand Down Expand Up @@ -86,13 +86,13 @@ public Command parseCommand(String userInput) throws ParseException {
return new HelpCommand();

case AddCategoryCommand.COMMAND_WORD:
return new AddCategoryParser().parse(arguments);
return new AddCategoryCommandParser().parse(arguments);

case DeleteCategoryCommand.COMMAND_WORD:
return new DeleteCategoryParser().parse(arguments);
return new DeleteCategoryCommandParser().parse(arguments);

case EditCategoryCommand.COMMAND_WORD:
return new EditCategoryParser().parse(arguments);
return new EditCategoryCommandParser().parse(arguments);

case EditExpenseCommand.COMMAND_WORD:
return new EditExpenseCommandParser().parse(arguments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Parses input arguments and creates a new AddCategoryCommand object
*/
public class AddCategoryParser implements Parser<AddCategoryCommand> {
public class AddCategoryCommandParser implements Parser<AddCategoryCommand> {

/**
* Parses the given {@code String} of arguments in the context of the AddCommand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Parses input arguments and creates a new DeleteCommand object
*/
public class DeleteCategoryParser implements Parser<DeleteCategoryCommand> {
public class DeleteCategoryCommandParser implements Parser<DeleteCategoryCommand> {

/**
* Parses the given {@code String} of arguments in the context of the DeleteCommand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Parses input arguments and creates a new EditCategory object
*/
public class EditCategoryParser implements Parser<EditCategoryCommand> {
public class EditCategoryCommandParser implements Parser<EditCategoryCommand> {

/**
* Parses the given {@code String} of arguments in the context of the EditCategory
Expand Down