PROJECT: ɯeme


Overview

ɯeme is a meme manager app for those who prefer to use a desktop app for managing memes. More importantly, ɯeme is optimized for those who prefer to work with a Command Line Interface (CLI) while still having the benefits of a Graphical User Interface (GUI). Users can view, tag, search, import and export a collection of meme. They can also create their own memes from meme templates.

Summary of contributions

  • Major enhancement: added the ability to suggest and auto-complete commands

    • What it does: allows the user to type command faster and more easily by showing possible command arguments and allow the user to use TAB key to auto-complete the command.

    • Justification: This feature improves the product significantly because a user can be tired of typing the full command over and over again, or unsure of what arguments to supply. This feature allows the user to see what are the available commands and in case the user forgets the exact spelling of the command, the user can then be reminded of the similar commands and use tab to automatically correct the typo. Furthermore, the user can be reminded of the possible commands arguments (e.g. popular tags) from past records when the user is short of ideas. The usage of tab for auto-completion also tremendously improves the speed of typing and hence the overall experience of the user.

    • Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it requires live update of input and different methods to process different commands in order to generate suggestions. The prompters mirrors parsers but they function differently. A branch new set of logic is implemented in the prompters and util methods to facilitate smoother suggestions and auto-completion.

    • Credits: LevenshteinDistance in org.apache.commons.text is used in calculating the similarity between strings.

  • Minor enhancement:

    • Refactored commands and parser packages by grouping files into sub-packages according to the type of commands. [#114]

  • Code contributed: [RepoSense Data]

  • Other contributions:

    • Project management:

      • Reviewed meticulously peer’s pull requests with non-trivial comments. [Reviews]

      • Contributed to morphing from AddressBook 3 to Weme (Remove email and phone field in Meme). [#35]

    • Documentation:

      • Update AboutUs, ContactUs and README [#32]

    • Community:

      • Reported bugs and suggestions for other teams [PED]

    • Tools:

      • Added support for Apache Commons. [#71]

Contributions to the User Guide

Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users.

Command Suggestions

Weme supports command suggestions and auto-completion using tab for every command available.

  • Suggestions for command word/argument based on current user input will be displayed in the result box.

  • The auto-suggestion is dynamic and automatically updates while the user type in command.

  • The suggestions are retrieved from historical records and sorted according to the similarity to user input, with the first suggestion being the most recommended one.

  • For the command word suggestion, only commands available for current context will be displayed. Description for each command will be displayed after each command word.

  • User can press Tab key to auto-complete the command suggestion, i.e. replacing current command word/arguments with the first suggestion displayed (if there is any).

  • If the user input is of invalid format, the text will turn red and error messages will be displayed in the result box immediately without pressing Enter key. This does not account for invalid values, e.g. input meme index is 5 but there is no meme of index 5.

Examples:

  • When user types in a in the meme tab, the following suggestions will appear:
    add: adds a meme to Weme.
    archive: archive a meme by index.
    archives: list all archived memes.

CommandPrompt1

After pressing Tab, a in the command box will be replaced by add.

CommandPrompt2
  • When user types in add p/pathToMeme t/c in the memes tab, the following suggestions will appear:
    CS
    cute
    csgg

CommandPrompt3

After pressing Tab, c in the command box will be replaced by CS.

CommandPrompt4
  • When user types in find doge joker funny cuuuuutie in the memes tab, the following suggestions will appear:
    cute
    CUTECATS
    favorite

CommandPrompt5

After pressing Tab, cuuuuutie in the command box will be replaced by cute.

CommandPrompt6

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.

Command Suggestion Feature

Users can be forgetful about the command format and sometimes unsure of what arguments to supply. Auto-suggestion of command arguments while the user keys in inputs can be very helpful to provide user hints. Possible command words will be suggested to user based on incomplete input. Depending on what the user has typed in for the argument, the most similar argument values retrieved from the historical records will be displayed to the user for reference. The user can also use the "TAB" key to auto complete the command word/argument, where the first prompt will replace the current command word/argument in user input.

Current Implementation

The command suggestion is achieved using a package of prompter files. For each parser, there will a corresponding prompter to process the current user input and return the CommandPrompt for display in ResultBox. The following class diagram summarizes the Prompter package in the Logic.

CommandPromptClassDiagram
Figure 1. Partial Class Diagram of the Logic Component related Prompter package

The following Sequence Diagram summarizes the how a CommandPrompt is generated:

CommandPromptSequenceDiagram

Here is how a user interact with the command suggestion features:

Step 1. The user types commands into the CommandBox.

Step 2. The MainWindow listens to changes in the content in CommandBox and direct the input to WemePrompter.

Step 3. Depending on the context, the prompter that implements WemePrompter (e.g. MemePrompter) will then pass the arguments

to different Prompter (e.g. MemeAddCommandPrompter) based on the command word.

Step 4. The Prompter will process the input and return a CommandPrompt containing the command suggestion, and the

complete text for auto-completion for the given input.

Step 5. The prompt will be passed to and displayed by ResultBox.

Step 6. The CommandBox listens to the "TAB" key press, and replace the current argument with the first command prompt.

The following Activity Diagram summarizes the command suggestion process:

CommandPromptActivityDiagram

Design Considerations

Aspect: How to process the input and produce the command prompt
  • Alternative 1 (current choice): Use a prompter package to abstract out the prompter for each command.

    • Pros: Single Responsibility Principle and Separation of Concerns are achieved and coupling is reduced.

    • Cons: Additional layer of abstraction and longer code.

  • Alternative 2: Add one more method in each parser.

    • Pros: Easier to implement.

    • Cons: The class that processses input will depend on Parser.

Aspect: How to store and access historical records.
  • Alternative 1 (current choice): Use a separate Records storage file to store all the historical arguments.

    • Pros: Better abstraction and the records has the option to persist even if the file is deleted.

    • Cons: More files to store and longer code.

  • Alternative 2: Store arguments of a resource (e.g. Meme) as a field of the resource.

    • Pros: Easier to implement and cleaner.

    • Cons: Irrelevant information needs to be stored as a field (e.g. original file path of a resource).

Suggest / Auto-complete commands

  1. Suggest and auto-complete command words

    1. Prerequisites: Weme is in any tab, for illustration purpose we choose meme tab. Since this is for command suggestions, please do not press enter to execute the command while typing the input.

    2. Test case: a
      Expected:
      add: adds a meme to Weme.
      archive: archive a meme by index.
      archives: list all archived memes.

    3. Test case: a + tab
      Expected text inside command box: add 
      Expected text inside result box:
      add: adds a meme to Weme. Parameters: p/PATH [d/DESCRIPTION] [t/TAG]…​
      Example: add p/C:\Users\username\Downloads\funny_meme.jpg d/Popular Meme among SoC Students t/funny

    4. Test case: arkive
      Expected:
      archive: archive a meme by index.
      archives: list all archived memes.
      like: like a meme by index.

    5. Test case: arkive + tab
      Expected text inside command box: archive 
      Expected text inside result box:
      archive: archive a meme by index. Parameters: INDEX (must be a positive integer) Example: archive 1 

    6. Test case: undo
      Expected:
      undo: undo the previous command.

    7. Test case: unlike 1
      Expected:
      Unknown command
      (The text in the command box will turn red to indicate invalid input)

  2. Suggest command arguments

    1. Prerequisites: Restore the application to initial state by deleting the data folder if it exists. The suggestions may change when new data is added since the recommendation is based on past records. Weme is in any tab, for illustration purpose we choose meme tab. Since this is for command suggestions, please do not press enter to execute the command while typing the input.

    2. Test case: add p/path/to/meme d/
      Expected:
      A meme about a test.
      A meme about Char and charmander.
      A meme about doge.

    3. Test case: add p/path/to/meme d/ + tab
      Expected text inside command box: add p/path/to/meme d/A meme about a test.
      Expected text inside command box:
      A meme about a test.
      A meme about doge.
      A meme about joker.

    4. Test case: edit 1 t/cuuute
      Expected:
      cute
      CUTECATS
      test

    5. Test case: edit 1 t/cuuute + tab
      Expected text inside command box: edit 1 t/cute
      Expected text inside result box:
      cute
      CUTECATS
      cuteAnimals

    6. Test case find c
      Expected:
      CS
      cute
      CS2103

    7. Test case find c + tab
      Expected text inside command box: find CS
      Expected text inside result box:
      CS
      CS2103
      CSLectures

    8. Test case find cute dog
      Expected:
      doge
      GoT
      wow

    9. Test case find cute dog + tab
      Expected text inside command box: find cute doge
      Expected text inside result box:
      doge
      cute
      GoT

    10. Test case add g/
      Expected:
      Invalid command format!
      add: adds a meme to Weme. Parameters: p/PATH [d/DESCRIPTION] [t/TAG]…​
      Example: add p/C:\Users\username\Downloads\funny_meme.jpg d/Popular Meme among SoC Students t/funny

      (The text in the command box will turn red to indicate invalid input)

    11. Test case edit t/
      Expected:
      Invalid command format!
      edit: edits the details of the meme identified by the index number used in the displayed meme list. Existing values will be overwritten by the input values.
      Parameters: INDEX (must be a positive integer) [d/DESCRIPTION] [t/TAG]…​
      Example: edit 1 d/A funny meme t/funny

      (The text in the command box will turn red to indicate invalid input)