PROJECT: Book Inventory


Overview

This Project Portfolio summarises my overall contributions to BookInventory. It is a multi-platform desktop application catered primarily for store owners to manage their book supplies - adding, deleting, requesting of books, etc.. Users interact with BookInventory using Command Line Interface (CLI), and has a Graphic User Interface (GUI) created with JavaFX. This application was developed by a team of four students over a semester with the original source code adapted from the Address Book (Level 4) project by SE-EDU.

Summary of contributions

This section records my contributions for BookInventory.

  • Major enhancement: added the ability to conveniently stock, sell and delete books from the inventory

    • What it does: to execute stock/sell/delete commands, one can select a book’s unique ISBN using a shortcut that can scan through all available ISBN - Tab .

    • Justification: As sales are performed daily, commands should be executed conveniently.

    • Highlights: This enhancement not only affects existing commands, but also future commands.

  • Minor enhancement: added the ability to display a list of books less than or equal to a given quantity using the check command.

  • Code contributed: [Functional/Test code]

  • Other contributions:

    • Project management:

      • Managed releases v1.1 - v1.4 (5 releases) on GitHub.

    • Additional enhancement to existing features:

      • Added a new cost field to the add command.

      • Enhanced delete command to allow delete by Isbn.

    • Documentation:

      • Updated the initial User Guide to be a representation of BookInventory.

    • Community:

      • Reported bugs and suggestions for other teams in the class (examples: 1, 2, 3, 4)

Contributions to the User Guide

This part shows the sections that I contributed to the User Guide. My ability to write documentation targeting end-users are showcased here.

Check Inventory: check

Finds books with quantity less than or equal to the given input value. List of books displayed in ascending order based on quantity left
Format: check QUANTITY

  • QUANTITY only accepts input between 0 and 999, inclusive

Example:

  • check 4
    Displays list of all books with quantity less than or equal to 4.

Decrease Quantity of Book (Number of Books Sold) : sell

Decrease the quantity of an existing book in the inventory list.
Format: sell INDEX q/QUANTITY OR sell i/ISBN13 q/QUANTITY

  • Decrease the quantity at the specified INDEX. The index refers to the index number shown in the displayed inventory list. The index must be a positive integer 1, 2, 3, …​

  • Decrease the quantity of the book with the respective ISBN. ISBN is unique to each book

  • Existing quantity will decrease by the input value.

Examples:

  • list
    sell 1 q/5
    Decrease the quantity available of the 1st book by 5.

  • sell i/978-2-12-345680-3 q/4
    Decrease the quantity available for the book with the corresponding ISBN13 by 4.

Cycling through existing Isbn: Tab

You can auto-fill the Isbn field with existing ones in the Inventory to save the hassle of having to type the entire Isbn of a book.
Format: Tab

Examples:

  • sell i/
    Tab (completes the Isbn field for sell i/ with the Isbn of the first book in the inventory)
    E.g. sell i/9782123456803

  • sell i/978
    Tab (completes the Isbn field for sell i/978 with the first Isbn of a book that contains 978 in the inventory)
    E.g. sell i/9782123456803

  • sell i/777
    Tab (does not complete the Isbn field as inventory does not contains books with Isbn starting with 777)
    E.g. sell i/777

Contributions to the Developer Guide

This part shows the sections that I contributed to the Developer Guide. My ability to write technical documentation and the technical depth of my contributions are showcased here.

Check feature

One of the important features for BookInventory is for users, especially store owners, to be able to check the remaining stocks of the books in the inventory. To do so, we have added a check command to the existing list of commands.

Current Implementation

The implementation of this command utilises both Model and Logic component to fulfil its function.

The following sequence diagram shows how the check command operation is implemented:

CheckSequenceDiagram
Figure 1. Sequence Diagram for Check Command

Design Considerations

Aspect: How check executes
  • Alternative 1 (current choice): Sorts the entire BookInventory.

    • Pros: Easy to implement.

    • Cons: Unable to retrieve the original order of the BookInventory.

  • Alternative 2: Only the displayed list is sorted.

    • Pros: Original order of the BookInventory is kept.

    • Cons: Changes in the original code to display the list is required.

Sell feature

Since selling of books is the bread and butter of the store owners, we have added a sell command to the existing list of commands.

Current Implementation

The sell command utilises both the Model and Logic component to fulfil its function.

The following sequence diagrams show how the sell operation is implemented:

SellSequenceDiagram
Figure 2. Sequence Diagram for Sell Command
SellSequenceDiagramSd
Figure 3. Sequence Diagram Reference for Sell Command

Design Considerations

Aspect: How sell command is implemented
  • Alternative 1 (current choice): Determines if user input Isbn or Index in SellCommandParser.

    • Pros: Increases the cohesion of the SellCommand.

    • Cons: Construction of commands that accepts Isbn or Index differs from the other commands. Thus, we must ensure that the implementation of each individual command are correct.

  • Alternative 2: Determines if user input Isbn or Index in SellCommand.

    • Pros: Does not require changes to the code for construction of SellCommand.

    • Cons: Decreases the cohesion of SellCommand.

Tab feature

For users' convenience, we have implemented this feature to easily cycle through existing ISBN in the inventory without the need to manually type them out.

Current Implementation

The tab mechanism utilises Ui, Model and Logic components. It stores the list of Isbn in a Queue Data Structure.

Given below is an example usage scenario and how the tab mechanism works

Step 1: The user enters sell i/978 in the CommandBox to sell a book with the Isbn starting with '978'.

Step 2: The user now feels that keying the whole 13 digit of the Isbn is a hassle, and decides to complete the Isbn using pressing tab. The tab feature will take in sell i/978 in the CommandBox and retrieve 978 from the Isbn field.

The following sequence diagram shows how the tab operation works:

TabSequenceDiagram
Figure 4. Sequence Diagram for Tab Operation

After the function navigateToNextIsbn() is completed, commandTextField.requestFocus() and commandTextField.positionCaret(commandTextField.getLength()) are called to bring the caret to the end of the line for users to continue typing the command.

Step 3: The user presses tab again as the Isbn is not correct. The tab feature will then check if the Isbn matches the first Isbn in the Queue. If it matches, the first Isbn in the Queue will be removed and added to the end of the Queue. The next Isbn in the Queue will be displayed.

Design Considerations

Aspect: How tab executes
  • Alternative 1 (current choice): Accessing data in BookInventory using Logic.

    • Pros: Does not change current imports of CommandBox for it to function.

    • Cons: Increases coupling as it violates the Law of Demeter.

  • Alternative 2: Accessing data in BookInventory directly in CommandBox.

    • Pros: Easy to access.

    • Cons: Increases coupling as CommandBox now imports both Logic and Model.