PROJECT: JitHub - Schedule Management System

Overview

This portfolio is written to document the software engineering process of CS2113T.

For this software engineering project, I am a developer and code quality control expert, and my responsibilities are to write improvements for the software, and to ensure that the codes are of an excellent standard before allowing major releases of the software.

Our team, CS2113T-W12-1, consists of 5 students, Bao Lin Ruo, Chun Hong Wei, Elston Aw, Lim Jit Wei and Low Jun Wei. We are a team based in the School of Computing, National University of Singapore.

Project Introduction

JitHub is an application that saves your contacts and helps you schedule meetings through cross-checking the timetable of your group mates. It is a CLI (Command Line Interface) application with GUI output so that you can have best of the both worlds. JitHub is a Java application that you can run on any machine with Java Runtime Environment installed.

Summary of contributions

  • Major enhancement: added the ability to suggest smart suggestions and corrections while typing

    • What it does: It gives the users smart suggestions when the users press TAB, to suggest them of the full command name and its relevant syntax.

    • Justification: a user can make mistakes in commands and the app should provide a convenient way to rectify them.

    • Highlights: write technical skills i acquired like new algorithm etc

    • Credits:

      • [GeeksforGeeks] for their explanation on Trie data structure which was heavily used to implement this feature.

  • Minor enhancement: Added a wrong command suggestion when the user types in a wrong command and presses enter.

    • What it does: When a wrong command is being typed and the ENTER key is pressed, the system would find a most similar command available in the AddressBook.

    • Justification: This helps the user understand what went wrong and what command could have been typed instead.

    • Credits:

Through this project, I have learnt good Software Engineering practices, teamwork skills through programming, and proper documentation for projects.

  • Code contributed: [Code]

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.

Getting Smart Suggestions

Receive smart suggestions while typing in your commands. Press the TAB key while typing a command halfway to get suggestions on possible commands without having to navigate to the help window. If only one command is available, pressing TAB will auto-complete the command for you without the need to type it in manually.

This is particularly helpful when you are new to the commands and require time to get used to it. Pressing TAB would show all helpful and useful information needed, and this would definitely benefit you as the learning curve to using our application would not be steep.

Examples:

  • While typing his to get history command, press TAB. The history command will automatically be filled in for you as it is the only suggestion available. The command parameters would then be shown as a prompt to help you with your input.

  • While typing e, press TAB. The system will suggest to you all possible commands that start with e, which would be exportall, export, exit, and edit.

Getting Wrong Command Suggestions

Should you type in a wrong command, fear not, as our system will automatically suggest to you what you have typed wrongly, by giving you a closest approximation of word through the message box after you press enter.

The input is not case sensitive when looking for suggestions, hence it would increase the chance of getting a closer approximation of your desired command!

This is particularly useful when you are typing very quickly, as sometimes you might make minor mistakes which can be easily correctable from our application.

Examples:

  • If you wanted to type select but you typed salect instead, the system will tell you that it is an invalid command, and would suggest to you the command select instead.

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.

Suggestions Feature

The suggestions feature gives users helpful suggestions on what command to type, and corrections for commands when incorrect commands are being entered.

Current Implementation

There are two instances when suggestions are given.

Firstly, when a user completes entering a command (after pressing ENTER key), if the command typed is invalid, such as commands being misspelt, the system will suggest a similar command based on the edit distance (which will be explained later).

The second instance would be when the user presses tab while typing the command halfway. The system will suggest commands based on the current prefix string. If only a single command is available, the command would be completed for the user, and the system would show the parameters required for that command.

Wrong Command Suggestion

Given below is an example usage of how the WrongCommandSuggestion behaves at each step.

Step 1: The user would type in a misspelt command string into the Command Box pane.

Step 2: The command would be parsed into the AddressBookParser class. Since no commands match the word exactly, it would fall into the default case.

Step 3: The default case would extract out only the command portion of the user input, and input it into the WrongCommandSuggestion class.

Step 4: WrongCommandSuggestion would then instantiate the StringSimilarity class to find the nearest match of a word.

Step 5: editDistance in StringSimliarity class would be called to find out the edit distance between two words. These two words would be the wrong command the user has input, and the list of available commands in the whole application.

Step 6: WrongCommandSuggestion would then compare if the edit distance of the current command is shorter than the current shortest edit distance command (which is initialised to 5 edits). If it is shorter, it would then suggest the current command.

Step 7: WrongCommandSuggestion would then return the suggestion in a string, which would then be inputted into the CommandException, to be thrown to the LogicManager class.

The following sequence diagram shows an example of how the WrongCommandSuggestion operation works with misspelt command "histary" (closest command is history):

WrongCommandSuggestionSequenceDiagram
Input Command Suggestion

Given below is an example of how the InputCommandSuggestion behaves at each step.

Step 1: Upon instantiation of CommandBox during the program instantiation phase, CommandBox will create an instance of InputCommandSuggestion, which will create a Trie containing all the commands available in the application.

Step 2: When the user presses TAB after entering a command, CommandBox will call method handleTabPressed() to fetch the current input that the user has typed.

Step 3: handleTabPressed() method will then call the getSuggestedCommands() method in InputCommandSuggestion, while inputting the user’s input into the parameters.

Step 4: The InputCommandSuggestion would then find available commands using the Trie class and determine whether there are any other possible combinations of commands with the current string of words.

Step 5: The Trie class would then return a list of commands available, which would then pass back to CommandBox.

Step 6a: If there is only one command available, CommandBox would auto-complete the current input with the valid command, then request for the Command Parameters through the InputCommandSuggestion class. It would then pass the string to be posted on EventsCenter, so that the Command Parameters would be displayed on the results panel.

Step 6b: If there are multiple commands available, CommandBox will pass all the possible commands to EventsCenter, to output all possible commands available with the current string.

The following sequence diagram shows an example of how the InputCommandSuggestion class works:

InputCommandSuggestionSequenceDiagram

Design Considerations

For the WrongCommandSuggestion implementation, there were multiple design considerations while implementing the feature.

  • Alternative 1: Compare the input command and the actual command character by character and see which command has the most matches.

    • Pros: Easy to implement.

    • Cons: Not as accurate or reliable in terms of giving a correct match of command.

  • Alternative 2 (current choice): Use a string matching algorithm to implement the matching and difference calculation between the command and the user input.

    • Pros: Accurate prediction or suggestions from actual commands.

    • Cons: Difficult to implement, and might require more processing overhead.

For the InputCommandSuggestion implementation, there were multiple design considerations while implementing the feature.

  • Alternative 1: While the user types, command suggestions would be given continuously with regards to the user’s input.

    • Pros: Makes it more convenient for typing in commands as there is immediate response of the correctness of the command.

    • Cons: May have performance issues in terms of memory usage, complicated to implement, and requires a lot of work on the UI for the application.

  • Alternative 2 (current choice): When the user requires corrections to the command or requires feedback, press TAB key to receive suggestions given by the system.

    • Pros: Less overhead to the system as the system does not have to constantly run the algorithm to check for valid and available commands.

    • Cons: Feedback is less responsive, and requires additional keys for users to press.

Use case: Get Suggestions

MSS

  1. User types a command and presses TAB to get suggestions.

  2. Jithub shows a list of possible commands.

  3. User continues typing the command to completion and presses TAB.

  4. Jithub shows the parameters required for the command.

    Use case ends.

Extensions

  • 2a. There are no commands available to suggest.

    Use case resumes at step 1.

  • 2b. There is only one command available to suggest.

    • 2b1. JitHub completes the command input and shows the parameters required.

      Use case ends.

  • 3a. The given index is invalid.

    • 3a1. AddressBook shows an error message.

      Use case resumes at step 2.

Getting an Wrong Command Suggestion

  1. Getting a nearest command suggestion after entering the keyed input.

    1. Test case: delet followed by ENTER key
      Expected: Result bar would show that the current input is an unknown command. It would then suggest command delete in the next line.
      Expected: Result bar might show multiple commands to suggest if available.

    2. Other suggestions to try: schedulee, expart, etc
      Expected: Similar to previous.

Getting an Input Command Suggestion

  1. Getting a command suggestion while typing the desired command.

    1. Test case: a followed by TAB key
      Expected: Command bar would complete the only command starting with a available, which is add. It would then show the parameters of add command. in the results bar.
      Expected: Result bar might show multiple commands if available, and not complete the command when so.

    2. Other suggestions to try: ex, s, etc
      Expected: Similar to previous.