Overview
CookBuddy is a desktop recipe manager for students staying in university accommodation who enjoy cooking. They can interact with it through a Command Line Interface (CLI), and it has a Graphical User Interface (GUI) created with JavaFX. It is written in Java, and has about 10 kLoC.
Summary of contributions
-
Major enhancement: Morphed addressbook-level3 into a basic version of CookBuddy. #75
-
What it does: allows my teammates to start working on features to extend CookBuddy.
-
Justification: CookBuddy does not make use of the Person class or its fields like Email & Address.
-
Highlights: This enhancement affects the commands CookBuddy can respond to. For instance, CookBuddy responds to
new
instead ofadd
.
-
-
Major enhancement: Created the test framework for CookBuddy. #120
-
What is does: It creates the test framework for my teammates to create test classes for CookBuddy.
-
Justification: This enhancement makes it a bit easier for my teammates to write test classes for CookBuddy.
-
Highlights: The test framework has some sample recipes with initialised attributes to make creating test recipes a bit easier.
-
-
Minor enhancement: added a Command History feature that allows the user to navigate to previous commands using the page up / page down keys. #289
-
Code contributed: [Code Contributed]
-
Other contributions:
-
Project management:
-
Enhancements to existing features:
-
Documentation:
-
Updated the instructions for the
new
andmodify
commands in the User Guide. #170 -
Updated the instructions for the
find
command in the User Guide. #314, #164 -
Added instructions on how to use the
find
command in the User Guide. #164 -
Added an explanation of how the
find
command works to the Developer Guide. #323 -
Added Instructions for Manual Testing to the Developer Guide. #302
-
-
Community:
-
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. |
Adding a recipe — new
[Done by Kevin]
You can add a new recipe to CookBuddy using the new
command.
Parameters in bold indicate they are mandatory. |
Format: new n/NAME ing/INGREDIENT, QUANTITY [; …] ins/INSTRUCTION [; …] [p/PATH] [cal/CALORIES] [s/SERVING_SIZE]
[r/RATING] [t/TAG [, …]]
Remember to follow the format specified strictly and carefully. |
CookBuddy accepts the following parameters:
-
n/
- name of the recipe -
ing/
- ingredients in the recipe -
ins/
- instructions to follow -
p/
- path of the recipe’s photo -
cal/
- calories in the recipe (in kcal) -
s/
- serving size of the recipe (any integer greater than 0) -
r/
- personal rating of the recipe (any integer between 0-5 inclusive) -
d/
- difficulty in following the recipe (any integer between 0-5 inclusive) -
t/
- tags (separated by commas)
Example 1: You can enter new n/Fried Rice ing/White rice, 1 cup; salt, 1 gram ins/Fry the rice; add salt
into CookBuddy, and a new recipe with the following attributes will be added:
-
Name: Fried Rice
-
Ingredients:
-
1 cup of white rice
-
1 gram of salt
-
-
Instructions:
-
Fry the rice
-
Add salt
-
Expected Outcome
new
command including the attributes of the recipenew
command, the new recipe will be added to CookBuddy and will be displayed.Finding recipes — find
[Done by Kevin]
You can find an existing recipe with a particular attribute from CookBuddy using the find
command.
Format: find [n/NAME […]]
Format: find [ing/INGREDIENT 1, QUANTITY [; …]]
Format: find [ins/INSTRUCTION [; …]]
CookBuddy can find recipes from one parameter at a time. |
Finding a recipe by name
You can find a recipe by its name by running find n/NAME […]
.
Example: You can type find n/Ham
and CookBuddy will display recipes that contain the word Ham in their name.
Expected Outcome
find n/Ham
command, recipes that contain Ham in their name are displayed.Finding a recipe by ingredient
You can find a recipe by its ingredients by running find ing/INGREDIENT […]
.
Example: You can type find ing/bread
and CookBuddy will display the recipes containing bread as an ingredient to you.
find ing/bread
command, recipes that contain bread in their ingredients are displayed.Finding a recipe by instructions
You can find a recipe by its instructions by running find ins/INSTRUCTION […]
.
Example: You can type find ins/head
and CookBuddy will display the recipes containing head in its instructions to you.
find ins/head
command, recipes that contain head in their ingredients are displayed.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. |
Finding recipes [Done by Kevin]
The following section describes how the find
command is implemented as well as design considerations that were taken into account during its implementation.
Some possible future improvements are also suggested to improve the functionality of the find
command.
The find
command is implemented in the FindCommand class.
The following activity diagram shows the possible paths CookBuddy can take when a find
command is run.
Implementation
-
When entering the
find
command, the user will specify one attribute to search within as well as the search terms.
Possible attributes to search within are name (n/
), ingredients (ing/
) and instructions (ins/
). -
FindCommandParser ensures that only one attribute is specified and returns a FindCommand with the relevant ContainsKeywordPredicate class.
The following sequence diagram summarizes the execution of the find
command
find
commandDesign Considerations
As the FindCommand class only takes in a single ContainsKeywordsPredicate object, CookBuddy can only search within a single attribute at a time.
Possible improvements
As it is currently implemented, the find
command only accepts finding via one attribute at a time.
A possible future improvement would enable it to search for recipes using multiple attributes.
This would greatly enhance the usefulness of the find
function in CookBuddy.
For example, running find n/Ham ing/toast
will make CookBuddy search for recipes with Ham in its name, or toast in its ingredients.
Instructions for Manual Testing [Done by Kevin]
Given below are instructions to test the app manually.
These instructions only provide a starting point for testers to work on; testers are advised to do more exploratory testing. |
Launch and Shutdown
-
Launching CookBuddy
-
Ensure you are using Java 11 by opening a Command Prompt / terminal and run
java -version
. -
Download the latest CookBuddy jar file here and copy it into an empty folder
-
Launch Command Prompt / a terminal, navigate to the folder CookBuddy is in and enter
java -jar CookBuddy.jar
. Do not double-click CookBuddy.jar
Expected: Shows CookBuddy’s GUI with a set of sample recipes. The window size may not be optimum.
-
-
Saving window preferences
-
Resize CookBuddy’s window to an optimum size. Move the window to a different location on the screen. Close the window.
-
Re-launch CookBuddy by entering
java -jar CookBuddy.jar
in a Command Prompt / terminal.
Expected: The most recent window size and location is retained.
-
-
Exiting CookBuddy
-
On Windows, click the Close Window button X on the top-right corner of CookBuddy’s GUI
-
On Mac, click the Close Window button X on the top-left corner of CookBuddy’s GUI
-
Type
exit
in CookBuddy’s command box and press EnterExpected: CookBuddy will shut down.
-
Adding a recipe
-
Add a recipe with all mandatory fields present. Name (n/), Ingredients (ing/) and Instructions (ins/) are mandatory fields.
-
Prerequisites: The recipe to be added is not present in the recipe book.
-
Test case:
new n/Eggs on Toast ing/bread, 2 slices; egg, 1 ins/toast the 2 slices of bread; scramble the eggs; put eggs on toasted bread; serve
Expected: The Eggs on Toast recipe is added to the recipe list. Details of the newly added recipe is shown in the result pane.
-
-
Add a recipe with one mandatory field missing, Instructions in this case.
-
Test case:
new n/Eggs on Toast ing/bread, 2 slices; egg, 1
Expected: No recipe is added. An "Invalid command format" error message is shown in the result pane.
-
-
Add a recipe with a missing ingredient quantity (egg is missing its quantity)
-
Test Case:
new n/Eggs on Toast ing/bread, 2 slices; egg ins/toast the 2 slices of bread; scramble the eggs; put eggs on toasted bread; serve
Expected: No recipe is added. Error message No quantity has been provided for one or more ingredients! is shown in the result pane.
-
Modifying a recipe
CookBuddy should contain at least one recipe. If no recipe exists, delete the data folder and re-launch CookBuddy. The recipe book should contain two recipes, Ham Sandwich & Idiot Sandwich. |
The Modify command allows changing multiple attributes in one command.
For example, modify 1 n/Rice cal/250 updates both recipe 1’s name and calories.
|
-
Modifying a recipe’s name
-
Test Case:
modify 1 n/Chicken Rice
Expected: The first recipe’s name is updated to Chicken Rice. -
Test Case:
modify 1 n/
Expected: The first recipe’s name is not updated. Error details are shown in in result pane. -
Test Case:
modify 1 n/!@#abc
Expected: The first recipe’s name is not updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s ingredients
-
Test Case:
modify 1 ing/ing1, qty1; ing2, qty2
Expected: The first recipe’s original ingredients should be overwritten with ing1 & ing2. -
Test Case:
modify 1 ing/ing1, ; ing2, qty2
Expected: The first recipe’s ingredients are not updated due to ing1 missing its quantity. -
Test Case:
modify 1 ing/, qty1; ing2, qty2
Expected: The first recipe’s ingredients are not updated due to ing1 missing its name.
-
-
Modifying a recipe’s instructions
-
Test Case:
modify 1 ins/ins1; ins2
Expected: The first recipe’s original instructions should be overwritten with ins1 & ins2. -
Test Case:
modify 1 ins/
Expected: The first recipe’s instructions should not be updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s calories
-
Test Case:
modify 1 cal/2000
Expected: The first recipe’s calories should be updated to 2000 kCal. -
Test Case:
modify 1 cal/abc
Expected: The first recipe’s calories is not updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s serving size
-
Test Case:
modify 1 s/3
Expected: The first recipe’s serving size should be updated to 3. -
Test Case:
modify 1 s/abc
Expected: The first recipe’s serving size is not updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s difficulty
-
Test Case:
modify 1 d/4
Expected: The first recipe’s difficulty should be updated to 4 on a scale of 1 to 5. -
Test Case:
modify 1 d/6
Expected: The first recipe’s difficulty is not updated. Error details are shown in in result pane. -
Test Case:
modify 1 d/abc
Expected: The first recipe’s difficulty is not updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s rating
-
Test Case:
modify 1 r/5
Expected: The first recipe’s rating should be updated to 5 stars. -
Test Case:
modify 1 r/8
Expected: The first recipe’s rating is not updated. Error details are shown in in result pane. -
Test Case:
modify 1 r/abc
Expected: The first recipe’s rating is not updated. Error details are shown in in result pane.
-
-
Modifying a recipe’s tags
-
Test Case:
modify 1 t/breakfast
Expected: The first recipe’s tags should be updated to contain one tag, breakfast. -
Test Case:
modify 1 t/breakfast, lunch
Expected: The first recipe’s tags should be updated to contain two tags, breakfast & lunch. -
Test Case:
modify 1 t/
Expected: The first recipe’s tags should be updated to contain zero tags.
-
Finding a recipe
-
Finding recipes by name
-
Prerequisite: CookBuddy contains a recipe with Ham in its name.
Test Case:find n/Ham
Expected: Recipes with the word Ham in their name are listed. -
Prerequisite: CookBuddy contains Ham Sandwich and Idiot Sandwich.
Test Case:find n/Ham Sandwich
Expected: Recipes whose name contains Ham or Sandwich are listed. So both Ham Sandwich and Idiot Sandwich are listed.
-
-
Finding recipes by ingredient
-
Prerequisite: CookBuddy contains a recipe with bread in its ingredients.
Test Case:find ing/bread
Expected: Recipes whose ingredient names contain bread are listed.
-
-
Finding recipes by instruction
-
Prerequisite: CookBuddy contains a recipe with ham in its instructions.
Test Case:find ins/bread
Expected: Recipes whose instructions contain ham are listed.
-
Marking a recipe as done / not done
CookBuddy should contain at least one recipe.
If no recipe exists, delete the data folder and re-launch CookBuddy.
The recipe book should contain two recipes, Ham Sandwich & Idiot Sandwich.
|
-
Marking a recipe as done
-
Test Case:
done 1
Expected: The first recipe should be marked as done. -
Test Case:
done n
(where n is larger than the list size)
Expected: An error message is shown in the result pane prompting the user to enter a valid list index number. -
Test Case:
done abc
Expected: An error message is shown in the result pane prompting the user to enter a valid integer.
-
-
Marking a recipe as not done
-
Test Case:
undo 1
Expected: The first recipe should be marked as not done. -
Test Case:
undo n
(where n is larger than the list size)
Expected: An error message is shown in the result pane prompting the user to enter a valid list index number. -
Test Case:
undo abc
Expected: An error message is shown in the result pane prompting the user to enter a valid integer.
-
Marking a recipe as a favourite / not a favourite
CookBuddy should contain at least one recipe.
If no recipe exists, delete the data folder and re-launch CookBuddy.
The recipe book should contain two recipes, Ham Sandwich & Idiot Sandwich.
|
-
Marking a recipe as a favourite
-
Test Case:
fav 1
Expected: The first recipe should be marked as favourite, indicated by the filled heart symbol. -
Test Case:
fav n
(where n is larger than the list size)
Expected: An error message is shown in the result pane prompting the user to enter a valid list index number. -
Test Case:
fav abc
Expected: An error message is shown in the result pane prompting the user to enter a valid integer.
-
-
Un-marking a recipe as a favourite
-
Test Case:
unfav 1
Expected: The first recipe should be un-marked as favourite, indicated by the un-filled heart symbol. -
Test Case:
unfav n
(where n is larger than the list size)
Expected: An error message is shown in the result pane prompting the user to enter a valid list index number. -
Test Case:
unfav abc
Expected: An error message is shown in the result pane prompting the user to enter a valid integer.
-
Adding a prep time to a recipe
CookBuddy should contain at least one recipe.
If no recipe exists, delete the data folder and re-launch CookBuddy.
The recipe book should contain two recipes, Ham Sandwich & Idiot Sandwich.
|
-
Adding a prep time
-
Test Case:
time 1 00:15
Expected: The first recipe’s prep time should be updated to 15 minutes. -
Test Case:
time 1 00:15:30
Expected: The first recipe’s prep time should be updated to 15 minutes and 30 seconds. -
Test Case:
time 1 00:63
Expected: An error message is shown in the result pane prompting the user to enter a minutes value which is < 60. -
Test Case:
time 1 00:15:65
Expected: Expected: An error message is shown in the result pane prompting the user to enter a seconds value which is < 60.
-
Deleting a recipe
-
Deleting a recipe while all recipes are listed
-
Prerequisites: List all recipes using the
list
command. Have at least one recipe in the list. -
Test case:
delete 1
Expected: The first recipe is deleted from the list. Details of the deleted recipe is shown in the result pane. -
Test case:
delete 0
Expected: No recipe is deleted. Error message "The recipe index provided is invalid" is shown in the result pane. -
Test case:
delete n
(where n is larger than the list size)
Expected: Similar to previous. -
Test case:
delete
Expected: No recipe is deleted. An error message prompting the user to provide an index is shown in the result pane. -
Test case:
delete abc
Expected: No recipe is deleted. An error message prompting the user to provide a valid integer is shown in the result pane.
-
Saving data
-
Saving CookBuddy’s recipe book to the save file.
-
Enter any valid command that modifies data in the recipe book.
-
A file named recipebook.json should be created in the data/ folder.
-
-
Dealing with missing/corrupted data in CookBuddy’s save file
-
Edit recipebook.json and delete any recipe’s difficulty parameter and re-launch CookBuddy.
-
The recipe whose difficulty was deleted will have defaulted back to 0 difficulty.
-