<commit_before># Developer Guide 

* [Introduction](#introduction)
* [Setting Up](#setting-up)
* [Design](#design)
* [Implementation](#implementation)
* [Testing](#testing)
* [Dev Ops](#dev-ops)
* [Appendix A: User Stories](#appendix-a--user-stories)
* [Appendix B: Use Cases](#appendix-b--use-cases)
* [Appendix C: Non Functional Requirements](#appendix-c--non-functional-requirements)
* [Appendix D: Glossary](#appendix-d--glossary)
* [Appendix E: Product Survey](#appendix-e-product-survey)

## Introduction

TaskMan is a task manager for keyboard lovers. It is a Java desktop application which accepts inputs in the form of commands typed by the user. The GUI is for output.

This guide is for developers to understand the workings behind TaskMan. It describes the design, requirements, analysis of existing task managers, and the implementation of TaskMan. It will guide you with setting up the development environment for TaskMan and prime you towards your first patch.

Please refer to the [User Guide](docs/UserGuide.md) on how to use the application as an end-user. Having a go with the actual application also helps greatly when working on the business logic of the app. Do give it a try!

## Setting up

#### Prerequisites
You will need to install the following prerequisites to get started.

1. **JDK `1.8.0_60`**  or later<br>

    > Having any Java 8 version is not enough. <br>
    This app will not work with earlier versions of Java 8.
    
2. **Eclipse** IDE
3. **e(fx)clipse** plugin for Eclipse (Do the steps 2 onwards given in
   [this page](http://www.eclipse.org/efxclipse/install.html#for-the-ambitious))
4. **Buildship Gradle Integration** plugin from the Eclipse Marketplace


#### Importing the project into Eclipse
You can import the project into Eclipse by following the steps below:

0. Fork this repo, and clone the fork to your computer
1. Open Eclipse (Note: Ensure you have installed the **e(fx)clipse** and **buildship** plugins as given 
   in the prerequisites above)
2. Click `File` > `Import`
3. Click `Gradle` > `Gradle Project` > `Next` > `Next`
4. Click `Browse`, then locate the project's directory
5. Click `Finish`

  > * If you are asked whether to 'keep' or 'overwrite' config files, choose to 'keep'.
  > * Depending on your connection speed and server load, it can even take up to 30 minutes for the set up to finish
      (This is because Gradle downloads library files from servers during the project set up process)
  > * If Eclipse auto-changed any settings files during the import process, you can discard those changes.

## Design

### Architecture

<img src="images/Architecture.png" width="600"><br>

First, let’s talk about the architecture of the whole application. You can refer to the **_Architecture Diagram_** given above for a quick overview of the high-level design of the app. 
Do read the following short descriptions to at least have a clear idea of the separation of concerns in the application.

The `Main` component comprises of one class, called [`MainApp`](../src/main/java/seedu/taskman/MainApp.java). It is responsible for:
* At app launch: Initializing the application’s components in the correct sequence, and connecting them up with each other.
* At shut down: Shuts down the components and frees resources where necessary.

[**`Commons`**](#common-classes) represents a collection of classes used by other components. You can also look here to find other helper classes. 
Two classes in this component play important roles at the architecture level.
* `EventsCenter`: You would need this class (written using [Google's Event Bus library](https://github.com/google/guava/wiki/EventBusExplained)) to enable communication between components using events (i.e. a form of Event Driven design)
* `LogsCenter`: You can use this class to write log messages to the App's log file.

The rest of the App consists four components.
* [**`UI`**](#ui-component) : The User Interface (UI) of the App. You should use this component to handle user interactions, display information and accept user feedback.
* [**`Logic`**](#logic-component) : The command executor. You should use this component to parse and execute commands entered by the user. 
* [**`Model`**](#model-component) : Holds the data of the App in-memory. You should store and handle the data which the user interacts with in this component.
* [**`Storage`**](#storage-component) : Reads data from, and writes data to the hard disk. You should handle file-writing and file-reading operations of the data in this component. 

Each of the four components:
* Defines its _API_ in an `interface` with the same name as the Component.
* Exposes its functionality using a `{Component Name}Manager` class.

For more information on each specific component, you can read the corresponding sections in this documentation. 

### UI component
<!--@@author A0140136W-->
<img src="images/UiClassDiagram.png" width="600"><br>

**API** : [`Ui.java`](../src/main/java/seedu/taskman/ui/Ui.java)

The `UI` component is where you should be looking at if you are interested in how the application 
interacts with the user. The `UI` consists of a `MainWindow` that is made up of parts e.g. `CommandBox`, 
`ResultDisplay`, `ActivityPanel`, `StatusBarFooter`, etc. You can load all these UI parts, including the
`MainWindow`, using the `UiPartLoader` as they inherit from the abstract `UiPart` class.
<!--@@author-->

The `UI` component uses JavaFx UI framework. You can find the layout of these UI parts are in 
matching `.fxml` files that are in the `src/main/resources/view` folder.<br>
For example, the layout of the [`MainWindow`](../src/main/java/seedu/taskman/ui/MainWindow.java) is specified 
in [`MainWindow.fxml`](../src/main/resources/view/MainWindow.fxml).
<!--@@author A0121299A-->
<img src="images/UiActivityCardClassDiagram.PNG" width="400"><br>

You can load multiple `ActivityPanel` parts in the `MainWindow` and control 
the kind of display for the `Activity` objects in the panel through 
the `ActivityCardLoader` class.
<!--@@author-->
In summary, the `UI` component,
* Executes user commands using the `Logic` component.
* Binds itself to some data in the `Model` so that the UI can auto-update when data in the `Model` change.
* Responds to events raised from various parts of the App and updates the UI accordingly.

<!--@@author A0139019E-->
### Logic component

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

**API** : [`Logic.java`](../src/main/java/seedu/taskman/logic/Logic.java)

When input from the user is entered, the UI would call on the Logic component to act on the command entered. 
We use CommandParser to help create the appropriate Command object, depending on the input by the user. 
For the more complicated concrete Command subclasses, we implement prepare{Command} in the Command subclass 
to parse the fields entered by the user according to the type of command specifically. 
The Command objects can change the Model, Storage components and/or raise events. 
Given below is the Sequence Diagram for interactions within the Logic component for the execute("delete d1") API call.

<img src="images/LogicSequenceDiagram.png" width="800"><br>
As seen in Figure 3.3.2, commands that have been successfully executed (checked with result.success) and 
have been flagged for storing (through the storeHistory field) will undergo an additional process. 
A CommandHistory object will be created, storing fields related to the state of the Model before the command was 
executed, as well as the input string for the command. This object will then be stored into the HistoryDeque. 
The HistoryDeque is utilized by the History and Undo commands, containing snapshots of the Model component at different times.

<img src="images/CommandTypes.png" width="800"><br>
Figure 3.3.3 illustrates the storeHistory field for commands. 
The storeHistory field is set to true for some commands, and false for others.
View Command.java & the respective concrete Commands for more details.


In summary, the Logic Component:
Uses the CommandParser class to parse the user command.
Executes the resultant Command object.
Can affect the Model (e.g. adding a task), Storage (e.g. alter save location),  HistoryDeque and/or raise events.
Passes result of the command execution as a CommandResult object to the UI component.
1. `Logic` uses the `Parser` class to parse the user command.
2. This results in a `Command` object which is executed by the `LogicManager`.
3. The command execution can affect the `Model` (e.g. adding a task) and/or raise events.
4. The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`.

<!--@@author-->

### Model component<commit_msg>Modified DG<commit_after># Developer Guide 

* [Introduction](#introduction)
* [Setting Up](#setting-up)
* [Design](#design)
* [Implementation](#implementation)
* [Testing](#testing)
* [Dev Ops](#dev-ops)
* [Appendix A: User Stories](#appendix-a--user-stories)
* [Appendix B: Use Cases](#appendix-b--use-cases)
* [Appendix C: Non Functional Requirements](#appendix-c--non-functional-requirements)
* [Appendix D: Glossary](#appendix-d--glossary)
* [Appendix E: Product Survey](#appendix-e-product-survey)

## Introduction

TaskMan is a task manager for keyboard lovers. It is a Java desktop application which accepts inputs in the form of commands typed by the user. The GUI is for output.

This guide is for developers to understand the workings behind TaskMan. It describes the design, requirements, analysis of existing task managers, and the implementation of TaskMan. It will guide you with setting up the development environment for TaskMan and prime you towards your first patch.

Please refer to the [User Guide](docs/UserGuide.md) on how to use the application as an end-user. Having a go with the actual application also helps greatly when working on the business logic of the app. Do give it a try!

## Setting up

#### Prerequisites
You will need to install the following prerequisites to get started.

1. **JDK `1.8.0_60`**  or later<br>

    > Having any Java 8 version is not enough. <br>
    This app will not work with earlier versions of Java 8.
    
2. **Eclipse** IDE
3. **e(fx)clipse** plugin for Eclipse (Do the steps 2 onwards given in
   [this page](http://www.eclipse.org/efxclipse/install.html#for-the-ambitious))
4. **Buildship Gradle Integration** plugin from the Eclipse Marketplace


#### Importing the project into Eclipse
You can import the project into Eclipse by following the steps below:

0. Fork this repo, and clone the fork to your computer
1. Open Eclipse (Note: Ensure you have installed the **e(fx)clipse** and **buildship** plugins as given 
   in the prerequisites above)
2. Click `File` > `Import`
3. Click `Gradle` > `Gradle Project` > `Next` > `Next`
4. Click `Browse`, then locate the project's directory
5. Click `Finish`

  > * If you are asked whether to 'keep' or 'overwrite' config files, choose to 'keep'.
  > * Depending on your connection speed and server load, it can even take up to 30 minutes for the set up to finish
      (This is because Gradle downloads library files from servers during the project set up process)
  > * If Eclipse auto-changed any settings files during the import process, you can discard those changes.

## Design

### Architecture

<img src="images/Architecture.png" width="600"><br>

First, let’s talk about the architecture of the whole application. You can refer to the **_Architecture Diagram_** given above for a quick overview of the high-level design of the app. 
Do read the following short descriptions to at least have a clear idea of the separation of concerns in the application.

The `Main` component comprises of one class, called [`MainApp`](../src/main/java/seedu/taskman/MainApp.java). It is responsible for:
* At app launch: Initializing the application’s components in the correct sequence, and connecting them up with each other.
* At shut down: Shuts down the components and frees resources where necessary.

[**`Commons`**](#common-classes) represents a collection of classes used by other components. You can also look here to find other helper classes. 
Two classes in this component play important roles at the architecture level.
* `EventsCenter`: You would need this class (written using [Google's Event Bus library](https://github.com/google/guava/wiki/EventBusExplained)) to enable communication between components using events (i.e. a form of Event Driven design)
* `LogsCenter`: You can use this class to write log messages to the App's log file.

The rest of the App consists four components.
* [**`UI`**](#ui-component) : The User Interface (UI) of the App. You should use this component to handle user interactions, display information and accept user feedback.
* [**`Logic`**](#logic-component) : The command executor. You should use this component to parse and execute commands entered by the user. 
* [**`Model`**](#model-component) : Holds the data of the App in-memory. You should store and handle the data which the user interacts with in this component.
* [**`Storage`**](#storage-component) : Reads data from, and writes data to the hard disk. You should handle file-writing and file-reading operations of the data in this component. 

Each of the four components:
* Defines its _API_ in an `interface` with the same name as the Component.
* Exposes its functionality using a `{Component Name}Manager` class.

For more information on each specific component, you can read the corresponding sections in this documentation. 

### UI component
<!--@@author A0140136W-->
<img src="images/UiClassDiagram.png" width="600"><br>

**API** : [`Ui.java`](../src/main/java/seedu/taskman/ui/Ui.java)

The `UI` component is where you should be looking at if you are interested in how the application 
interacts with the user. The `UI` consists of a `MainWindow` that is made up of parts e.g. `CommandBox`, 
`ResultDisplay`, `ActivityPanel`, `StatusBarFooter`, etc. You can load all these UI parts, including the
`MainWindow`, using the `UiPartLoader` as they inherit from the abstract `UiPart` class.
<!--@@author-->

The `UI` component uses JavaFx UI framework. You can find the layout of these UI parts are in 
matching `.fxml` files that are in the `src/main/resources/view` folder.<br>
For example, the layout of the [`MainWindow`](../src/main/java/seedu/taskman/ui/MainWindow.java) is specified 
in [`MainWindow.fxml`](../src/main/resources/view/MainWindow.fxml).
<!--@@author A0121299A-->
<img src="images/UiActivityCardClassDiagram.PNG" width="400"><br>

You can load multiple `ActivityPanel` parts in the `MainWindow` and control 
the kind of display for the `Activity` objects in the panel through 
the `ActivityCardLoader` class.
<!--@@author-->
In summary, the `UI` component,
* Executes user commands using the `Logic` component.
* Binds itself to some data in the `Model` so that the UI can auto-update when data in the `Model` change.
* Responds to events raised from various parts of the App and updates the UI accordingly.

<!--@@author A0139019E-->
### Logic component

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

**API** : [`Logic.java`](../src/main/java/seedu/taskman/logic/Logic.java)

When input from the user is entered, the UI would call on the Logic component to act on the command entered. 
We use CommandParser to help create the appropriate Command object, depending on the input by the user. 
For the more complicated concrete Command subclasses, we implement prepare{Command} in the Command subclass 
to parse the fields entered by the user according to the type of command specifically. 
The Command objects can change the Model, Storage components and/or raise events. 
Given below is the Sequence Diagram for interactions within the Logic component for the execute("delete d1") API call.

<img src="images/LogicSequenceDiagram.png" width="800"><br>

As seen above, commands that have been successfully executed (checked with result.success) and 
have been flagged for storing (through the storeHistory field) will undergo an additional process. 
A CommandHistory object will be created, storing fields related to the state of the Model before the command was 
executed, as well as the input string for the command. This object will then be stored into the HistoryDeque. 
The HistoryDeque is utilized by the History and Undo commands, containing snapshots of the Model component at different times.

<img src="images/CommandTypes.png" width="400"><br>
The above figure illustrates the storeHistory field for commands. 
The storeHistory field is set to true for some commands, and false for others.
View Command.java & the respective concrete Commands for more details.


In summary, the Logic Component:
Uses the CommandParser class to parse the user command.
Executes the resultant Command object.
Can affect the Model (e.g. adding a task), Storage (e.g. alter save location),  HistoryDeque and/or raise events.
Passes result of the command execution as a CommandResult object to the UI component.
1. `Logic` uses the `Parser` class to parse the user command.
2. This results in a `Command` object which is executed by the `LogicManager`.
3. The command execution can affect the `Model` (e.g. adding a task) and/or raise events.
4. The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`.

<!--@@author-->

### Model component
{'fraction_non_alphanumeric': 0.08886601475381713, 'fraction_numerical': 0.007662835249042145, 'mean_word_length': 4.572976418100701, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 61, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5593184', 'n_tokens_mistral': 4821, 'n_tokens_neox': 4547, 'n_words': 2371}