Pre-IB computer Science

Reflection of Nov.4th: Flowchart

Flowchart

Flowchart, as one of the expressions of algorithm(absolutely not the algorithm, but the expressions of it instead!), is introduced in the recent three classes.

As mentioned, a flowchart is a type of diagram that represents an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution model to a given problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.            ( https://en.wikipedia.org/wiki/Flowchart)

(example of the flowchart)

We can discovered that there are several different shapes used in the flowchart instance shown above. This picture has actually been used in the previous reflection, simply as the illustration. However, there are some symbols that should have been focused. So, what are they?

Flowchart Symbols

Generally, flowcharts flow from top to bottom and left to right.

(Terminal)

Indicates the beginning and ending of a program or sub-process. Represented as a stadium, oval or rounded (fillet) rectangle. They usually contain the word “Start” or “End”, or another phrase signaling the start or end of a process, such as “submit inquiry” or “receive product”.

(process)

Represents a set of operations that changes value, form, or location of data. Represented as a rectangle.

(decision/selection)

Shows a conditional operation that determines which one of the two paths the program will take. The operation is commonly a yes/no question or true/false test. Represented as a diamond (rhombus). (There must be ONE INPUT and TWO OUTPUT as a correct decision symbol!)

 

(input/output)

Indicates the process of inputting and outputting data, as in entering data or displaying results. Represented as a parallelogram (I never know how to spell that until just now. This might be the value of writing this reflection! It’s really useful!).

 

(arrowhead)

Shows the process’ order of operation. A line coming from one symbol and pointing at another. Arrowheads are added if the flow is not the standard top-to-bottom, left-to right.

For the symbols mentioned above, except for the dimond shape and the terminal shape, all the shapes have to have two arrowheads: one input and one output. For the start and end – the terminal shape – they need to have one arrowhead from different directions respectively, to make them be the real “start” and “end”. For the dimond shape, three related arrowheads are required to be touched with, one input and two outputs.

IF, IF-ELSE, IF-ELSE-IF, Nested IF, and Looping (While and Do-While)

IF statement

If statement is used for branching when a single condition is to be checked.

( to print the square of a number if it is less than 10.)

This is an example of using if statement. A number is asked from user and stored in variable n. If the value of is less than 10, then its square is printed on the screen. If the condition is false the program, execution is terminated.

IF-ELSE

The if statement may have an optional else block. The syntax of if..else

How if…else statement works?

If test expression is evaluated to true,

  • statement(s) inside the body of if statement is executed
  • statement(s) inside the body of else statement is skipped from execution.

If test expression is evaluated to false,

  • statement(s) inside the body of else statement is executed
  • statement(s) inside the body of if statement is skipped.

(Example of the IF-ELSE statement)

IF-ELSE-IF

The if...else statement executes two different codes depending upon whether the test expression is true or false. Sometimes, a choice has to be made from more than 2 possibilities.

The if…else ladder allows you to check for multiple test expressions and execute different statement(s).

(IF-ELSE-IF example)

Nested IF

It is possible to include if...else statement(s) inside the body of another if...elsestatement.

If the dimond shape is after the “true” alternative of the last dimond shape, then the statement if “Nested IF”.

(Example of the Nested IF statement)

Loop

Generation of for loops in flowchart code. If an action or decision node has an exit transition with a guard as well as a second exit transition, and there is also a transition that brings the flow back to the original decision point, we can have  a for loop rather than a while loop by carrying out the following steps. The repeat loop will always execute the process part at least once.

(loop flowchart)

Flowchart activities/homework

We decided to do a group project to solve the real life problem about “whether you are rational or emotional”. This is a psychological test with several algorithm. Through the process, we can test a person’s certain characteristic.

 

All in all, flowchart is very vivid and clear. It have close relationship with the psedecode, so it is very logical as well. This is a good tool when we want to solve a problem, whether in real life or computer science.


References

SEVOCAB: Software Systems Engineering Vocabulary. Term: Flow chart. Retrieved 31 July 2008.

Frank Bunker Gilbreth, Lillian Moller Gilbreth (1921) Process Charts. American Society of Mechanical Engineers.

Jump up^ Graham, Jr., Ben S. (10 June 1996). “People come first”Keynote Address at Workflow Canada.

Jump up^ American Society of Mechanical Engineers (1947) ASME standard; operation and flow process charts. New York, 1947. (online version)

Jump up^ Hartree, Douglas (1949). Calculating Instruments and Machines. The University of Illinois Press. p. 112.

Jump up^ Bashe, Charles (1986). IBM’s Early Computers. The MIT Press. p. 327.

Jump up^ Goldstine, Herman (1972). The Computer from Pascal to Von Neumann. Princeton University Press. pp. 266–267. ISBN 0-691-08104-2.

Jump up^ Taub, Abraham (1963). John von Neumann Collected Works5. Macmillan. pp. 80–151.

Jump up^ Bohl, Rynn: “Tools for Structured and Object-Oriented Design”, Prentice Hall, 2007.

Jump up to:a b Alan B. Sterneckert (2003) Critical Incident Managementp. 126

Jump up^ Andrew Veronis (1978) Microprocessors: Design and Applicationsp. 111

Jump up^ Marilyn Bohl (1978) A Guide for Programmers. p. 65.

Jump up^ Mark A. Fryman (2001) Quality and Process Improvementp. 169.

Jump up to:a b c d e f g h i j k l m

Pre-IB computer Science

第一篇博文

这是您的第一篇文章。点击“编辑”链接修改或删除该文章,或者开始撰写新文章。如果您愿意,可以通过这篇文章告诉读者您创建此博客的原因以及您打算使用它做些什么。如需帮助,欢迎您前往支持论坛提问。