I have been studying about the evolution of computer programming languages lately. I thought it might be fun to make a flow chart that most programmers make for complex programs with many subroutines and apply it to something everyone(or almost everyone does) almost every week or sooner.
I thought I would do an informal flowchart for shopping for food and break it into three subroutines: checking the fridge for what we need, second driving our car to the market and three shopping for the food at the market. usually yes no answers are represent by zero or 1 on the binary level. depending upon the language yes is usually 1 and no is zero.
Theoretically, if we had our own robot we could program him, her or it to do this for us or do it ourselves.
informal flowchart for shopping for food
first subroutine checking fridge for what we need
walk to the fridge
open the door
do we need? milk yes or no
cheese yes or no
bread yes or no
eggs yes or no
butter yes or no
Let us presuppose the answers to all these questions are yes
second subroutine
Shall we go now to the market and buy these items? yes or no
shall we walk yes or no
shall we bike yes or no
shall we drive yes or no
Let us presuppose the first two answers were no and the last yes and that the answer to shall we go to the market now was yes
Third subroutine
driving to the market
open the front door? yes or no
walk down the steps? yes or no
walk to the car? yes or no
is there a garage? yes or no
If then no garage get in the car? yes or no
Is the car open yes or no
if no then get keys yes or no
put key in door yes or no
did car start yes or no
if yes then let it warm up a minute so engine lasts longer
If car started then is it a stick shift or automatic?
If automatic place foot on brake and put into reverse?
Look out rear window. is there traffic? yes or no
If traffic then wait until it clears.
If no traffic then proceed back a little
Then put into drive and move forward.
(to simplify) drive to market.
next subroutine (park)
next subroutine (get out and go into market)
next subroutine search market shelves for items
next subroutine buy items found
next subroutine push kart to car
next subroutine unload basket into car
next subroutine drive home and park
next subroutine get out and unload items out of car and into refrigerator.
As you can see this kind of flowchart would be constructed before writing a complex program in any language to make sure no step is left out. after writing the program the programmer would then debug the program. He or she would make sure the program not only didn't have any infinite loops that waste both time and energy and make sure it didn't stop unexpectedly and performed consistently doing what he or she wants it to do no matter how many thousands or millions of times the program is executed by the computer or robotic device.
To the best of my ability I write about my experience of the Universe Past, Present and Future
Top 10 Posts This Month
- Because of fighting in Ukraine and Israel Bombing Iran I thought I should share this EMP I wrote in 2011
- Historicity of Jesus-Wikipedia
- US intelligence officials make last-ditch effort to sound the alarm over foreign election interference
- Holiday Fire in Goleta: 19 structures destroyed: 80% contained: evacuations lifted
- CAVE FIRE EVACUATIONS TO BE LIFTED WEDNESDAY
- "There is nothing so good that no bad may come of it and nothing so bad that no good may come of it": Descartes
- most read articles from KYIV Post
- reprint of: Drones very small to large
- The ultra-lethal drones of the future | New York Post 2014 article
- Keri Russell pulls back the curtain on "The Diplomat" (season 2 filming now for Netflix)
No comments:
Post a Comment