Coding 2: Algorithms and Pseudocode

Algorithms and Pseudocode

Coding 2

Completing this lesson helps you to earn points in the Technical section of the judging rubric by...

  • Learning what algorithms are
  • Coding your first app in App Inventor or Thunkable

Key Terms

  • Algorithm  - step by step instructions that explain how to do something
  • Pseudocode -  writing out an algorithm in plain language, instead of in code

Algorithms

Most kids who grow up in North America love peanut butter and jelly sandwiches. Making one should be easy, just put peanut butter on one slice of bread and jelly on the other! Watch Johnna and Evan give their father, Josh, instructions to make a sandwich.

It you’re having trouble getting this videos to play, try loading this page in Google Chrome.

Josh is acting like a computer—he won’t do anything unless he is told to in simple step-by-step commands. A person would know that the instruction “spread some jelly on the bread” really means to open the jar of jelly, put your knife in, remove it, and use it to spread some  jelly on the bread. However, a computer would do what Josh did; it would just spread the whole jar of jelly on the bread and get confused!

Unlike humans, computers can’t infer, or make guesses, about anything! They can only do exactly what they are told. Johnna and Evan gave their father an algorithm to making a sandwich. An algorithm is a set of step-by-step instructions. In order to make a computer do something, you need to write an algorithm for it to understand.

In Technovation Girls, you will learn how to write algorithms to make a mobile app!

Mini-Activity: Grab a piece of paper and do this fun activity to mimic the way a computer thinks!

Write an algorithm to do an everyday activity. It could be riding a bike, making a sandwich, playing a game or anything else! When you are done, give your algorithm to a friend and have them do exactly as it says, just like Josh does in the video. Did things go as you expected?

Pseudocode

When you wrote out your instructions in the last activity, you were actually writing something called pseudocode. Pseudocode is writing out an algorithm in plain language, instead of in code. “Pseudo” means “fake”, so you can think of pseudocode as “fake code”. You can use pseudocode to plan out what you want your code to do. Throughout these lessons we will practice writing pseudocode for the activities, so that you can write your own when you code your app.

Activity: Talk to Me

Complete these tutorials. They will help you make your first app in App Inventor or Thunkable and they will help you understand the next section. Remember, this is your very first app so it is okay if you get stuck!

Reflection

Congratulations on making your first app! Here are some reflection questions for you to consider with your team and with your mentor.

  • What are some things from this lesson that you think will be useful in creating your app? Why do you think so?
  • Describe what makes the block language different from the language you are used to using in everyday life. Why must a programming language be created in this way?

Additional Resources

Advanced Talk to Me - Part II

Before moving on, let’s program some more! Can you take your Talk to Me app to the next level? Here are some ideas for you to try out!

  • Change the pitch of the voice in your speech to text component. Click on the ‘speech to text’ in the blocks side and look for the pitch property. You can give your voice a pitch of 0, 1 or 2.
  • Check this out to learn how: App Inventor TextToSpeech Information

More on Algorithms

Watch this video to learn more about what algorithms are.