Chow Now CLI Project

Mark May
4 min readOct 22, 2019

--

Photo by Clément H on Unsplash

Background:

As a part time online software engineering student at the Flatiron School my first cli (command line interface) project involves data scraping from a website to build a program based on sound object oriented practices. Wikipedia defines data scraping as a technique in which a computer program extracts data from human-readable output coming from another program. Wikipedia defines object oriented programming as a programming paradigm based on the concept of “objects”, which can contain data, in the form of fields, and code, in the form of procedures. Finally since I am on a Wikipedia binge, Wikipedia defines a command line interface (cli for short) as a means of interacting with a computer program where the user issues commands to the program in the form of successive lines of text.

What Say Whaaat???

Simply put computer program will extract (scrape) data from the Allrecipes.com website. Specifically the program will search for recipes using the following categories beef, pasta, seafood, pork, turkey, vegetarian and vegan. Sorry chicken lovers there seems to be a problem scraping this site for chicken recipes. It must be related to the Popeyes chicken sandwich shortage! The data that I am extracting from the site is the recipe name, description, the number of reviewers, ratings, ingredients list, directions, prep time, cook time and total time that it takes and then….“chow time”.

The objects that will be created are the individual recipes. The recipe objects will have something in common in that they will all belong to a specific food category (beef, pasta, fish, etc) .Each recipe also has properties or characteristics which are called attributes. Each recipe contains the following attributes: a name, description, number of reviewers, ratings, ingredients, directions, prep time, cook time and total time. I will use these attributes in different areas of my computer program to generate several types of output including a user menu, a list of recipes and then based on the user’s selection the recipe’s ingredients and directions.

Photo by Lily Banse on Unsplash

Requirements:

Normally a user searches for an online recipe based on a food type i.e. beef, seafood, pasta etc. A search engine returns numerous websites and the user would select a website and search for recipes on that particular site. The user picks a recipe that looks delicious based on pictures, a description, ratings and perhaps by even reading a review or two. After finding that mouth watering recipe and waiting for the images and recipe to load (thanks to banners, pop ups and other annoying distractions that impact load time) the user clicks on the recipe and directions only to find out that she/he does not have the required amount of time to prepare the recipe! Even worse the user has the time but does not have all of the ingredients for the recipe! This CLI will eliminate those problems by providing the user with the necessary information early in the search and selection process for that tasty meal!

The Program:

The user will select a recipe category

In this example number 3 was entered in the main menu which returned a list of seafood recipes. Note that the much of the pertinent information was written in to an easy to read table.

The user then has the option to select a recipe. In this case Seafood Au Gratin option 1 which generates a brief description of the recipe as well as ingredients and instructions.

The user then has the ability to view additional recipes within that category in this case seafood, go back to the main menu to select recipes in another category say Vegan or exit the program.

The next phase in developing this program as time permits is to allow the user to continue scraping data within the same category and append to the data already scraped as there are several hundred recipes for each food category. The goal is to not scrape the same data twice so additional logic would have to be developed as the user may choose to navigate back and forth between food categories (beyond the first page of a food category) and the program must be able to account for that.

--

--