Skip to the content.

DinerDirector Developer Guide

Table of Contents

Acknowledgements

Credits to Personbook for some reused skeleton code and inspiration on OOP implementation.
Credits to addressbook-level3 for providing a guide on how to write Developer and User Guide.

Setting up

Prerequisite

Ensure you have the following installed:

  1. JDK 11
  2. Intellij IDEA

Setting up the project in your computer

  1. Fork this repo, and clone the fork into your computer.
  2. Open the application Intellij IDEA.
    1. On the top left of the navigation bar, select File > Open....
    2. Navigate to the folder, and select the folder containing the DinerDirector files that was cloned.
    3. By default, if there is a build.gradle in the project root, Intellij treats it as a Gradle project by default. Just in case it didn’t work follow the guide Importing a Gradle project.
  3. Once the project is opened, Configure the JDK: Follow the guide JetBrains Intellij IDEA: Configure JDK to ensure Intellij is configured to use JDK 11.
  4. Verify the setup
    1. Once the above steps are completed, locate the file src/main/java/dinerdirector/DinerDirector.java, right-click and select Run 'DinerDirector.main()'
    2. If setup is correctly done, this is what you should see:
       Welcome to DinerDirector! Please type "help" for a list of valid commands.
       What can I do for you?
       >
      

Design

Architecture

The Architecture Diagram given above explains the high-level design of DinerDirector. Given below is a quick overview of main components and how they interact with each other.

Architecture of Main Components
DinerDirector entry point to the application is DinerDirector. Initially, DinerDirector class interact with UI class to prompt user for inputs. Once user keys in the input text, the input will be redirected to Parser class. Parser class will manage the error handling of user’s input. Next, any logic will be executed by Command object. If there exists any interaction with Entity, Command will request to Manager to assist the CRUD operations.

Command Component

The command component consists of the following:

The above commands are contained in the commands package.

In addition to that, within the commands package, there are also 4 packages named deadline, meeting, menu and staff, all of which contains their own specific command classes as shown below:

The command component consist of the Abstract Command class. It has multiple child Command classes that inherits from the Abstract Command Class. Each child Command class accepts arguments that are parsed from the Parser class and set those arguments to private variables in their respective classes, if there is any private variables to be set. An execute method will execute the operations needed for each individual commands. An isExit method will return a boolean value that decides whether the program should exit after this command is called.

Manager Component

The manager component consists of four different managers, in which the list of entity is initialized and the methods implementing the entity are written inside. XYZ represents Meeting, Deadline, Staff and Dish. The Manager class diagram above omits methods that are unique to the individual manager classes for simplification.

Ui Component

The Ui Component consists of the TextUi class that handles interactions between the app and the user.

The TextUiclass performs the following functions:

Utils Component


The Utils Component consists of the Parser class that will handle the parsing and preparing of commands within the DinerDirector application.

The Parser class performs the following functions:


The Utils Component also consists of the Storage class and the individual XYZStorage that will handle storage related operations within the DinerDirector application.

The Storage class performs the following functions:

The XYZStorage class performs the following functions:

Implementation

Parsing Feature

How the parsing works:
Step 1: The Parser() class will be called to create a new instance of Parser.

Step 2: Afterwards, when the parseCommand() method is called from DinerDirector class, the parseCommand() will split the given userInput first.

Step 3: With the userInputSplit[], the 0 index will be extracted out. That will be used as identification for the command the user typed in.

Step 4: The commandWord will be used in the switch statement to select the appropriate command. returning IncorrectCommand class is the default behavior.

Step 5: If the commandWord is valid, it will run the appropriate prepareXYZCommand().

Step 6: Each of the individual prepareXYZCommand() will take in the userInput without the command portion. The variable is named userInputNoCommand. The prepareXYZCommand() will check the userInput to see if all the appropriate values are added, and return XYZCommand class if the values are correct. prepareXXXCommand() will return IncorrectCommand class if there are some missing values or inappropriate values.

Meeting Feature

The ‘Meeting’ Feature allows users to add a meeting, delete a meeting, find a meeting and print all the meetings. The ‘Meeting’ class in the entity package shows the attributes that a meeting object has: time and issue, both are of String type. An ArrayList of meetings is initialized in the MeetingManager. Three methods that implement the meetings are also inside.

Step 1: When the user input a meeting command, the Parser will determine which command it is and return a command object.

Step 2: One of the meeting commands will be called from AddMeetingCommand, DeleteMeetingCommand, FindMeetingCommand and ViewMeetingCommand.

Step 3: Inside the command, the execute function will call the corresponding methods inside the MeetingManager and implement on the meeting list.

Deadline Feature

The Deadline Feature allows user to add Deadline objects in a deadline list. Deadline objects consists of a description String and a dueDate String. The User will also be able to delete deadlines, view deadline list.

(XYZ stands for the respective command name.)

Step 1: After the parser returns a XYZDeadlineCommand, DinerDirector will call the execute() method of the command called.

Step 2: In execute(ui) method, the corresponding XYZdeadline method of DeadlineManager will be called.

Step 3: After the XYZdeadline method completed the task given, a message will be printed through the TextUi class with the printMessage() method.

Add deadline to deadline list

Adds the Deadline object to the ArrayList deadlinelist.

The variable here is the Deadline object to be added.

A Deadline object can only be added to the deadlinelistif it has a valid description and dueDate String.

If the addition was a success, a message will be printed through TextUi class to notify the reader that the Deadline object has been added.

Delete a deadline from the deadline list

Removes a Deadline object from the ArrayList deadlinelist using the index given.

The variable here refers to the index of the Deadline object that will be deleted.

A Deadline object can only be removed if the index is a valid index in the list.

If the deletion was a success, a message will be printed through TextUi class to notify the reader that the Deadline object has been deleted.

Printing the deadline list

Prints an ArrayList through TextUi class.

For viewDeadline, the entire deadline list deadlinelist will be printed.

For findDeadline, a separate list, matchingDeadlines, containing only deadlines with matching keywords will be created and printed.

The variable here refers to the keyword String for findDeadline, whereas viewDeadline do not require a variable.

The message here refers to the list that will be printed.

If any of the list is empty, a separate message notifying the user that the list is empty will be printed.

Staff Feature

The Staff Feature allows user to create, read, update, delete (CRUD) Staff objects in the list of staffs. Staff list is managed by StaffManager Class similar to other entity objects. Here are how it works for each functionality:

Adding staff to the list

Step 1: It first checks whether the parameter needed to add Staff is already given in the correct format.

Step 2: If it passes the format checking, the Parser object will return AddStaffCommand to be executed by DinerDirector.

Step 3: AddStaffCommand redirect the task to StaffManager to add the Staff object to the list of Staff

Deleting staff on the list

Step 1: It first finds the corresponding Staff object to be deleted using its index in the list in StaffManager.

Step 2: If it is a valid index, it will return DeleteStaffCommand to be executed by DinerDirector.

Step 3: DeleteStaffCommand redirect the task to StaffManager to delete the Staff object at that index.

Viewing the list of staffs

Step 1: It first checks whether there exists excessive parameter or not.

Step 2: If the command is valid, it will return ViewStaffCommand to be executed by DinerDirector.

Step 3: ViewStaffCommand redirect the task to StaffManager to print all the Staff objects.

Dish Feature

The Dish feature consists of three functions:

Add dish to list

AddDishCommandSequenceDiagram.png
Step 1: When the AddDishCommand() constructor is called, it stores the dish name, price and the list of ingredients in an entity called Dish.

Step 2: When the execute() command in AddDishCommand is called, it calls the addDish() in DishManager class that adds the Dish into an arraylist of Dishes.

Step 3: It then prints out the dish that was added to the console.

Delete dish on the list

DeleteDishCommandSequenceDiagram.png
Step 1: When the DeleteDishCommand() constructor is called, it stores the index of the Dish to be deleted from the arraylist of Dishes.

Step 2: When the execute() command in DeleteDishCommand is called, it calls the deleteDish() in DishManager class that deletes the Dish at the specified index in the arraylist of Dishes.

Step 3: It then prints out the dish that was deleted to the console.

View the list of dishes

ViewDishCommandSequenceDiagram.png
Step 1: When the execute() command in ViewDishCommand is called, it calls the viewDish() in DishManager class that returns the formatted string of all the dishes in the arraylist.

Step 2: It then prints out the formatted string containing all the dishes to the console.

Find a dish in the list of dishes

FindDishCommandSequenceDiagram.png
Step 1: When the FindDishCommand() constructor is called, it stores the keyword that is going to be used to search for dishes.

Step 2: When the execute() command in FindDishCommand is called, it calls the findDish() in DishManager class and searches through all the descriptions of dishes in the arraylist of dishes.

Step 3: It then prints out the formatted string containing all the dishes with the keyword to the console.

Storage Feature

Create directory, Read and load from XYZ file

Step 1: The Storage() class will be called to create a new instance of Storage.

Step 2: The createDirectory() method in the Storage() class will be called next. A directory called data will be created in the same folder as the application if the folder does not exist.

Read and load from XYZFile

Step 1: The XYZStorage() class will be called to create a new instance of XYZStorage.

Step 2: The readAndLoadFromXYZFile() method in the XYZStorage() class is called to read and load data if any application related text files exists.

Write to XYZ file

Step 1: The XYZStorage() class will be called to create a new instance of XYZStorage.

Step 2: The writeToXYZFile() method in the XYZStorage() class is called to write the contents in the list into the respective file.

Step 3: The writeToXYZFile() method is called in addXYZ() method in the XYZManager class.

Step 4: The addXYZ() method is called from outside XYZManager() class.

Step 5: The above process is listed only for addXYZ(), but deleteXYZ() follows the same process as the above sequence diagram.

Glossary

Appendix A: Requirements

Product scope

Target user profile

Value proposition

User Stories

Version As a … I want to … So that I can …
v1.0 forgetful restaurant manager get reminded of the things I need to keep track of not miss any important deadlines that may affect my business
v1.0 forgetful restaurant manager schedule meeting and show the timetable know when the meeting is going to occur
v1.0 newcomer restaurant manager view the help list of the app get to know this application easier
v1.0 newcomer restaurant manager view all the workers information get to know all the workers better
v1.0 restaurant manager managing a 3-Michelin star restaurant keep track of current menu prices, ingredients, and name be more particular about details on my menu
v2.0 restaurant manager find a to-do item by name locate a to-do without having to go through the entire list
v2.0 restaurant manager find information about a specific worker know the worker’s details and when he is working without going through the whole list
v2.0 restaurant manager find information about a specific dish I added find what ingredients I added to the dish without going through the whole list
v2.0 restaurant manager find information about a specific meeting look up information about that meeting without going through the whole list
v2.0 restaurant manager find information about a specific deadline find details about the deadline date without going through the whole list
v2.0 restaurant manager view what I typed into the app previously not have need to retype everything everytime I enter the app

Non-Functional Requirements

Appendix B: Instructions for manual testing

Launch and shutdown

  1. Initial launch
    1. Download the latest version of DinerDirector from here.
    2. Copy the file to the folder you want to use as the home folder for your DinerDirector.
    3. Open a command terminal, cd into the folder you put the jar file in, and use the java -jar dinerdirector.jar command to run the application.
    4. Once the welcome message is displayed, DinerDirector is ready for use.
  2. Shutdown
    1. To exit DinerDirector, type the command exit and press enter.

Meeting Feature

  1. Users can add_meeting, view_meetings, delete_meeting, find_meeting.
  2. Test case: add_meeting n/Meeting with boss t/3pm

    Expected: Meeting will be added to the list.

  3. Test case: view_meetings

    Expected: All meetings will be displayed.

  4. Test case: delete_meeting 1

    Expected: The meeting at index 1 will be deleted.

  5. Test case: find_meeting boss

    Expected: Meetings with boss in the name will be displayed.

  6. Incorrect commands to try:
    1. add_meeting (No meeting added)
    2. view_meetings abc (No meetings shown)
    3. delete_meeting -1 (Invalid index for delete)

Deadline Feature

  1. Users can add_deadline, view_deadlines, delete_deadline, find_deadline.
  2. Test case: add_deadline n/Fix broken pipes t/6th April 6pm

    Expected: Deadline will be added to the list.

  3. Test case: view_deadlines

    Expected: All deadlines will be displayed.

  4. Test case: delete_deadline 1

    Expected: The deadline at index 1 will be deleted.

  5. Test case: find_deadline Fix

    Expected: Deadline with Fix in the name will be displayed.

  6. Incorrect commands to try:
    1. add_deadline (No deadline added)
    2. view_deadlines abc (No deadlines shown)
    3. delete_deadline -1 (Invalid index for deadline)

Dish Feature

  1. Users can add_dish, view_dish, delete_dish, find_dish
  2. Test case: add_dish n/Chicken Burger pc/1099 [tomatoes;chicken fillet;cheese;bread with sesame seeds;]

    Expected: Dish will be added to the list.

  3. Test case: view_dish

    Expected: All dishes will be displayed.

  4. Test case: delete_dish 1

    Expected: The dish at index 1 will be deleted.

  5. Test case: find_dish Burger

    Expected: Dish with Burger in the name will be displayed.

  6. Incorrect commands to try:
    1. add_dish (No dish added)
    2. view_dish abc (No dish shown)
    3. delete_dish -1 (Invalid index for dish)

Staff Feature

  1. Users can add_staff, view_staff, delete_staff, find_staff
  2. Test case: add_staff n/John Doe w/Tuesday d/1990-08-28 p/88193213

    Expected: Staff will be added to the list.

  3. Test case: view_staff

    Expected: All staffs will be displayed.

  4. Test case: delete_staff 1

    Expected: The staff at index 1 will be deleted.

  5. Test case: find_staff John

    Expected: Staff with John in the name will be displayed.

  6. Incorrect commands to try:
    1. add_staff (No staff added)
    2. view_staff abc (No staff shown)
    3. delete_staff -1 (Invalid index for staff)