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

added commands for reminders in UG and amended DG for MoneyGoWhere #95

Merged

Conversation

minpyaemoe
Copy link

No description provided.

@minpyaemoe minpyaemoe added the type.Documentation Improvements or additions to documentation label Oct 23, 2019
Copy link

@Nanosync Nanosync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also upload the new png files for the diagrams

* does not depend on any of the other three components.

[NOTE]
As a more OOP model, we can store a `Tag` list in `Address Book`, which `Person` can reference. This would allow `Address Book` to only require one `Tag` object per unique `Tag`, instead of each `Person` needing their own `Tag` object. An example of how such a model may look like is given below. +
As a more OOP model, we can store a `Tag` list in `Moneygowhere`, which `Spending` can reference. This would allow `Spending Book` to only require one `Tag` object per unique `Tag`, instead of each `Spending` needing their own `Tag` object. An example of how such a model may look like is given below. +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spending Book

@@ -157,56 +157,56 @@ This section describes some noteworthy details on how certain features are imple
=== [Proposed] Undo/Redo feature
==== Proposed Implementation

The undo/redo mechanism is facilitated by `VersionedAddressBook`.
It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`.
The undo/redo mechanism is facilitated by `VersionedMoneygowhere`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VersionedSpendingBook

The undo/redo mechanism is facilitated by `VersionedAddressBook`.
It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`.
The undo/redo mechanism is facilitated by `VersionedMoneygowhere`.
It extends `Moneygowhere` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpendingBook
spendingBookStateList

Comment on lines 164 to 166
* `Versionedmoneygowhere#commit()` -- Saves the current address book state in its history.
* `Versionedmoneygowhere#undo()` -- Restores the previous address book state from its history.
* `Versionedmoneygowhere#redo()` -- Restores a previously undone address book state from its history.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VersionedSpendingBook

replace address book to spending book


These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively.
These operations are exposed in the `Model` interface as `Model#commitmoneygowhere()`, `Model#undomoneygowhere()` and `Model#redomoneygowhere()` respectively.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commitSpendingBook
undoSpendingBook
redoSpendingBook


The following sequence diagram shows how the undo operation works:

image::UndoSequenceDiagram.png[]

NOTE: The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.

The `redo` command does the opposite -- it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state.
The `redo` command does the opposite -- it calls `Model#redomoneygowhere()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


[NOTE]
If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone address book states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.
If the `currentStatePointer` is at index `moneygowhereStateList.size() - 1`, pointing to the latest address book state, then there are no undone address book states to restore. The `redo` command uses `Model#canRedomoneygowhere()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged.
Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitMoneygowhere()`, `Model#undoMoneygowhere()` or `Model#redoMoneygowhere()`. Thus, the `MoneygowhereStateList` remains unchanged.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


image::UndoRedoState4.png[]

Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow.
Step 6. The user executes `clear`, which calls `Model#commitMoneygowhere()`. Since the `currentStatePointer` is not pointing at the end of the `MoneygowhereStateList`, all address book states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

** Cons: We must ensure that the implementation of each individual command are correct.

===== Aspect: Data structure to support the undo/redo commands

* **Alternative 1 (current choice):** Use a list to store the history of address book states.
** Pros: Easy for new Computer Science student undergraduates to understand, who are likely to be the new incoming developers of our project.
** Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both `HistoryManager` and `VersionedAddressBook`.
** Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update both `HistoryManager` and `VersionedMoneygowhere`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

[-> LogicManager : execute("reminder d/today m/Pay bill")
activate LogicManager

LogicManager -> MoneyGoWhereParser : parseCommand("reminder d/today m/Pay bill")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SpendingBookParser

[NOTE]
The above sequence diagram demonstrates how a new reminder is constructed from valid user input.

Following is the activity diagram including the series of actions performed by MoneyGOWhere when it receives `DeleteReminderCommand`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MoneyGoWhere typo

@Nanosync Nanosync merged commit 404e929 into AY1920S1-CS2103T-F13-3:master Oct 24, 2019
@choongyx choongyx added this to the v1.3 milestone Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type.Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants