My first project...
Tags: beginners, programming, python, github
Published: 2022-01-25 23:18:17

Though I've worked on several one-off programs in the past for the purpose of process modeling, process, or just general goofy fun on my own behalf, this is the first time I set out to create a project with an end goal to be built upon. Though a novice in this type of work and thinking, I wanted to write a program that I felt I would accomplish an immediate task without using solutions to bugs or errors which could constrain the ability to build upon it in the future. What ensued was about about an hour or two of thinking about how I would structure the program, and then 4-5 hours of writing, deleting, and rewriting code to reach a desirable end.

So what was the task? I was talking with a friend of mine about some recipes we wanted to share with one another. Unfortunately, I am really bad about writing recipes down. The only difference between cooking and baking is measurement, right?  Nonetheless, I thought about this:  What if I could store, access, and edit my recipes digitally? Not only would it make it easy to pull up my own recipes at any time, if I were to share these files with a friend along with my tool, they could access them too anytime they want in an easily readable format. The two things that excited me the most about this idea were the following:

1. This idea seemed like it could be built upon.  As long as I kept it open ended, there's nothing stopping me from sharing recipes with my friends via e-mails or even storing these files in the cloud for friends to upload or download recipes from.  As it stands, I think it will take me a while to gain the prowess I need to get to this point, but dare to dream.

2. Both my friends and I would no longer have to rely on my memory to tell them whether it was salt or sugar that went in that recipe. Saving taste buds one idea at a time.

So what did I come up with? A program where you can do the following actions:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/alzjlng1pvhe6vl4zuoo.PNG)

Thrilling, right? I know it's not much and it's certainly not exciting, but it's a start.  Here's how each option works:

#1. Enter a new recipe:

By entering 1 into the python3 terminal, the user is prompted to provide a name for the recipe, which will be referenced for all other actions on the recipe, including retrieval. Next, a file dialog is opened for the user to select the text file they wish to reference for the recipe.  Each of these is stored tab delimited in .txt file named "Available_recipes.txt".  The user is then prompted to continue, which returns them to the menu.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5sva15yfbuc71x43sw8.PNG)

#2. Edit an existing recipe:

By entering 2 into the python3 terminal, the user is prompted for the name of the recipe they'd like to edit.  The program then checks the 'Available_recipes.txt' file for the specified recipe.  If the recipe is in the file, the program will pull the filepath from the text document and open the recipe in notepad for editing

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jmunmfkqzf7ure999jb5.PNG)

#3. Delete an existing recipe:

Entering a 3 in the terminal from the menu will prompt you to delete a recipe.  Upon entering the recipe name, the program will ask you to confirm the deletion while restating the recipe name.  pressing Y will delete the file and prompt you to continue to the menu.  Pressing N will simply prompt you to continue to the menu.

#4. Display available recipes:

Entering a 4 will display a list of the recipes that are currently entered into Available_recipes.txt. The image below shows option 3 and 4 used in tandem to delete a recipe 'my second recipe' and confirm it's deletion.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coldhd0kzrhpiljzb6ta.PNG)

#5. Open recipe:

Entering a 5 into the terminal will display the contents of the recipe text file of your choice in the terminal after being prompted for the recipe name:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/93v7z07ve4f8oolrw6tb.PNG)
 
#6. Check for ingredient in recipe

This one's a good one for me. I have some food allergies I'm concerned about, so if I want, I can check for a set of ingredients in a given recipe by listing them separated by a space when prompted.  This leans more towards a down-the-line use if I'm able to find a good way for my friends to add recipes to this, as it will allow me to check for ingredients for components which could cause allergic reactions prior to trying to beginning to prepare the dish:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/833hp8kgeod11oty2wq0.PNG)

#7. Closes the program and thanks you for visiting!

So there you have it.  My first crack at this tool and one that I hope I can build off of as my programming fundamental knowledge grows and my strategies improve.  If you're reading this, feel free to drop a note with any cool ideas to add or ways that I can improve!  Additionally, I've supplied the links to a Github repository with all relevant files and code [here](https://github.com/Giraffbutler/CS-101-Final-Project---Recipe-Log-V1.git).  Happy coding!