PROJECT: Cooking Papa


Overview

Cooking Papa is a desktop cookbook application used to manage recipes and ingredients for cooking. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 15 kLoC.

Summary of contributions

  • Major enhancement: Added the ability to cook a recipe using inventory ingredients

    • What it does: Allows the user to remove the ingredients in the inventory after cooking a specific recipe inside CookingPapa.

    • Justification: This feature improves the product significantly because it allows the user to remove recipe’s ingredients effectively without having the user to remove the each ingredient separately.

    • Highlights: This enhancement will be one of the most used feature as this application is mainly to aid cooking experience. This enhancement helps to integrate the Cookbook and Inventory systems together to provide a all-in-one application which make this enhancement challenging also.

    • Credits: The implementation of the Inventory and Cookbook classes was a team effort which is vital to the successful implementation of this feature.

  • Minor enhancement:

    • Contributed to basic structure of Step and Tag classes in recipe.

    • Contributed to basic Recipe command classes such as managing tag and steps in a recipe.

  • Code contributed: [by @hans555]

  • Other contributions:

    • Project management:

      • Kept track of deadlines of project milestones

      • Managed bug features for v1.2 (Issue #118)

    • Enhancements to existing features:

      • Added several tests for existing features (Pull Requests #57, 142, #237)

      • Updated basic parser format to improve clarity (Pull Requests #133, #142)

    • Documentation:

      • Updated the existing user guide: #22 #132

      • Updated the existing development guide: #43

    • Community:

      • Reviewed PRs of team members before merging

      • Reported bugs and provided suggestions for other teams in the class (example: 1)

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.

Inventory Commands (by Ong Han Sheng)

Inventory commands are commands that update the user’s very own inventory at home. These commands include adding, remove and viewing the current inventory database.

Add an ingredient to the inventory

This commands allows you to add ingredients to your inventory. Ingredient names added are case-insensitive. Ingredient names such as 'Bacon' and 'bacon' will be recognised by CookingPapa as 'Bacon'.

  • Format: inventory add ingredient i/INGREDIENT q/QUANTITY

  • Examples:

Command Result

inventory add ingredient i/Eggs q/10

Adds 10 eggs into your inventory.

inventory add ingredient i/Butter q/200g

Adds 200g of butter into your inventory.

Remove an ingredient from the inventory

This command allows you to remove ingredients from the inventory. You can indicate the quantity you want to remove for an ingredient, which should not be greater that than the ingredient’s quantity. Please ensure that the unit of the quantity matches the ingredient’s unit in the inventory.

Note: If you do not indicate any quantity, all entries in the inventory that have the specified ingredient name will be removed regardless of the unit.

  • Format: inventory remove ingredient i/INGREDIENT [q/QUANTITY]

  • Examples:

Command Result

inventory remove ingredient i/Bacon

Removes all bacon from your inventory.

inventory remove ingredient i/Butter q/200g

Removes 200g of butter from your inventory. (If your inventory had 500 g of butter, it will be subtracted and updated to 300 g of butter)

Remove all ingredients from the inventory.

This command allows you to remove all ingredients from the inventory.

  • Format: inventory clear

  • Example:

Command Result

inventory clear

Removes all ingredients from the inventory

Cook a recipe using the ingredients in the inventory

This command allows you to remove the selected’s recipe ingredients from the inventory after cooking a delicious meal.

  • Format: inventory cook recipe INDEX

  • Example:

Parameters Result

inventory cook recipe 3

Removes all ingredients required to cook recipe 3 from the inventory

Recipe of the day generator [v2.0] (by Ong Han Sheng)

This command allows CookingPapa to recommend a recipe to cook based on the recipes currently in the cookbook.

  • Format: generate recipe of the day

  • Example:

Command Result

generate recipe of the day

Displays the recipe of the day

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.

Add a Recipe’s Ingredients to Cart (by Ong Han Sheng)

The user may want to buy the required ingredients to cook a certain recipe in the cookbook. This feature allows the user to add a certain recipe’s required ingredients into the cart.

Implementation

The action of adding a recipe’s ingredients to cart mechanism is facilitated by CartAddRecipeIngredientCommand, which extends the CartAddCommand abstract class. The format is as follows: cart add recipe INDEX.

This command is implemented to ease the tedious process of having the user adding every single ingredient to their cart when they want to purchase ingredients to cook a certain recipe. This provides convenience to users that frequently use our application and such process like shopping for a certain recipe’s ingredient is intuitive to users. Furthermore, this command creates interaction between the Cookbook and Cart which helps to further integrate the application as an all-in-one application.

Below is a step by step sequence of what happens when a user enters this command:

  1. The user enters the command cart add recipe INDEX in the command line input.

  2. CartAddRecipeIngredientParser parses the user input and checks if the index provided is an integer. Note that the parser will throw a ParseException if the given index is not an integer.

    try {
        recipeIndex = ParserUtil.parseIndex(argMultimap.getPreamble());
    } catch (ParseException pe) {
        throw new ParseException(String.format(MESSAGE_INVALID_RECIPE_DISPLAYED_INDEX, CartAddCommand.MESSAGE_USAGE), pe);
    }
  3. The index is passed as a parameter for CartAddRecipeIngredientCommand which is returned to LogicManager.

  4. LogicManager calls CartAddRecipeIngredientCommand#execute() which checks if the given index is a valid index of a recipe. Note that the command will throw a CommandException if the given index is not valid.

    if (recipeIndex.getZeroBased() >= model.getCookbook().getRecipeList().size()) {
        throw new CommandException(String.format(MESSAGE_INVALID_RECIPE_DISPLAYED_INDEX, MESSAGE_USAGE));
    }
  5. If the index is valid, the selected recipe’s ingredients will be added accordingly. This is done through calling Model#addCartIngredient(), with each ingredient as the parameter.

  6. Model#addCartIngredient calls Cart#addIngredident() which then adds the ingredient to the cart. If a certain ingredient exists in the cart, adding a ingredient to a cart will increase the quantity instead. Otherwise, a new instance of that ingredient will be added to the cart. After adding an ingredient, the cart will be updated with Model#updateFilteredCartIngredientList().

  7. A CommandResult with the successful text message is returned to LogicManager and will be displayed to the user via the GUI to feedback to the user that the selected recipe’s ingredients has been successfully added to the cart.

The following activity diagram shows a possible flow of events for a user using this feature:

CartAddRecipeIngredientActivityDiagram
Figure 1. Activity diagram for CartAddRecipeIngredientCommand

The following sequence diagram shows how the function of adding recipe’s ingredients to cart works:

CartAddRecipeIngredientSequenceDiagram
Figure 2. Sequence diagram for CartAddRecipeIngredientCommand

Design considerations

Aspect: Allowing users to add all or some recipe’s ingredients
Table 1. Design considerations for allowing users to add only recipe’s ingredients that are not present in the inventory to the cart

Design A (current choice): Adding all recipe’s ingredients to the cart

Design B: Adding only recipe’s ingredients that are missing in the inventory to the cart

Description

Allows user to add a recipe’s ingredients to the cart for shopping. This design is currently chosen due to ease of implementation and it works for all situations.

Allows user to add a recipe’s ingredients base on the inventory status. However, there are some situations where this design not does work. One example would be like planning to cook at outside where the inventory status is unknown.

Pros

  • Easier to implement as it does not need to check if the ingredients are already present in the inventory

  • Works for all situations as it ensures that the user is able to cook this recipe after buying the ingredients in the cart

  • Provide a more intuitive experience of the application as user only need to buy ingredients that are missing in the inventory

Cons

  • Less flexible as users have to manually remove some of the recipe’s ingredients that they do not want to buy

  • Harder to implement as additional checking is required to filter a recipe’s ingredients that are missing in the inventory

  • Users have to manually add some of the recipe’s ingredients that they want to buy although it is present in the inventory