Recipe Organizer Project Overview
Recipe Organizer Project Overview
MASTER OF ENGINEERING
IN
Submitted to:
Er.Manjit Singh
Submitted By:
NAME:SAMEER AHMED
UID:24MCS10032
Nov 2024
Table of Contents
1. Executive Summary
2. Introduction
3. System Requirements
3.1. Functional Requirements
3.2. Non-Functional Requirements
4. System Architecture
4.1. Model
4.2. View
4.3. Controller
4.4. Advantages of MVC
4.5. System Components Interaction Diagram
5. Data Model
5.1. Entities and Their Relationships
5.2. Implementation in C++
7. Recipe Management
7.1. Recipe Creation
7.2. Viewing Recipes
7.3. Editing Recipes
7.4. Deleting Recipes
8. Search and Filtering
8.1. Search Functionality
8.2. Filtering Functionality
Abstract
The Advanced Data System for Appetizing Recipes project is designed to provide
culinary enthusiasts with an efficient and user-friendly platform for managing recipes. Its
main objectives include simplifying the process of storing, categorizing, and retrieving
recipes while fostering creativity in the kitchen. The application boasts several key
features, such as an intuitive user interface, advanced search and filtering options, and
the ability to create personalized shopping lists based on selected recipes.
Developed using C++, the Advanced Data System for Appetizing Recipes leverages
advanced data structures and algorithms (ADSA) to enhance performance and optimize
user experience. By utilizing efficient data structures like hash tables and binary trees,
the application ensures fast retrieval and organization of recipes. This combination of
user-eccentric design and robust backend technology allows users to experiment with
diverse culinary styles and ingredients, ultimately transforming recipe management into
an enjoyable and seamless experience. The Advanced Data System for Appetizing
Recipes stands as a comprehensive solution tailored to meet the needs of modern
home cooks and food enthusiasts alike.
Introduction
The Advanced Data System for Appetizing Recipes project emerges from the
recognition of the challenges that culinary enthusiasts and home cooks face when
managing their extensive recipe collections. In a world where cooking has become more
accessible through various digital platforms, individuals often find themselves
overwhelmed by the sheer volume of recipes they encounter. These recipes might
come from cookbooks, websites, or personal notes, making it difficult to efficiently store,
categorize, and retrieve them when needed. Users frequently struggle to locate a
specific dish, remember where they saved it, or deal with poorly organized recipes,
leading to frustration and wasted time during meal preparation.
Motivated by these common grievances, the Advanced Data System for Appetizing
Recipes aims to provide a comprehensive solution that simplifies the management of
recipes. The primary objective of this application is to create a user-friendly platform that
allows individuals to easily input, categorize, and access their recipes based on
customizable parameters such as ingredients, cooking time, and dietary restrictions. By
harnessing the power of C++ programming along with advanced data structures and
algorithms (ADSA), the Advanced Data System for Appetizing Recipes enhances
performance and streamlines the storage and retrieval processes.
This application not only addresses the functional needs of users but also inspires
creativity in the kitchen. It encourages users to experiment with new ingredients and
culinary styles by offering personalized suggestions based on their preferences and
previous selections. Ultimately, the Advanced Data System for Appetizing Recipes
seeks to transform the often chaotic experience of recipe management into a
streamlined and enjoyable culinary journey, fostering a deeper appreciation for cooking
among its users.
Literature Review
In recent years, the popularity of recipe management applications has surged, driven by
the increasing number of culinary enthusiasts and home cooks seeking efficient tools for
organizing their culinary collections. Several existing applications have emerged in this
space, each offering unique features and capabilities, while also exhibiting certain
limitations.
One prominent example is Paprika Recipe Manager, which allows users to save
recipes from websites, create meal plans, and generate grocery lists. Its strengths lie in
its integration with web browsers, enabling easy recipe imports, and its user-friendly
interface. However, it lacks advanced search functionalities, limiting users’ ability to filter
recipes effectively based on specific dietary needs or ingredient availability.
Another popular option is Yummly, known for its robust search engine and personalized
recommendations. Users can filter recipes based on dietary preferences, cuisines, and
ingredients. While Yummly's strength is its extensive database and sophisticated
recommendation algorithm, it often requires users to create an account, which may
deter some potential users. Additionally, the app's reliance on internet connectivity may
limit usability in offline scenarios.
BigOven is yet another recipe management application that combines functionality with
a social aspect, allowing users to share recipes and meal ideas. Its strengths include a
vast collection of user-generated recipes and a strong community aspect. However, the
app's interface can be overwhelming for new users, and its search functionality is not as
intuitive as some competitors, making recipe discovery cumbersome at times.
The Advanced Data System for Appetizing Recipes project builds upon these existing
solutions by addressing their limitations while enhancing user experience. Unlike the
aforementioned applications, the Advanced Data System for Appetizing Recipes
emphasizes a more streamlined user interface with an intuitive navigation system that
simplifies recipe categorization and retrieval. It incorporates advanced filtering options
that allow users to find recipes tailored to their specific needs, such as dietary
restrictions and cooking time, without the need for internet connectivity.
Furthermore, the Advanced Data System for Appetizing Recipes leverages advanced
data structures and algorithms for efficient data management, ensuring faster search
and retrieval times compared to many existing platforms. By integrating features like
personalized suggestions based on user preferences and previous selections, the
Advanced Data System for Appetizing Recipes not only serves as a repository for
recipes but also enhances creativity in the kitchen, encouraging users to explore new
culinary avenues. This holistic approach ultimately positions the Advanced Data System
for Appetizing Recipes as a comprehensive solution that seeks to revolutionize recipe
management for both novice and seasoned cooks alike.
Methodology
The development of the Advanced Data System for Appetizing Recipes application
followed a structured software development lifecycle (SDLC) that encompassed various
phases, including planning, design, implementation, testing, and deployment. This
methodology ensured a systematic approach to building a robust and user-friendly
application.
Output Screenshot:
This unit test example demonstrates how the functionality of adding ingredients is
validated, ensuring reliability.
5. Deployment: After thorough testing and refinement, the Advanced Data System
for Appetizing Recipes was deployed for public use. Continuous feedback
mechanisms were established to allow users to report issues and suggest
improvements, ensuring that the application evolves based on user experiences.
Components of MVC
1. Model: The Model component is responsible for managing the data of the
application. It includes the core entities such as Users, Recipes, Ingredients, and
Categories, encapsulating all data-related operations such as creation, retrieval,
updating, and deletion (CRUD). By handling the business logic, the Model
ensures that the data remains consistent and secure, reflecting any changes
made in the application immediately.
2. View: The View component is the user interface of the Advanced Data System
for Appetizing Recipes. It presents the data provided by the Model in a visually
appealing and user-friendly format. The View is designed to be intuitive, allowing
users to navigate easily between different sections of the application. It renders
various elements such as buttons, forms, and lists, facilitating seamless
interactions with users.
3. Controller: The Controller acts as an intermediary between the Model and the
View. It processes user inputs, invoking the appropriate methods in the Model to
update or retrieve data as needed. When the Model is modified, the Controller
notifies the View to refresh the display, ensuring that users always see the most
current information.
This diagram emphasizes the flow of information and user interactions throughout the
application, highlighting how each component collaborates to create a cohesive user
experience. By leveraging the MVC pattern, the Advanced Data System for Appetizing
Recipes maintains a robust architecture that can adapt to changing user needs while
delivering an efficient recipe management solution.
Data Model
The data model for the Advanced Data System for Appetizing Recipes application is
structured to effectively manage the core entities involved in recipe management. The
primary entities include User, Recipe, Ingredient, and Category. Each entity plays a
vital role in ensuring seamless functionality and user experience within the application.
Implementation in C++
The implementation of these entities is achieved using C++ classes that encapsulate
their attributes and methods. Below are code snippets demonstrating the structure of
each class within the Advanced Data System for Appetizing Recipes:
class User {
public:
int user_id;
std::string username;
std::string email;
std::string password;
void registerUser();
void login();
};
class Recipe {
public:
int recipe_id;
std::string title;
std::string instructions;
int cooking_time;
std::vector<Ingredient> ingredients;
std::vector<Category> categories;
class Ingredient {
public:
int ingredient_id;
std::string name;
double quantity;
std::string measurement;
};
class Category {
public:
int category_id;
std::string name;
};
Output:
In this implementation, each class represents an entity in the data model, with methods
that allow for managing their respective attributes effectively. The use of vectors for
storing ingredients and categories allows for dynamic management, ensuring that the
Advanced Data System for Appetizing Recipes can handle a variety of recipes and their
related components efficiently.
2. Recipe Creation Screen: This screen allows users to input new recipes. It
includes fields for the recipe title, ingredients, instructions, and cooking time.
Each field is clearly labeled, and a rich text editor is available for formatting
instructions. Users can add multiple ingredients through a dynamic list that
supports editing and deleting.
Recipe Creation Screen Wireframe
3. Recipe Detail Screen: Users can view detailed information about a selected
recipe on this screen, including ingredients, instructions, and user ratings.
Navigation buttons allow users to move between recipes effortlessly, and a “Save
to Favorites” button is readily accessible.
Recipe Detail Screen Wireframe
4. User Profile Screen: This screen enables users to manage their accounts and
view their saved recipes. A dashboard layout provides quick links to frequently
accessed features, enhancing user efficiency.
User Profile Screen Wireframe
Implementation in C++
The UI of the Advanced Data System for Appetizing Recipes is implemented using C++
and the Qt framework, which offers a rich set of tools for creating graphical user
interfaces. Below is an example of how the Home Screen can be structured using Qt:
#include <QApplication>
#include <QMainWindow>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
setCentralWidget(centralWidget);
}
};
Output:
In this code snippet, the Main-window class creates a basic structure for the Home
Screen, incorporating a search bar and an "Add Recipe" button. This demonstrates how
C++ and Qt can be effectively utilized to create intuitive UI components that enhance
user engagement and satisfaction. Through thoughtful design and robust
implementation, the Advanced Data System for Appetizing Recipes aims to provide a
seamless and enjoyable experience for all users.
Output:
In this method, the recipe details are assigned to the class attributes, and subsequent
logic is implemented to handle database interactions for persistence.
Viewing Recipes
Users can view their recipes through a list or grid display that presents key details, such
as titles and preparation times. Selecting a recipe reveals a detailed view with all
relevant information. The viewRecipe method fetches and displays the recipe's details
based on its unique identifier:
void Recipe::viewRecipe(int recipe_id) {
// Code to fetch and display the recipe details based on recipe_id
}
This method ensures that users can easily access the information they need for
cooking.
Editing Recipes
Editing existing recipes is straightforward. Users can modify any field and resubmit the
recipe for updates. The editRecipe method allows users to change the recipe's details,
which are validated before being updated in the database:
void Recipe::editRecipe(int recipe_id,
const std::string& new_title,
const std::vector<Ingredient>& new_ingredients,
const std::string& new_instructions,
int new_cooking_time) {
this->title = new_title;
this->ingredients = new_ingredients;
this->instructions = new_instructions;
this->cooking_time = new_cooking_time;
// Code to update the recipe in the database
}
Output:
This method emphasizes the importance of user flexibility in managing their recipes
effectively.
Deleting Recipes
The application provides users with the ability to delete recipes they no longer wish to
keep. The deletion process includes user confirmation to prevent accidental loss of
data. The deleteRecipe method is implemented as follows:
void Recipe::deleteRecipe(int recipe_id) {
// Code to remove the recipe from the database
}
Output:
This method encapsulates the logic necessary to safely remove a recipe from the user’s
collection.
Data Structures
The Advanced Data System for Appetizing Recipes employs various data structures to
ensure efficient recipe management. Recipes are typically stored in a vector to allow
dynamic resizing, accommodating the addition or removal of recipes seamlessly. Each
recipe contains a list of ingredients, stored in a vector, facilitating easy modifications
and retrieval.
In summary, the Recipe Management functionality of the Advanced Data System for
Appetizing Recipes is designed to provide users with an efficient and intuitive
experience. Through the implementation of C++ methods and the use of appropriate
data structures, users can manage their recipes with ease, enhancing their overall
culinary experience.
Output:
In this snippet, the search Recipes method iterates through the list of recipes, checking
if the title or any ingredient matches the search query. It returns a vector of matching
recipes for display.
Filtering Functionality
In addition to search capabilities, the Advanced Data System for Appetizing Recipes
allows users to filter recipes based on specific criteria, such as dietary restrictions,
cuisine types, or preparation time. This filtering mechanism can be implemented using
hash tables, which provide constant-time complexity when checking if a recipe meets
certain criteria.
Here’s an example of how the filtering functionality can be implemented:
std::vector<Recipe> RecipeOrganizer::filter Recipes(const std::unordered_map<std::string,
bool>& filters) {
std::vector<Recipe> filteredResults;
for (const auto& recipe : recipes) {
bool matches = true;
for (const auto& filter : filters) {
if (filter.first == "vegetarian" && !recipe.isVegetarian) {
matches = false;
break;
}
// Additional filter checks can be added here
}
if (matches) {
filteredResults.push_back(recipe);
}
}
return filteredResults;
}
Output:
In this example, the filter Recipes method checks each recipe against a set of filter
criteria stored in a hash table. Only recipes that meet all specified criteria are added to
the results.
Data Persistence
Data persistence in the Advanced Data System for Appetizing Recipes application is a
crucial aspect that ensures users' recipes and preferences are securely stored and
easily retrievable. The application employs Sq Lite as its database management
system, which allows for efficient handling of structured data while providing reliability
and ease of integration.
Output:
In this method, a new recipe is inserted into the database, with the title, instructions, and
cooking time bound to the SQL statement. This approach ensures that the recipe is
stored securely.
Output:
This method executes a SQL query to select all recipes, iterating through the results
and populating the Recipe objects with the retrieved data. The use of sqlite3_column_*
functions allows for efficient data extraction from the result set.
Conclusion
Through the use of Sq Lite, the Advanced Data System for Appetizing Recipes
application achieves robust data persistence, enabling users to create, manage, and
access their recipes seamlessly. The implementation of prepared statements for saving
data and efficient querying for loading recipes ensures that the application maintains
data integrity and security while providing a pleasant user experience.
Input Validation
The application performs input validation to ensure that user-entered data meets
specific criteria before being processed or stored. For example, when creating a new
recipe, the application checks that all mandatory fields, such as title, ingredients, and
instructions, are filled out. If any fields are empty, the application prompts the user with
an error message.
Here is a code snippet demonstrating the validation logic implemented in the Recipe
class:
bool Recipe::validateInput() {
if (title.empty() || instructions.empty() || ingredients.empty()) {
std::cerr << "Error: All fields must be filled out." << std::endl;
return false;
}
return true;
}
Output:
When you run the above code, it will prompt the user to enter a recipe title and instructions. If
the ingredients list is empty, it will output an error message. Here’s an example of what the
output might look like, assuming valid inputs are provided:
If the ingredients list is empty (by uncommenting the ingredients.clear() line), the output
will be:
In this method, the application returns a boolean indicating whether the input is valid. If
any required fields are empty, an error message is displayed, guiding the user to correct
their input.
Exception Handling
The Advanced Data System for Appetizing Recipes is designed to handle exceptions
gracefully to prevent run time errors from crashing the application. For instance, if there
is an issue with database connectivity when saving a recipe, the application catches the
exception and displays a user-friendly error message instead of terminating
unexpectedly.
Below is an example that illustrates how exceptions are handled during database
operations:
void Database::save Recipe(const Recipe& recipe) {
try {
// Code to save the recipe
} catch (const std::exception& e) {
std::cerr << "Database error: " << e.what() << std::endl;
}
}
Output:
When run this code, assuming there are no issues with the database connection, you
would see the following output:
If there is a problem with saving the recipe (for instance, if the database is not accessible),
the output might look like:
In this snippet, any exceptions thrown during the save operation are caught, and an
error message is logged, allowing the application to continue running smoothly.
Output:
In this method, the application first checks whether the recipe exists before attempting
to delete it. If the recipe is not found, an appropriate error message is displayed to
inform the user.
Output:
This method ensures that the cooking time provided by the user falls within a specified
range, preserving the integrity of the recipe data.
By implementing comprehensive error handling and validation mechanisms, the
Advanced Data System for Appetizing Recipes application ensures a seamless user
experience while protecting against common problems associated with user input and
application functionality. These measures not only enhance reliability but also build user
confidence in the application's capabilities.
Types of Testing
1. Unit Testing: Unit tests were implemented to verify the functionality of individual
components within the Advanced Data System for Appetizing Recipes. Each
class, such as User, Recipe, and Ingredient, was subjected to rigorous testing to
confirm that methods performed as expected under different conditions. The
Google Test framework was utilized for this purpose, allowing for structured and
salable unit tests. For example, a unit test for the Recipe class could validate the
addition of ingredients:
TEST(Recipe Test, Add Ingredient) {
Recipe recipe;
Ingredient ingredient{"Flour", 2, "cups"};
recipe.add Ingredient(ingredient);
EXPECT_EQ(recipe.ingredients.size(), 1);
}
Output: