In this video you will learn about using programming organizational techniques and logic components.
Three techniques you can use to organize a program are: pseudocode, flowcharting, and sequencing. Each technique is discussed in the following sections.
Pseudocode Concepts
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a normal programming language, but is intended for human reading rather than machine reading. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code. Think of it as an outline or rough draft for your program. Here’s a simple example of pseudocode:
The purpose of pseudocode is so that you can help make sure that both programmers and non-programmers agree about what the program’s goal and the basics of how the task should be done. Here’s an example of a refined pseudocode example after you have consulted with other programmers and managers:
The wikiHow page How to Write Pseudocode teaches you how to create a pseudocode document for your computer program.
Flowchart Concepts
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task. There are many visual diagramming products available to help you visualize your program. Here are some of the traditional flowchart shapes used for programming concepts:
Sequence Diagram
A sequence diagram, in the context of Unified Modeling Language (UML), represents object collaboration and is used to define event sequences between objects for a certain outcome. A sequence diagram is an essential component used in processes related to analysis, design and documentation.
A sequence diagram can be drawn using visual diagramming software like Visio. Creating a sequence diagram from source code can be useful when discussing a program with non-programmers. Some apps can also convert a diagram into source code.
Branching and looping are the two major types of logic used in programming.
Branching
Branching involves choosing between options based on one or more variables.
Looping
To enable code to run as many times as needed until a condition is no longer true, you can use a technique called looping. In Java, there are three types of looping: While, For, and Do…While. Other languages have similar looping logic.
While Loop
In a while loop, the condition is checked at the beginning of the loop. A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition.
For Loop
In a For Loop, the loop starts with the original value and then stops when the termination value is reached, using an increment specified in the loop.
Do…While
A Do…While loop is similar to a While loop except that the test is performed at the bottom of the loop instead of at the top.