programming process and flowchart

34
Programming Process and Flowchart Prepared by: Mr. Richard R. Basilio BSECE –T Dip IC

Upload: hermiraguilar

Post on 29-Nov-2014

3.940 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Programming process and flowchart

Programming Process and Flowchart

Prepared by:Mr. Richard R. BasilioBSECE –T Dip IC

Page 2: Programming process and flowchart

Programming Process

Page 3: Programming process and flowchart

Programming Process

The programmer’s job can be broken down into six programming steps:1. Understand the problem

2. Plan the logic

3. Code the program

4. Translate the program into machine language

5. Test the program

6. Put the program into production

Page 4: Programming process and flowchart

Understand the Problem

Programmers must first understand what it is the user wants

To understand the problem, you must analyze it Really understanding the problem may be one of

the most difficult aspects of programming The description of what the user needs may be vague The user may not even really know what he or she

wants Users who think they know what they want frequently

change their minds after seeing sample output

Page 5: Programming process and flowchart

Plan the Logic

Programmer plans the steps to the program, deciding what steps to include and how to order them

ExamplePlanning tourPlanning party

The two most common tools flowcharts : pictorial representationPseudocode : English-like representation

Page 6: Programming process and flowchart

Plan the Logic

FlowchartsA pictorial representation

of the logical steps it takes to solve a problem.Uses Standardized Symbols

Utilize Formula Notation

Typically Read from Top to Bottom or from Left to Right on a Page

start

getInputNumber

calculatedAnswer =InputNumber * 2

printcalculatedAnswer

stop

Page 7: Programming process and flowchart

Plan the Logic

PseudocodeAn English-like representation of the logical

steps it takes to solve a problempseudo – a prefix that means false

Short English-Like Statements

Not Standardized

Proper use of indentationExamplestart

get InputNumber compute calculatedAnswer as InputNumber times 2 print calculatedAnswerstop

Page 8: Programming process and flowchart

Code the program

Writing the program in one of more than 400 programming languagesPascal, Assembly Language, C, C++, Java…..

Concentrate on the syntax of the languageExact instruction, symbol, …. ?

Some very experienced programmers successfully combining the logic planning and

the actual instruction writing, or coding of the program, in one step

Writing a cinema scenario

Page 9: Programming process and flowchart

Translate the Program

ObjectiveEach computer knows only one language,

Machine Language.

High-level Languages must be translated into Machine Language

Need to compiler or interpreterCompiler catches every syntax error.When writing a program, a programmer might

need to recompile the code several timesAn executable program is created only when the

code is free of syntax errors

Page 10: Programming process and flowchart

Test the Program

Why does it need to be tested ?Syntax Errors : by compile

Logical Errors : by testTest

Executing the program with some sample data Seeing whether or not the results are logically correct.being tested with many sets of data carefully

Examplestart get InputNumber compute calculatedAnswer as InputNumber times 20 print calculatedAnswerstop

Logically incorrect

Page 11: Programming process and flowchart

Put the program into the production

Once the program is tested adequately, it is ready for the organization to use.

Putting the program into production might mean simply running the program once if it was written to satisfy a user’s request for a special list.

Page 12: Programming process and flowchart

Flowchart

Page 13: Programming process and flowchart

What is Flowchart…?

By wikipedia definition:“A flowchart is a schematic

representation of an algorithm or a stepwise process, showing the steps as boxes of various kinds, and their order by connecting these with arrows.”

“Flowcharts are used in designing or documenting a process or program.”

Page 14: Programming process and flowchart

Basic Flowchart Symbol

Process(Rectangle)

Start/Stop(Terminator)

Input/Output(Parallelogram)

Decision(Diamond)

Connector(Circle)

Flowlines(Arrows)

Predefined Process(Rectangle)

Page 15: Programming process and flowchart

Basic Flowchart Symbol

Input/OutputGeneralised

Input/Output Block; reading data from an input medium or writing data to an output medium. This block should be used in situation were data is being sent in and out of the processor via some sort of I/O peripheral.

Input/Output(Parallelogram)

Page 16: Programming process and flowchart

Basic Flowchart Symbol

ProcessAny process step;

an operation or group of operations that cause a change in value, form or location of the data. This can consist of arithmetic or logical operators or even move commands.

Process(Rectangle)

Page 17: Programming process and flowchart

Basic Flowchart Symbol

Flow lineSequence of

operations and direction of data flow; arrowheads are required if linkage is not left-to-right or top-to-bottom. Generally arrowheads are included to avoid confusion.

Flowlines(Arrows)

Page 18: Programming process and flowchart

Basic Flowchart Symbol

AnnotationAdditional

explanation or comments. This block is used for providing additional information to any other block in the flowchart.

Page 19: Programming process and flowchart

Basic Flowchart Symbol

DecisionDecision-making

or switching type of operation, usually based on a comparison, that determines which of a number of paths should be followed.

Decision(Diamond)

Page 20: Programming process and flowchart

Basic Flowchart Symbol

Predefined ProcessOne or more

operation defined in more detail elsewhere, such as in a booklet or on a different flowchart, but not on another part of the flowchart in which this symbol appears.

Predefined Process(Rectangle)

Page 21: Programming process and flowchart

Basic Flowchart Symbol

TerminalTerminal point in a

flowchart – stop, start or break in the line of flow.

Start/Stop(Terminator)

Page 22: Programming process and flowchart

Basic Flowchart Symbol

ConnectorsEntry to or exit

from another part of the flowchart; if to or from step is on another page then the page reference should also be stated.

Connector(Circle)

Page 23: Programming process and flowchart

Other flowchart symbols…

Page 24: Programming process and flowchart

Other flowchart symbols…

Page 25: Programming process and flowchart

Important techniques for developing flowcharts include:

Use a standardized flowcharting template, with clearly recognizable symbols. Follow ANSI recommendations for symbol use.

Do not crowd or clutter the flowchart, ensure proper spacing between symbols.

Number the pages of your flowchart sequentially. Specifically the title of program, the date and the author on each separate page.

Page 26: Programming process and flowchart

Important techniques for developing flowcharts include:

Chart the main line of data flow in the system or program first, then incorporate detail in later flowchart.

Write within symbols avoid using too many words. If necessary use the annotation symbol.

Choose wording to suit the anticipated readers of the flowchart.

Page 27: Programming process and flowchart

Important techniques for developing flowcharts include:

Be legible, neatness counts. If flowchart becomes complex use

connector symbols to reduce the number of flow lines.

Collect incoming and outgoing flow lines so that the number of lines entering or leaving a symbol are minimized.

Page 28: Programming process and flowchart

Important techniques for developing flowcharts include:

Use the flowchart as a guide when coding; change it when necessary to ensure the flowchart reflects the steps implemented in the code.

Cross-reference portion of the flowchart to the source language code.

Be consistent with the level of detail shown in the flowchart. Do not chart every detail, but do not leave out important details.

Page 29: Programming process and flowchart

Important techniques for developing flowcharts include:

Put yourself in the position of the reader; try to anticipate the reader’s problems in understanding the flowchart.

Page 30: Programming process and flowchart

Basic Flowchart Structure

SequenceIf-then-else (Selection)While (Repetition)

Page 31: Programming process and flowchart

Basic Flowchart Structure

The SEQUENCE process is just a series of processes carried out one after the another.

Most programs are represented at the highest level by the sequence , possible with a loop from end back to the beginning.

exit

entrance

Page 32: Programming process and flowchart

Basic Flowchart Structure

The If-THEN-ELSE process logically completes the binary decision block by providing two separate processes.

One of the processes will be carried out in the each path from the binary decision.

This is also called SELECTION.

entrance

exit

Page 33: Programming process and flowchart

Basic Flowchart Structure

The WHILE process is allow for the representation of a conditional loop structure within a program.

The decision to execute the process is the loop is made prior to the execution of the process.

This is also called REPETITION.

entrance

exit

Page 34: Programming process and flowchart

END OF FILE