programming process and flowchart
DESCRIPTION
TRANSCRIPT
Programming Process and Flowchart
Prepared by:Mr. Richard R. BasilioBSECE –T Dip IC
Programming Process
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
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
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
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
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
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
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
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
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.
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.”
Basic Flowchart Symbol
Process(Rectangle)
Start/Stop(Terminator)
Input/Output(Parallelogram)
Decision(Diamond)
Connector(Circle)
Flowlines(Arrows)
Predefined Process(Rectangle)
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)
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)
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)
Basic Flowchart Symbol
AnnotationAdditional
explanation or comments. This block is used for providing additional information to any other block in the 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)
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)
Basic Flowchart Symbol
TerminalTerminal point in a
flowchart – stop, start or break in the line of flow.
Start/Stop(Terminator)
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)
Other flowchart symbols…
Other flowchart symbols…
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.
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.
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.
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.
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.
Basic Flowchart Structure
SequenceIf-then-else (Selection)While (Repetition)
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
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
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
END OF FILE