Kodables Lesson in Sequence – a Little break from SCRATCH
Flow Control Structures
In computer programming, flow control structures are the programmer’s means of influencing a computer program’s decision-making process and movements, ultimately altering the computer’s adventure. In programming, sequence is the first of three basic flow control structures.
Programming Flow Control Structures:
What is Sequence?
Sequence is the very first concept a student must understand when learning to code. Also known as order of events, a computer will execute commands exactly in the order or sequence they are written. As a programmer, it is important to make sure that the commands given to a computer are in the right sequence, otherwise a program might not run as expected.
Sequence in Programming:
When learning sequence, it is first important to understand how a computer reads and translates code. Remember the brilliant Choose Your Own Adventure series? Interestingly, a computer reads code the exact same way that we would read a Choose Your Own Adventure game book.
“If you elect to walk into the cave, turn to page 24. ! If you want to open the mysterious door, turn to page 77. If you choose to enter the forbidden wilderness, turn to page 90.”
A computer program translates code just as humans read written text: line- by-line, top to bottom, and left to right. However, when a computer interprets code, it is making a string of decisions that influence the flow of code, or the path that a program takes.
Like a reading a Choose Your Own Adventure game book, a computer program is constantly making decisions along its journey that send the computer backwards, forwards, and in circles. A programmer orchestrates all of these movements and decisions, ensuring the successful execution of the program.
Sequence and Algorithms
What is an Algorithm?
An algorithm is a sequence of logical instructions or steps needed to finish a task. An algorithm can be performed with or without a computer.
In programming, an algorithm is required in a sequence queue. Sequence is important in a computer algorithm because the correct order of steps is needed in order to make the algorithm work.
Coding an Algorithm: Pseudocode
Computers are not as smart as humans and need very specific instructions to perform a task. Providing instructions to a computer is completely different from giving the same instructions to another person.
Pseudocode is an informal method of writing an algorithm for a computer program using plain English. Primarily used for planning, pseudocode uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudocode serves as a middle step between human-speech and computer code, helping programmers translate written algorithms.
Terms and Definitions
- Sequence: Also known as the order of events, commands that are executed by a computer exactly as they are written. The sequence must be in the correct order for the program to run properly.
- Flow Control Structures: The programmer’s means of influencing a computer program’s decision-making process and movements. There are three flow control structures in programming: sequence, conditions, and loops.
- Command: A specific instruction given to a computer in written code from a programmer.
- Code: The language written by humans to communicate with computers to complete a process; programming language that gives instructions to a computer.
- Computer: A device for storing and processing information, responds to instructions in programming language that is written by humans.
- Computer Science: The study of computers.
- Internet: An electronic communications network that connects computer networks around the world.
- Program: A sequence of instructions written in a code that a computer can interpret and execute.
- Programmer: A person who writes code and communicates instructions to a computer.
- Robot: A device that sometimes resembles a human and can be programmed to carry out complex tasks.
- Algorithm: A sequence of logical instructions or steps needed to finish a task. Can be performed with or without a computer.
- Pseudocode: An informal method of writing an algorithm for a computer program using English and not code. Used for planning and is intended for humans to read it, not computers.
- Syntax: The spelling and grammar of a programming language.
- Bugs: Errors, or mistakes, in the syntax of a programming language.
- Debugging: The process of finding and fixing errors (bugs) in the syntax so the computer program will run properly.
- Technology: The use of science to solve problems and invent. A machine, piece of equipment, idea, or method that is carried out by human communicating with machines.