This portfolio aims to highlight Lin Yuting’s contributions to project 'LiBerry'.

LiBerry

Overview

With the motivation to raise literacy rate in the world and encourage more setups of community libraries, my team has developed Liberry - a desktop software for managing community and private libraries. The target users are mainly librarians looking to set up or are already running private or community libraries, especially those in under-developed communities who cannot afford commercial versions of such software.

LiBerry can execute the basic functions of library management:

  • Addition and deletion of books in the catalog

  • Registering Borrowers and editing their particulars

  • Loan, return, renew and pay fine functions

  • Searching through books in the catalog by filters

As part of the requirements of the project, we were given the source code for a common AddressBook application and were tasked to morph it to something else that is useful. We were also limited to designing software that takes in the majority of user input through a Command Line Interface (CLI), though displays information through a Graphical User Interface (GUI).

My role was to:

  1. configure the basic AddressBook software to create a Borrower class and its related classes.

  2. implement borrower-related commands such as the Register Command, Serve Command, Done Command,
    EditBorrowerCommand and UnregisterCommand

Summary of Contributions

added features related to the registering, unregistering and serving borrowers in our library management app, LiBerry.

What it does

allow our users, librarians, to register a borrower, serve a borrower, edit a borrwer and be able to unregister a borrower from the library system.

Justification

These features are some of the core features to the library system

Highlights

The implementation was challenging as these features are widely used in other parts of the application. It requires careful implementation and consideration for many different cases.

Minor enhancement:

  • added a Borrower ID generator that auto generates a borrower’s ID.

Other contributions:

Project management

  • Managed the release of v1.2 on GitHub. In v1.2, we have the following features:

    • Set default user settings

    • Exit the application

    • Register a borrower into the library System

    • Setting the application to serving mode

    • Exiting the serving mode

    • Loaning a book

    • Returning a book

    • Deleting a book

Enhancements to existing features:

  • Wrote additional tests for existing features to increase coverage (Pull requests #105, #171)

Documentation:

Community:

  • PRs reviewed (with non-trivial review comments): #12, #32, #19, #42

  • Reported bugs and suggestions for other teams in the class.

  • Contributed to forum discussions as a group (Shared a tip on how to check code coverage when running tests)

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.

Borrower Feature

Registering a new borrower: register

Registers a new borrower to the library records. A unique ID associated with the borrower will automatically be generated and displayed. Borrowers are expected to know his ID in order for loans to be processed.

Format: register n/NAME p/PHONE_NUMBER e/EMAIL

Example:

  • register n/matt p/83938249 e/matt@damon.com
    Registers a new borrower called "matt", with phone number "83938249" and email "matt@damon.com" to LiBerry.

Unregistering a borrower: unregister

Unregisters and removes a borrower with the given borrower ID from the library records.

Format: unregister id/BORROWER_ID

Example:

  • unregister id/K0001
    Deletes the borrower with the borrower ID id/K0001

Entering Serve Mode: serve

Enters Serve Mode. All commands/actions will be done on this specific borrower. A list of the borrower’s currently loaned books and their serial numbers will be displayed.
Borrower ID is used as the borrower will produce their library card which contains their ID to the librarian to be served.

Format: serve id/BORROWER_ID

Example:

  • serve id/K0001
    Enters save mode to serve a borrower with the ID K0001


Using Serve Mode

The Serve Mode is for librarians to serve borrowers. All commands in Serve Mode are done on a specific borrower currently served by the librarian. All commands in Normal Mode, except for serve and exit, can be used in Serve Mode too. The command unregister cannot be used on the currently serving borrower.

Exiting Serve Mode: done

Exits Serve Mode.

Format: done

After loaning all books, upon the done command, a printable loan slip in pdf format will be generated. The loan slip will be opened in your computer’s pdf viewer and also saved in the loan_slips folder. The figure below shows an example of how a loan slip might look like.

LoanSlip
Figure 1. Printable loan slip generated.

In the figure above, we can see that the loan slip records all the books borrowed by 'Bill'.

Editing a borrower: edit

Edit borrower’s particulars.

Format: edit { [n/NAME] [p/PHONE_NUMBER] [e/email] }

  • Edits the currently serving borrower’s particulars.

  • At least one of the optional fields must be provided.

  • Existing values will be updated to the input values.

Examples:

  • edit p/91234567 e/jane@austen.com
    Edits the phone number and borrower’s email address to be 91234567 and jane@austen.com respectively.

  • edit n/Betsy Crower
    Edits the name of the borrower to be Betsy Crower.

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.

Register borrower feature

Details of Implementation

The register borrower feature is facilitated by BorrowerRecords. The BorrowerRecords stores a list of borrowers, representing the borrowers registered into the library system. The command to register a borrower into the library system is as followed:

register n/NAME p/PHONE_NUMBER e/EMAIL

Given below is an activity diagram of a borrower being registered into the Borrower Records of the library.

RegisterBorrowerActivityDiagram
Figure 2. Activity Diagram for registering a borrower

 

Given below is a class diagram of a book.

BorrowerClassDiagram
Figure 3. Class Diagram for Borrower

 

Given below is the object diagram of a newly registered borrower.

BorrowerObjectDiagram
Figure 4. Object Diagram for Borrower

 

Design Considerations

Aspect: Purpose of generating a borrower ID

Borrowers are issued with physical card by the library which they present to the librarian to borrower books. The library card includes the borrower’s ID which librarian will use to serve the borrowers.

Aspect: Generating a unique borrower ID

Every time a new borrower is being registered, the system will automatically generate a borrower ID for the borrower which the borrower will have to use every time the borrower borrows books from the library. Initially, what we proposed is that, every time a new borrower is being registered into the system, we find the size of the list of borrowers, we add 1 and set it as the borrower ID of the new borrower.

Eg: There are 100 borrowers in the system. The new borrower’s ID will be "K0101".

However, we decided to implement a new function, which is to allow borrowers to be removed from the library system. Therefore, this method does not work anymore.

So we proposed the following alternatives.

  • Alternative 1: Use a TreeMap to store current Borrower ID

    • Pros: Will be efficient in generating the next valid borrower ID.

    • Cons: Will incur additional memory to maintain the TreeMap. Might also result in unexpected behaviour in some edge cases.

  • Alternative 2 (Current choice): Iterate from the beginning to obtain the first unused Borrower ID.

    • Pros: Will be easy to implement.

    • Cons: Will be inefficient once the number of borrowers grow.

We have decided to go with Alternative 2 and keep it simple to get in line with the KISS (Keep it Simple, Stupid) principle of programming. Also, we are expecting the number of borrowers to be relatively small (less than 10000) since our target users are small community library. Therefore the inefficiency will not be significant.

Use cases written for developer guide

Use case: Register a borrower

MSS

  1. User registers a borrower by specifying its details

  2. LiBerry shows a success message

Use case ends.

Extension

  • 1a. The arguments provided are invalid.

    • 1a1. LiBerry shows an error message.

      Use case ends.

  • 1b. Phone/Email was registered under another borrower

    • 1b1. LiBerry shows an error message.

      Use case ends.

Use case: Unregister a borrower

MSS

  1. User enters unregister command for borrower by borrower ID

  2. LiBerry unregisters the borrower

    Use case ends.

Extensions

  • 1a. App is in serve mode

    • 1a1. LiBerry shows an error message.

      Use case ends.

  • 1b. Borrower ID is invalid/ not found

    • 1b1. LiBerry shows an error message.

      Use case ends.

Use case: Serve a borrower

MSS

  1. User provides user with a borrower ID

  2. User enters serve command for borrower by borrower ID

  3. App serves borrower

Extensions

  • 2a. App is in serve mode

    • 2a1. LiBerry shows an error message.

      Use case ends.

  • 2b. Borrower ID is invalid/ not found

    • 2b1. LiBerry shows an error message. Use case ends.

Manual testing

Serving a borrower

  1. Serving a registered borrower while not in Serve mode.

    1. Prerequisites: LiBerry is in not Serve mode, Borrower ID is valid

    2. Test case: serve id/VALID_BORROWER_ID
      Expected: LiBerry enters Serve Mode. Borrower panel is shown.

    3. Using the original sample data when you first load up LiBerry without any changes made, you can enter the following test case: serve id/K0001.

    4. Other incorrect loan commands to try: serve, serve abc,serve id/INVALID_BORROWER_ID, serve id/BORROWER_ID_THAT_DOES_NOT_EXIST
      Expected: Borrower is not served. Error details shown in the command results display.

  2. Serving a borrower while already in Serve mode.

    1. Prerequisites: LiBerry is in Serve mode, command format is correct and Borrower ID is valid.

    2. Test case: serve id/VALID_BORROWER_ID
      Expected: Borrower is not served. An error prompting to exit Serve mode is shown.

  3. Using serve command with an invalid borrower ID. An invalid borrower ID is one which does not have 4 digits following a capital 'K' character.

    1. Prerequisites: Command format is correct.

    2. Test Case: serve id/INVALID_BORROWER_ID
      Expected: Borrower is not served. An error stating the correct format of a borrower ID is shown.

Unregistering a borrower

  1. Unregistering a registered borrower while not in Serve mode.

    1. Prerequisites: LiBerry is in not Serve mode, Borrower ID is valid, borrower to be unregistered has no loans.

    2. Test case: unregister id/VALID_BORROWER_ID
      Expected: Borrower with VALID_BORROWER_ID will be unregistered.

    3. Using the original sample data when you first load up LiBerry without any changes made, you can enter the following test case: unregister id/K0069.

    4. Other incorrect loan commands to try: unregister, unregister abc,unregister id/INVALID_BORROWER_ID, unregister id/BORROWER_ID_THAT_DOES_NOT_EXIST
      Expected: Borrower is not served. Error details shown in the command results display.

  2. Unregistering the currently serving borrower.

    1. Prerequisites: LiBerry is in Serve mode, command format is correct, Borrower ID is valid and borrower to be unregistered is currently being served.

    2. Test case: serve id/BORROWER_ID_CURRENTLY_SERVING
      Expected: Borrower is not served. An error stating that borrower currently served cannot be unregistered.

  3. Unregistering a borrower with loaned books.

    1. Prerequisites: Command format is correct, borrower to be unregistered is not currently being served, borrower ID is valid and borrower has loans.

    2. Test Case: `unregister id/BORROWER_ID_WITH_LOANS Expected: Borrower is not served. An error stating that borrower currently has loans and cannot be unregistered.

  4. Using serve command with an invalid borrower ID. An invalid borrower ID is one which does not have 4 digits following a capital 'K' character.

    1. Prerequisites: Command format is correct.

    2. Test Case: unregister id/INVALID_BORROWER_ID
      Expected: Borrower is not served. An error stating the correct format of a borrower ID is shown.