Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
It's really easy for people to get stuck. They want to write a program and they start off looking at a blank text file and they're thinking so much about syntax and case sensitivity and curly braces and all the thousand other things to remember, that it is very easy to now, actually know, how do I start typing? Well, step one is don't. Step one is instead get away from the computer, grab a piece of paper or find a whiteboard and start writing what's called pseudocode instead. Now pseudocode is not a language.
It's the term for writing your computer instructions in plain English to the point where it's readable by anyone who understands the problem, whether they come program or not. Let me show you a few examples. On a whiteboard or paper I might just write something like this. Ask user for email address. If email address matches accepted pattern, add them to email list, else show error message. Something like this. Pseudocode doesn't have formal rules, but this would be quite common to see.
Now where I'd said, ask user for email address, I could've said get email address or prompt for email address or if I really wanted to break it out I could even say create email variable, ask user for email address, store user's email address in email variable. Now that would be a little long. Or I could just say get email. I'm just trying to define the structure of this code, what has to happen in my problem. Now it's quite common to see programming keywords like if and else and while and for, but it's whatever makes sense. And you'll also see pseudocode often indented like I've done here, and like any indentation it just makes it easier to follow the structure.
Can you read the pseudocode? Does it make sense? Here's an example perhaps of going through a whole list of numbers and adding them together. We start off with set total to zero, get a list of numbers, loop through each number in the list, and add each number to total, remark where the loop ends. If number more than zero, print its positive message, else print its zero or last message, end if. It's the kind of thing that should make sense whether you can program or not. Now if you start worrying about pseudocode syntax, it's kind of missing the point.
The whole point of this is to get away from that, where you don't have to worry about braces, parentheses, brackets, off by one errors, naming conventions. It's whatever seems natural. Now it doesn't necessarily break down perfectly to one line of pseudocode, one line of real code. Sometimes one line of pseudocode like send email can cause several lines of real code. One of the best things about pseudocode is it lets you think about your problem without necessarily knowing exactly how to code it and it exposes where you need to go and learn something. Because I can describe a problem in pseudocode without having the necessary knowledge in that language.
Let's say I'm trying to build a game and I know how to work with images. I've been programming some of it already. So I might write some pseudocode code like this. If a missile-image touches the spaceship -image, well, I'm going to replace this spaceship-image with the explosion-image. I want to play an explosion sound and then I better check, is the remaining-lives counter zero? Because if it is, they don't have any lives left, so I'll show the "game over" message. But if it's not zero, I'll subtract one from their remaining lives.
I'll show begin message, I'll reset the spaceship to the starting position, etcetera, etcetera. Now I'm not saying this is necessarily the perfect pseudocode for a game, but we're following the steps here. But let's say I don't know how to play a sound in the language that I'm working with. It doesn't matter. I can still build my pseudocode. I can still write this problem out, because I know that sound has to happen. I can just put it on my personal task list for something to look up and find out how. I just write down "research how to play short sound effect." Go and figure that out and later I can come back and code this.
So pseudocode is not just for beginners. Many very experienced software developers I know still work out a lot of their problems in pseudocode as a way of better understanding it without worrying about syntax, and it's a great habit to get into to start sketching out your programming ideas in plain English before you write code.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97517 Viewers
61 Video lessons · 84757 Viewers
71 Video lessons · 68937 Viewers
56 Video lessons · 101383 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.