DinerDirector Developer Guide
Table of Contents
- Acknowledgements
- Setting up
- Design
- Implementation
- Glossary
- Appendix A: Requirements
- Appendix B: Instructions for manual testing
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:
Setting up the project in your computer
- Fork this repo, and clone the fork into your computer.
- Open the application
Intellij IDEA
.- On the top left of the navigation bar, select
File
>Open...
. - Navigate to the folder, and select the folder containing the
DinerDirector
files that was cloned. - 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.
- On the top left of the navigation bar, select
- 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.
- Verify the setup
- Once the above steps are completed, locate the file
src/main/java/dinerdirector/DinerDirector.java
, right-click and selectRun 'DinerDirector.main()'
- 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? >
- Once the above steps are completed, locate the file
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:
- 4 subcomponents: Command, HelpCommand, ExitCommand, IncorrectCommand
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:
- 4 sub packages with the following names: deadline, meeting, menu and staff
- Each package contains the 4 general commands:
- AddXYZCommand
- DeleteXYZCommand
- ViewXYZCommand
- FindXYZCommand
- The general commands have specific names depending on the package it is in.
- Each package contains the 4 general commands:
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.
- DeadlineManager: This class contains an ArrayList of deadlines and methods implementing the deadlines shown in the class diagram.
- DishManager: This class contains an ArrayList of dishes and methods like isInsideDishes for judging whether a dish is inside the dish list, stringOfDish which returns the dish information,isInsideDishesWithIndex which returns the dish information with index and getDishesSize which returns the size of the dishes, apart from methods in the diagram.
- MeetingManager: This class contains an ArrayList of meetings and methods implementing the meetings shown in the class diagram.
- StaffManager: This class contains an ArrayList of staffs and methods like getStaffs with returns the staff list, apart from the methods in the diagram.
Ui Component
The Ui Component consists of the TextUi
class that handles interactions between the app and the user.
The TextUi
class performs the following functions:
-
Reading the user input through
DinerDirector
class (Empty inputs will be ignored)method:
getUserInput()
-
Printing messages generated by the app to the terminal through ‘XYZManager’, where XYZ stands for each of the entity in our app.
methods:
printBanner()
,printMessage()
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:
- Parse the command given the user input and extracts out the necessary information related to the command.
- Returns the appropriate Command Class based on the parsed input.
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:
- Create a directory in the root folder of where the application is running.
The XYZStorage
class performs the following functions:
- Read and load data from the file.
- Write to the file if any changes occur to the list.
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.
-
add_meeting: Add a meeting to the meeting list.
- delete_meeting: Delete a meeting in the meeting list by its index. The sequence diagram follows the same pattern as above.
- view_meetings: Print all the meetings in the meeting list.The sequence diagram follows the same pattern as above.
- find_meeting: Find and print all the meetings in the meeting list that contain the keyword that the user specified. The sequence diagram follows the same pattern as above.
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 deadlinelist
if 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
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
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
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
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
- Any Operating System - Windows, Linux, Unix, OS-X
Appendix A: Requirements
Product scope
Target user profile
- Restaurant Managers.
- Wants to manage their restaurant better.
- Wants to track their restaurant daily operations.
- Can type fast.
- Comfortable using CLI interface.
Value proposition
- There are too many things to keep track of in a restaurant.
- We want to create an application that will allow the restaurant manager to have a place to quickly refer to, and keep track of the things that allow the restaurant to function on a daily basis.
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
- The application should be able to run on any operating systems (OS) with
Java 11
installed. - The application should be responsive.
- The application should be able to hold up to at least 100 items in the different lists without lagging.
- The application should be easy to learn and pick up by reading the User Guide.
- When using the application, a user with above average typing speed should be able to complete tasks faster as compared to using a mouse.
Appendix B: Instructions for manual testing
Launch and shutdown
- Initial launch
- Download the latest version of
DinerDirector
from here. - Copy the file to the folder you want to use as the home folder for your
DinerDirector
. - Open a command terminal,
cd
into the folder you put the jar file in, and use thejava -jar dinerdirector.jar
command to run the application. - Once the welcome message is displayed,
DinerDirector
is ready for use.
- Download the latest version of
- Shutdown
- To exit
DinerDirector
, type the commandexit
and press enter.
- To exit
Meeting Feature
- Users can
add_meeting
,view_meetings
,delete_meeting
,find_meeting
. -
Test case:
add_meeting n/Meeting with boss t/3pm
Expected: Meeting will be added to the list.
-
Test case:
view_meetings
Expected: All meetings will be displayed.
-
Test case:
delete_meeting 1
Expected: The meeting at index 1 will be deleted.
-
Test case:
find_meeting boss
Expected: Meetings with
boss
in the name will be displayed. - Incorrect commands to try:
add_meeting
(No meeting added)view_meetings abc
(No meetings shown)delete_meeting -1
(Invalid index for delete)
Deadline Feature
- Users can
add_deadline
,view_deadlines
,delete_deadline
,find_deadline
. -
Test case:
add_deadline n/Fix broken pipes t/6th April 6pm
Expected: Deadline will be added to the list.
-
Test case:
view_deadlines
Expected: All deadlines will be displayed.
-
Test case:
delete_deadline 1
Expected: The deadline at index 1 will be deleted.
-
Test case:
find_deadline Fix
Expected: Deadline with
Fix
in the name will be displayed. - Incorrect commands to try:
add_deadline
(No deadline added)view_deadlines abc
(No deadlines shown)delete_deadline -1
(Invalid index for deadline)
Dish Feature
- Users can
add_dish
,view_dish
,delete_dish
,find_dish
-
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.
-
Test case:
view_dish
Expected: All dishes will be displayed.
-
Test case:
delete_dish 1
Expected: The dish at index 1 will be deleted.
-
Test case:
find_dish Burger
Expected: Dish with
Burger
in the name will be displayed. - Incorrect commands to try:
add_dish
(No dish added)view_dish abc
(No dish shown)delete_dish -1
(Invalid index for dish)
Staff Feature
- Users can
add_staff
,view_staff
,delete_staff
,find_staff
-
Test case:
add_staff n/John Doe w/Tuesday d/1990-08-28 p/88193213
Expected: Staff will be added to the list.
-
Test case:
view_staff
Expected: All staffs will be displayed.
-
Test case:
delete_staff 1
Expected: The staff at index 1 will be deleted.
-
Test case:
find_staff John
Expected: Staff with
John
in the name will be displayed. - Incorrect commands to try:
add_staff
(No staff added)view_staff abc
(No staff shown)delete_staff -1
(Invalid index for staff)