Skip to content

Commit

Permalink
Merge pull request #271 from AY1920S1-CS2103-T16-3/jon/improve-ppp
Browse files Browse the repository at this point in the history
Add docs
  • Loading branch information
jonchan51 committed Nov 11, 2019
2 parents 1401320 + ddfb8f9 commit db0c53a
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 31 deletions.
37 changes: 27 additions & 10 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ image::LogicClassDiagram.png[]
[discrete]
==== How the architecture components interact with each other

The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1` in the Meme tab.
The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `delete 1` in the Memes tab.

.Component interactions for `delete 1` command
image::ArchitectureSequenceDiagram.png[]
Expand All @@ -83,14 +83,14 @@ image::UiClassDiagram.png[]

*API* : link:{repoURL}/src/main/java/seedu/address/ui/Ui.java[`Ui.java`]

The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `PersonListPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.
The UI consists of a `MainWindow` that is made up of parts e.g.`CommandBox`, `ResultDisplay`, `MemeGridPanel`, `StatusBarFooter` etc. All these, including the `MainWindow`, inherit from the abstract `UiPart` class.

The `UI` component uses JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that are in the `src/main/resources/view` folder. For example, the layout of the link:{repoURL}/src/main/java/seedu/address/ui/MainWindow.java[`MainWindow`] is specified in link:{repoURL}/src/main/resources/view/MainWindow.fxml[`MainWindow.fxml`]

The `UI` component,

* Executes user commands using the `Logic` component.
* Listens for changes to `Model` data and also Statistical Data in `StatsEngine` so that the UI can be updated with the modified data.
* Listens for changes to `Model` data so that the UI can be updated with the modified data.

[[Design-Logic]]
=== Logic component
Expand All @@ -102,7 +102,7 @@ image::LogicClassDiagram.png[]
*API* :
link:{repoURL}/src/main/java/seedu/address/logic/Logic.java[`Logic.java`]

. `Logic` uses a subclass of `WemeParser` to parse the user command.
. `Logic` uses a `WemeParser` to parse the user command.
. This results in a `Command` object which is executed by the `LogicManager`.
. The command execution can affect the `Model` (e.g. adding a meme).
. The result of the command execution is encapsulated as a `CommandResult` object which is passed back to the `Ui`.
Expand Down Expand Up @@ -177,17 +177,17 @@ Only state changes on the internal structure of Weme are undoable.

// tag::undoable[]

Commands such as `list`, `find` that only change the user interface, commands such as `export` and `load` that are related to external files, as well as commands such as `edit` and `delete` that modify the import list are not supported.
Commands such as `list`, `find` that only change the user interface, commands such as `export` and `load` that are related to external files, as well as commands such as `edit` and `delete` in the import tab that modifies the import list are not supported.

These are the list of commands that support undo / redo operations:

* Meme Tab: `add`, `edit`, `delete`, `clear`, `archive`, `unarchive`, `like`, `dislike`, `stage`
* Template Tab: `add`, `edit`, `delete`, `archive`, `unarchive`, `use`
* Create Tab: `add`, `edit`, `delete`, `abort`, `create`
* Memes Tab: `add`, `edit`, `delete`, `clear`, `archive`, `unarchive`, `like`, `dislike`, `stage`
* Templates Tab: `add`, `edit`, `delete`, `clear`, `archive`, `unarchive`, `use`
* Create Tab: `add`, `edit`, `delete`, `move`, `abort`, `create`
* Export Tab: `unstage`, `clear`
* Import Tab: `import`

`undo` and `redo` works between tabs. This means that if you make a change in the Memes tab, by editing a meme, and then you switch to the Templates tab, when you execute `undo`, it reverts the change in the Memes tab as well.
`undo` and `redo` works between tabs. This means that if you make a change in the Memes tab, by editing a meme, and then you switch to the Templates tab, when you execute `undo`, it reverts the change in the Memes tab as well. However, `undo`/`redo` is not usable while viewing a meme.

// end::undoable[]

Expand Down Expand Up @@ -273,7 +273,7 @@ When the handleExit command is called, MainWindow will create a Thread to call `
** Cons: User might expect to undo only when they are in the same context. i.e. Undo Meme commands in Meme context.
* **Alternative 2:** Restrict undoing to its own context
** Pros: More user intuitive. Commands will only affect their own context.
** Cons: Heavily complicates the model. Model will then need to keep track of a versioning of every single context. Does not allow for commands such as `create` which affects the Creation tab and Meme tab without many modifications to the existing structure.
** Cons: Heavily complicates the model. Model will then need to keep track of a versioning of every single context. Does not allow for commands such as `create` which affects the Creation tab and Memes tab without many modifications to the existing structure.

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

Expand Down Expand Up @@ -718,6 +718,23 @@ image::TabSwitchSequenceDiagram.png[]

// end::tabs[]

=== Archives Feature
Archives are an important part of resource management. While users typically enjoy seeing all their memes in one place, some might want to hide some memes, but still keep them in their collection. The archives are the solution to this problem. Users may archive memes they have grown tired of, or even templates they have found a newer version of. It is a way of hiding memes and templates from their default view to reduce clutter.

==== Current Implementation
Both `Meme` and `Template` implement the `Archivable` interface. The `Archivable` interface has one method, `isArchived`. This forces the implementing class to have an `isArchived` boolean field to indicate its current archival status. When archiving an existing `Meme` or `Template`, just like edit, the `archive` command creates a new object but with `isArchived` set to true. While it is possible to archive archived memes, there is no change and it is more likely to be a mistake, hence a `CommandException` is thrown instead. The same applies for `unarchive`.

Since the default view should show all memes/templates that are unarchived, the predicates for the individual filtered lists have to be changed accordingly. The default predicate filters the UniqueLists for the memes/templates where `isArchived` is false, and the opposite is done for the archives predicate.

==== Design Considerations

===== Aspect: Making resources archivable
* **Alternative 1 (current choice):** Implement from an `Archivable` interface
** Pros: Allows for more flexibility when extending the functionality of implementing classes.
** Cons: Some code repetition (Cannot declare instance fields or define the implementing methods).
* **Alternative 2:** Extend a `ArchivableResource` abstract class
** Pros: Less code repetition.
** Cons: Less flexibility in the future. If new types of resouces are considered in the future where Meme and Template have to extend, this implementation becomes technical debt.

// tag::view[]

Expand Down
60 changes: 42 additions & 18 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,42 @@ Format: `dislike INDEX`
Same as like, dislike also allows arrow key operations.

// end::like[]
// tag::archive[]

==== Listing archived memes: `archives`

Lists all archived memes. +
Lists all memes that are archived in the memes tab. +
Format: `archives`

****
* To view unarchived memes again, just execute the `list` command!
****

==== Archiving a meme: `archive`

Archives a meme at the specified index. +
Archives the meme at the specified index. Hides the meme from the default view. +
Format: `archive INDEX`

****
* You can only archive unarchived memes. Execute `list` to see the unarchived memes.
****

==== Unarchiving a meme: `unarchive`

Unarchives a meme at the specified index. +
Unarchives the meme at the specified index. Shows the meme in the default view. +
Format: `unarchive INDEX`

****
* You can only unarchive archived memes. Execute `archives` to see the archived memes.
****
// end::archive[]

==== Viewing a meme: `view`
Views the meme at the specified index. +
Format: `view INDEX`

****
* To exit the view, simply switch to another tab using the tab command.
* To exit the view, simply switch to another tab using the tab command. Only `tab`, `help` and `exit` are usable while viewing a meme.
For example, `tab memes` will bring the user back to the memes tab.
****

Expand Down Expand Up @@ -316,29 +329,40 @@ Format: `delete INDEX`
Clears all templates. +
Format: `clear`

==== Archiving a template: `archive`

Archives the template at the specified index. +
Format: `archive INDEX`

==== Unarchiving a template: `unarchive`
==== Creating memes from templates: `use`

Unarchives the template at the specified index. +
Format: `unarchive INDEX`
Uses the template at the specified index to start a meme creation session. +
Weme will enter the create tab and allow you to add text to the template. +
For details, please refer to the next section <<Create Tab>>. +
Format: `use INDEX`

// end::templates[]
==== Listing all archived templates: `archives`

Lists all templates that are archived in the templates tab. +
Format: `archives`

==== Creating memes from templates: `use`
****
* To view unarchived templates again, just execute the `list` command!
****

Uses the template at the specified index to start a meme creation session. +
Weme will enter the create tab and allow you to add text to the template. +
For details, please refer to the next section <<Create Tab>>. +
Format: `use INDEX`
==== Archiving a template: `archive`

// end::templates[]
Archives the template at the specified index. Hides the template from the default view.+
Format: `archive INDEX`

****
* You can only archive unarchived templates. Execute `list` to see the unarchived templates.
****

==== Unarchiving a template: `unarchive`

Unarchives the template at the specified index. Shows the template in the default view.+
Format: `unarchive INDEX`

****
* You can only unarchive archived templates. Execute `archives` to see the archived templates.
****

// tag::meme-create[]

Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/CommitActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ start
'diamond we place it as the true branch instead.

if () then ([command commits Weme])
:Purge redunant states;
:Purge redundant states;
:Save Weme to
versionedWemeStates;
else ([else])
Expand Down
Binary file modified docs/images/CommitActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions docs/team/jonchan51.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing and future commands, as well as the structure of the model part of the application. Especially due to the inclusion of files in the form of images, an in-depth analysis of design alternatives had to be considered. It was challenging to ensure that the implementation supported existing commands, while keeping in mind and support the features our application will deliver.
** Highlights: This enhancement affects existing and future commands, as well as the design of the model of the application. The inclusion of files, as we are handling meme images, complicates a lot of logic with the existing commands. Commands that were easy to implement such as `add` were not trivial to undo when local files are being manipulated. As a result, many alternatives had to be considered before arriving to a well-planned conclusion. A thorough understanding of how the entire application functioned was necessary to ensure that the undo/redo implementation syncs well with existing and future commands, making the design of the feature much more complicated.
** Credits: Basic idea from AB4 implementation.

* *Minor enhancement*:
** Added archive-related commands for Memes and Templates [https://github.com/AY1920S1-CS2103-T16-3/main/pull/133[#133]]
** Added logic for tabs [https://github.com/AY1920S1-CS2103-T16-3/main/pull/40[#40]]
** Added archive-related commands with tests for Memes and Templates [https://github.com/AY1920S1-CS2103-T16-3/main/pull/133[#133]] [https://github.com/AY1920S1-CS2103-T16-3/main/pull/209[#209]]

* *Code contributed*: [https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false&tabOpen=true&tabType=authorship&tabAuthor=jonchan51&tabRepo=AY1920S1-CS2103-T16-3%2Fmain%5Bmaster%5D[RepoSense Code]]

Expand All @@ -30,8 +30,10 @@
** Project management:
*** Extensively reviewed most of peer's pull requests before merging into master [https://github.com/AY1920S1-CS2103-T16-3/main/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aclosed+reviewed-by%3Ajonchan51[Reviews]]
*** Managed issues and milestones on GitHub for weekly deadlines.
*** Renamed AB3 to Weme as part of morphing [https://github.com/AY1920S1-CS2103-T16-3/main/pull/10[#10]]
** Enhancements to existing features:
*** Fixed SampleDataUtil for file support [https://github.com/AY1920S1-CS2103-T16-3/main/pull/67[#67]]
*** Fixed GUI to support larger range of resolutions [https://github.com/AY1920S1-CS2103-T16-3/main/pull/247[#247]]
** Documentation:
*** Assisted with update of documentation from addressbook3 to Weme [https://github.com/AY1920S1-CS2103-T16-3/main/pull/75[#75]]
** Community:
Expand All @@ -47,11 +49,17 @@

include::../UserGuide.adoc[tag=undoredo]

include::../UserGuide.adoc[tag=archive]

== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

****
Besides the section below, I have also written the https://ay1920s1-cs2103-t16-3.github.io/main/DeveloperGuide.html#archives-feature[Archives Feature] section.
****

include::../DeveloperGuide.adoc[tag=undoredo]

0 comments on commit db0c53a

Please sign in to comment.