1. PROJECT: SaveIt


2. Overview

This document is written for summarizing my contributions in the project SaveIt.

SaveIt is geared at keeping track of the issues and solutions that the user finds online. It is designed for programmers who are used to Command Line Interface​ (CLI) applications and are good at typing while still having the benefits of a Graphical User Interface (GUI).

SaveIt​ is implemented for applying CS2103 learning outcomes and showing understanding of the software design. It is implemented by a group of CS2103 students, including myself. My key contribution is sort command and User Interface (UI) related with this function.

SaveIt is written in Java and JavaFX and is morphed from AddressBook-level4, the application used for teaching Software Engineering principles.

3. Summary of contributions

  • Major enhancement: Add the ability to sort issue list and UI of the sort type

    • What it does: It allows the user to sort issues shown in the list.

    • Justification: This feature improves the product significantly because it helps the user to view the issues in the order that they want so that they can organize the record of issues better. That can help users to search and learn more efficiently.

    • Highlights: This command changes the way how issues are listed in the application. It needs efforts to combine sorting and filtering together properly and make sure the correct issue can be retrieved from the sorted list. Backend structure also needs to be changed for comparing the issues in different order.

  • Minor enhancement:

    • Add the ability to set and reset the primary solution. #177

    • Add confirmation check for danger command (i.e. clear command for current version). #116

    • Improve Solution structure. #180

  • Code contributed: [Functional code]

  • Other contributions:

    • Project management:

      • Manage milestones and checked issue status on GitHub

    • Enhancements to existing features:

      • Update tests to fit mid-v1.2 features: #52

    • Documentation:

      • Update About Us Page: #2

    • Community:

      • PRs reviewed (with non-trivial review comments): #168, #169, #178,

      • Report bugs and suggestions for other team members in the group: 111, 115, 203, 237

4. 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.

4.1. Sorting the list of issues: (sr)sort

Sorts the list of issues according to a specified sort type.

The list always follows the specified sort type until another sort command is executed.

Format: sort

  • Sorts the issues based on the time when they are created. The first issue created has the highest priority.

Format: sort chro

  • Sorts the issues by their last modified time chronologically. The last modified one has the highest priority.

  • Creation is considered as a modification, i.e. last modified time is set to the created time when an issue is added.

Format: sort freq

  • Sorts the issues by their search frequency. The one which matches the search keywords most frequently has the highest priority.

Format: sort tag

  • Sorts the issues by each issue’s tag set in a lexicographical order, following ASCII lexicography.

  • Puts the issues without tags at the end of the displayed issue list.

  • This command can only be executed in the home directory.

Examples:

  • sort

  • edit 1 d/First edited issue (edit to update last modified time)
    edit 4 d/Second edited issue
    add i/Third created issue d/Third created issue (add a new issue)
    sort chro

sort chro command
Figure 1. Sort Chro Command
  • find ArrayIndexOutOfBounds (find to update search frequency)
    list
    find ClassNotFoundException
    find ClassNotFoundException
    list
    sort freq

sort freq command
Figure 2. Sort Freq Command
  • sort tag

sort tag command
Figure 3. Sort Tag Command

4.2. Clearing all entries : (c)clear

Clears all issues and their solutions from SaveIt.

Format: clear

Example:

  • clear

clear command ask for confirmation
Figure 4. Clear Command - Ask for confirmation
  • Yes or Y (confirm the clear decision)

clear command confirmed
Figure 5. Clear Command - Confirmed
  • The user needs to confirm this command before the operation can be executed.

  • The user can undo this operation to restore the issue lists.

4.3. Choosing one primary solution: (sp)setprimary

Chooses one solution of the issue and make it the primary solution.

If there is an existing primary solution, setprimary will reset the primary solution to the latest one.

The primary solution is shown on the top of the solution list and is highlighted in white.

Format: setprimary INDEX

  • The index refers to the index number on the solution list.

  • The index must be a positive integer 1, 2, 3, …​

  • The index cannot be larger than the number of solutions of this issue.

  • This command can only be executed in the issue or solution directory.

4.4. Resetting the primary solution: (rp)resetprimary

Resets the primary solution and make all solutions normal and not highlighted.

Even if there is no primary solution, this command can still be executed, but no change will be shown.

Format: resetprimary

  • This command can only be executed in the issue or solution directory.

5. 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.

5.1. Sort feature

The sort command can sort an issue list shown in the GUI.

5.1.1. Current implementation

We use JavaFX SortedList and the Comparator provided by SortType to sort the list.

In order to allow sorting to work with the filtered list, we wrap FilteredList with SortedList and retrieve this new list with a new method getFilteredAndSortedList().

The following sequence diagram illustrates how the mechanism works:

SortCommandSequenceDiagram
Figure 6. Sort Command Sequence Diagram

This diagram shows that after the input is parsed, a SortType object is initialized before the SortCommand object.

As shown in the diagram, a SortType object can provide the required comparator and we use the retrieved Comparator to sort the list when the sort command is executed.

The following is a class diagram for SortType.

SortType
Figure 7. SortType Class Diagram

It shows that Comparator is an attribute of SortType class. We create three different classes that implement the Comparator Interface. They can serve the three sort types (excluding the default one) we provide in SaveIt. When more sort types are needed, we can simply create another class implementing Comparator, and add another case in the switch statement.

5.1.2. Design Considerations

Aspect: How sort executes
  • Alternative 1 (current choice): Combine SortedList and FilteredList, sort at GUI side

    • Pros: Consistent sorting. Doesn’t affect the memory of issue lists.

    • Cons: Need efforts to make sure the correct list is retrieved.

  • Alternative 2: Reconstruct UniqueIssueList directly, sort in Storage

    • Pros: Easy to understand and implement.

    • Cons: Break the persistence of the backend list.

5.2. Confirmation Check

Some commands that can affect the users' experience significantly need to be paid attention to and confirmation should be provided before they are executed. For the current version, clear is the only command that needs confirmation.

5.2.1. Current Implementation

ClearCommand
Figure 8. Clear Command Activity Diagram

As shown in the diagram, instead of letting Logic execute the command directly after parsing it, we now check if we need confirmation before the command is executed.

In order to connect the confirmation with the command:

Step 1. We buffer the command that requires confirmation.

Step 2. Wait for the user to input confirmation message.

Step 3. Clear the buffer.

Step 4. Generate the CommandResult according to the confirmation message entered.

5.2.2. Design Consideration

Aspect: How to distinguish commands that need confirmation
  • Alternative 1 (current choice): Use abstract class DangerCommand

    • Pros: Protect the specific Command type from being accessed by LogicManager. Sustainable.

    • Cons: N.A.

  • Alternative 2: Check class name and provide a danger class name list

    • Pros: Easy to implement.

    • Cons: Command information leaked. Inaccurate, e.g. two classes from different packages can have the same class name.

Aspect: How to connect the confirmation message with the command requiring it
  • Alternative 1 (current choice): Buffer the command

    • Pros: Protect CommandBox from being accessed by Command, i.e. retrieve the input message in Command Class

    • Cons: Another variable introduced. Need efforts to deal with the buffered command properly.

  • Alternative 2: Let Command check the confirmation message

    • Pros: Follow the normal logic. Easy to understand.

    • Cons: CommandBox is exposed to Command Class.

5.3. Set Primary Feature

The set primary feature allows users to choose one solution as primary.

5.3.1. Current Implementation

The set primary solution mechanism is facilitated by the method isPrimarySolution(), which is overrode by PrimarySolution inheriting from Solution.

5.3.2. Design Consideration

Aspect: How to distinguish between PrimarySolution and Solution
  • Alternative 1 (current choice): Use PrimarySolution as a subclass of Solution

    • Pros: No flag attribute is introduced. More sustainable.

    • Cons: New object is created. May affect performance.

  • Alternative 2: Add a flag attribute to Solution

    • Pros: Easy to understand and implement.

    • Cons: Solution constructor is affected. The flag attribute is redundant for non-primary solutions.

  • Alternative 3: Store the primary solution index in the solution list.

    • Pros: No new constructor and attribute are introduced.

    • Cons: Need to check if the index is affected every time when the solution list is updated.

5.4. Reset Primary Feature

The reset primary feature allows users to reset the primary solution and make all solutions normal and not highlighted.

5.4.1. Current Implementation

The reset primary solution mechanism goes through the solution list once and checks if a solution is primary or not. If it is primary, we replace it with a new Solution object with the same data of the primary solution. If it is not primary, we continue checking until we reach the end of the list.