PROJECT: ConciergeFinal


Overview

Concierge™ is a desktop hotel management application for receptionists to handle potential bookings and current guests. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC.

Summary of contributions

  • Code contributed: [Code Contributed]

  • Major enhancements:

    • Implemented Autocomplete Feature

      • What it does: Ihe Autocomplete feature allows the user to seamlessly type in user commands with the autocompletion of an incomplete command that is input by the user. This feature helps the user by prompting the correct format.

      • Justification: This feature is not mandatory to have, however it would save the user a lot of time, especially if he/she is dealing with many different commands (in our case, many guests waiting to check in at the same time).

      • Highlights: It also eliminates the need for the user to remember all the prefixes because my implementation not only fills in the command, but fills in subsequent prefixes for the user as well which makes the feature more effective and efficient.

      • Credits: [Idea] Got the idea of implementing the autocomplete feature replete with prefixes and the various parameters pre-filled in from the link given. However, I decided to implement it with a Control button press so as to minimise the user having to navigate back and forth in the Command Box and it will also make for quicker typing once the user gets a flow of the autocomplete feature.

  • Minor enhancements:

    • Implemented Command Archive feature (Shifted to v2.0)

      • What it does: This feature keeps an archive of all the commands (both valid and invalid) input by a user and adds a time stamp plus user tag. This is different from the history command because this information will be exported into a txt/xml file instead of being destroyed at the end of the session as is seen in AB4

      • Justification: This feature is not mandatory, however it would serve an important purpose to hotel managers or the person-in-charge. This feature is aimed at tracking and identifying any suspicious activity and also to serve as data that could either be used in the future for monthly audits and even possibly generating statistics as to what items/facilities are patronised most by the guests.

  • Other contributions:

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.

Autocomplete: Ctrl, Alt

Auto-completes a partially typed in command by a user.

Function Press Alt to quick-clear the CommandBox (saves time for user when he wants to clear the box).

The command box before Alt is pressed:

servicepreclear

The command box aft Alt is pressed:

servicepostclear

Format: Enter COMMAND_WORD, followed by Ctrl key.

Function: Press Ctrl key again to proceed to the next prefix.

Example:
Step 1: User enters a in CommandBox.

add

Step 2: After Ctrl has been pressed, it automatically inserts the command and the first parameter PREFIX_NAME in the command line.

addPREFIX NAME

Step 3: After filling up the name field, e.g. with Anthony, then press Space. Finally, to insert the next parameter PREFIX_PHONE press Ctrl.

afteranthonyspace

Step 4: Repeat Step 3 until all the parameters are input, then press Enter to execute the command.

fulladdautocomplete

Note(s):

  • For finishing entering a prefix field e.g. 'n/John Doe', user has to insert Space on his/her own before pressing Ctrl again, to autocomplete the next prefix.

  • For commands such as checkin and checkout, user has to specify up till at least checki or checko because the application is unable to distinguish from the two commands without sufficient information. The subsequent prefixes will follow suit accordingly.

    • archive - Opens the log where all user input is captured and saved. All keystrokes are captured, including invalid/mistyped and login commands.

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.

Autocomplete: Ctrl, Alt

Overview

The Autocomplete feature allows the user to seamlessly type in the full command and prefixes without having to worry if he/she missed out on any prefix. This feature helps the user by prompting the correct format. This is useful as some of the commands require several inputs from the user and hence this will save time and commands can be executed faster.

A quick-clear has also been added as part of this feature, so that the user can again, save time.Press Alt to quick-clear the CommandBox (saves time for user when he wants to clear the box).

The command box before Alt is pressed:

servicepreclear

The command box aft Alt is pressed:

servicepostclear

Example of how feature works

Step 1: Launch application

Step 2: User enters a in CommandBox then presses Ctrl. AutoCompleteManager() compares input through the list of initCommandKeyWords`and proceeds to display the command in the `CommandBox because a is an applicable COMMAND_WORD.

add

After Ctrl has been pressed, it automatically inserts the first prefix PREFIX_NAME in the command line.

addPREFIX NAME

Step 3: After the user fills up the PREFIX_NAME field, he can press Space to move on to the next prefix. After pressing Space, then he can press Ctrl. At this point, AutoCompleteManager() is called again but this time instead of calling the getAutoCompleteCommands() it calls getAutoCompleteNextMissingParameter since it will detect the presence of the PREFIX_NAME parameter.

This is the expected outcome before pressing Ctrl

anthonyspace

This is the expected outcome after pressing Ctrl

afteranthonyspace

Step 4: The user repeats Step 3 until all parameters are input by the user and then presses Enter to execute the command. Note: For AddCommand, the final parameter PREFIX_TAG is optional, so the user can just delete it if he chooses not to add a tag.

This is the expected outcome after all the parameters are filled.

fulladdautocomplete

Press Enter to execute the command.

Given below is the activity diagram for the Autocomplete feature.

Activity Diagram :

AutocompleteActivityDiagram

Activity Diagram demonstrates what happens when user presses Ctrl

Current Implementation

The Autocomplete mechanism is facilitated by AutoCompleteManager, which can be found in LogicManager. It supports the auto completion of incomplete commands by providing a list of auto completed commands from a given incomplete command.

An underlying Trie data structure is used to facilitate the AutocompleteManager. Trie only supports autocompletion of commands that are provided by the AutocompleteManager. The CommandParameterSyntaxHandler that is found in AutocompleteManager supports the autocompletion of parameters for commands.

Given below is the class diagram for the Autocomplete feature.

Autocomplete Class Diagram :

AutocompleteClassDiagram

The CommandBox interacts with the AutocompleteManager using LogicManager. When the user presses Ctrl in the command box, the CommandBox will handle the Ctrl key press event and will execute the AutoCompleteUserInput() method.

Given below is the sequence diagram for the Autocomplete feature.

Autocomplete Sequence Diagram :

AutocompleteSequenceDiagram

Design Considerations

Aspect: Implementation of Autocomplete
  • Alternative 1 (current choice): Use a manager (AutoCompleteManager) to handle the autocomplete helper methods.

    • Pros: Allows for better usability and more code abstraction.

    • Cons: The amount of time taken for a new developer to to understand all the interaction between methods will be longer.

  • Alternative 2: Iterate through all possible commands to find match prefix.

    • Pros: Implementation of this alternative would be easier.

    • Cons: If there are too many commands being input consecutively, the application might start to lag due to possible loss of performance.

Aspect: Implementation of Algorithm
  • Alternative 1 (current choice): Trie Data Structure

    • Pros: Performance of application will be better.

    • Cons: The complexity of implementation is higher.

  • Alternative 2: Iterate through all possible commands to find match prefix.

    • Pros: Implementation of this alternative would be easier.

    • Cons: If there are too many commands being input consecutively, the application might start to lag due to possible loss of performance.

[Proposed] Command Archive feature

Given below is the UML diagram for the CommandArchive Class:

CommandArchive class

Given below is the UML diagram for the CommandHistory Class:

CommandHistory class

Current Implementation

The Command Archive mechanism is facilitated by CommandArchive. It utilises the userInputHistory to extract the latest command that the user has input and passes the inputString`to `stringToFile method in CommandArchive class. The inputString is then appended to the CommandFile.txt file. Additionally, it implements the following operations:

  • StringBuilder() — The main operations of the StringBuilder are the append and insert methods which can be overloaded to accept data of any type. The append method always adds these characters at the end of the builder.This operation can be found in CommandHistory.

  • toString() — Converts the StringBuilder object into a string named inputString so it can be passed to the CommandArchive class. This operation can be found in CommandHistory.* getLogger() — Creates LOGGER so that it can log any IOExceptions that are caught in the catch blocks of the methods found in stringToFile method of CommandArchive.

  • substring() — Extracts the latest command from the userInputHistory. This is required because the userInputHistory appends all the older commands into the LinkedList as well. This is done by looking for the first newLine character occurrence of the inputString. The substring is then extracted as latestUserCommand. This operation can be found in CommandArchive.

  • simpleDateFormat() — Creates a timeStamp in DD/MM/YYY format that can later be appended to latestUserCommand. This operation can be found in CommandArchive.

  • fileWriter — Writes the stream of characters (which is latestUserCommand) to commandHistory file. This will eventually be the output that is written into commandFile.txt via PrintWriter. The PrintWriter also appends timeStamp to the latest entry (which is eventually timeStamp + latestUserCommand). This operation can be found in CommandArchive`.

    This command requires a login.

Design Considerations

Aspect: How to extract userInputHistory
  • Alternative 1 (current choice): userInputHistory is first put into a stringBuilder and then converted to string to then pass to CommandArchive.

    • Pros:

      1. Easy to implement because StringBuilder can utilise append and insert methods, which can be overloaded to accept any data.

      2. Faster than StringBuffer under most implementations.

      3. StringBuilder is mutable while String is immutable.

    • Cons: String is more optimised especially if you don’t need the extra features of StringBuilder

  • Alternative 2: Create a KeyLogger class that implements KeyListener to capture userInput.

    • Pros: It is more secure and can only be accessed for audits and other administrative access purposes and is hidden from the user.

    • Cons:

      1. If implemented wrongly, it will become a global KeyLogger that captures userInput outside of application.

      2. Does not utilise the existing infrastructure and data found in the base level program class CommandHistory and hence would require more effort to implement.