The Program Design Phases

Slides:



Advertisements
Similar presentations
How Are Algorithms Developed?
Advertisements

PSEUDOCODE & FLOW CHART
Flow Control Analysis & Design Tool: Flowcharts
UNIT 2. Introduction to Computer Programming
Chapter 1 - An Introduction to Computers and Problem Solving
Flow Control if, while, do-while Juan Marquez (03_flow_control.ppt)
Introduction to Programming
Chapter 2 - Problem Solving
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Reference :Understanding Computers
ME 142 Engineering Computation I Fundamentals of Procedural Computer Programming.
Chapter 2 - Problem Solving
زبانهای برنامه سازی برنامه سازی پیشرفته ارائه دهنده دکتر سيد امين حسيني E.mail: Home page:
Fundamentals of Algorithms MCS - 2 Lecture # 4
Flowcharts.
ITEC113 Algorithms and Programming Techniques
Chapter 2- Visual Basic Schneider
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
Fundamentals of C programming
CSC103: Introduction to Computer and Programming
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
CPS 120: Introduction to Computer Science
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 IPC144 Session 4 Flowcharts. 2 Objectives: By the end of this session, the student will be able to: List the three elements of the Structure Theorem.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Software Life Cycle What Requirements Gathering, Problem definition
ENGR-25_Programming-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Registered Electrical.
Flowcharts.
Chapter Two Creating a First Project in Visual Basic.
Visual Basic Programming
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
Algorithms & Flowchart
ITEC113 Algorithms and Programming Techniques
Program Planning and Design. What is Program Planning and Design? Program planning and design is simply knowing what you want to do and how you want to.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
IPC144 Session 4 Flowcharts 1. Objectives: By the end of this session, the student will be able to: List the three elements of the Structure Theorem Identify.
FLOWCHARTING AND ALGORITHMS
ICS124 Session 9 Flowcharting 1. By the end of this section the student will be able to:  Name the three structures of the Structure Theorem  Identify.
IPC144 Session 4 Flowcharts 1. Objectives: By the end of this session, the student will be able to: List the three elements of the Structure Theorem Identify.
CPS120: Introduction to Computer Science Session 5.
 Problem Analysis  Coding  Debugging  Testing.
Algorithms and Flowcharts
Pseudocode (pronounced SOO-doh-kohd)  is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled.
Flow Charts Basic Flow Chart Symbols Few sample flowcharts Rules
Chapter 2- Visual Basic Schneider
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Introduction to Computer Programming
Microsoft Visual Basic 2005 BASICS
Unit# 9: Computer Program Development
Structured Program
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
How Are Algorithms Developed?
Basic Concepts of Algorithm
Programming Logic and Design Eighth Edition
Presentation transcript:

The Program Design Phases Propose and evaluate solutions Determine the most efficient solution Develop and represent the algorithm Test and validate the solution Define the problem

Programs are Solutions to Problems Programmers can represent their solutions in several ways : Structure Charts Pseudocode Flowcharts These are the tools used in structured programming

Structured Programming Structured program languages lend themselves to flowcharts, structure charts, and pseudocode. Structured programming languages work best where the instructions have been broken up into small, manageable parts (procedures/modules).

Pseudocode This device is not visual but is considered a “first draft” of the actual program. Pseudocode is written in the programmer’s native language and concentrates on the logic in a program — not the syntax of a programming language.

Flowcharts A flowchart is a pictorial representation of all the steps in a process. ( A picture is worth a 1000 words ) There are Block flowcharts, System flowcharts, Procedure flowcharts and Program flowcharts

PROGRAM FLOWCHARTS These represent the flow of logic in a program and help programmers “see” program design. They are also sometimes called logic flowcharts. Flow charts are drawn in the design phase of programming. A flowchart is comprised of specialised symbols and flow lines. Each symbol contains information about what must be done at that point; and the arrow shows the flow of execution.

PROGRAM FLOWCHARTS cont’d … show the step by step sequence of operations carried out by a computer program the start and end of the program the input and output operations how the data is processed the main sections of the program Program flowcharts should be sufficiently detailed for the program code to be written directly from it, making it, therefore, just like pseudocode

PROGRAM FLOWCHARTS cont’d The most common flowchart symbols are :

PROGRAM FLOWCHARTS cont’d The start / end symbol Each flowchart must begin and end with the terminator symbol. The word START or END is written inside the oval

PROGRAM FLOWCHARTS cont’d START END

PROGRAM FLOWCHARTS cont’d The process symbol This indicates an operation such as a calculation Details are written in the rectangle and should begin with a verb

PROGRAM FLOWCHARTS cont’d Add number to subtotal

PROGRAM FLOWCHARTS cont’d The input / output symbol This marks the point at which we get data or give results. The input or output is written inside the parallelogram.

PROGRAM FLOWCHARTS cont’d Input name

PROGRAM FLOWCHARTS cont’d The decision symbol This is used where a decision has to be made in selecting the subsequent path to be followed. Note that while there is only one entry point to the diamond there are at least 2 exits

PROGRAM FLOWCHARTS cont’d Even number ? Yes No

PROGRAM FLOWCHARTS cont’d The pre-defined process symbol This is used to represent a process which is broken down elsewhere

PROGRAM FLOWCHARTS cont’d Sort Marks

PROGRAM FLOWCHARTS cont’d The connector symbols Connector Off-page connector These are used to break and continue links without crisscrossing lines all over the place. So they link with another part of the program or another page.

PROGRAM FLOWCHARTS cont’d B A A B

Drawing Flow Charts Organize the flowchart in modules Use standard symbols only, you can vary the size but not the shape Try to keep the logic as flowing from top to bottom and from left to right Do not cross flow lines Use a template if possible Add notes if necessary for clarity but not not clutter

PROGRAM FLOWCHARTS cont’d Combining symbols Sequence of steps START Step 1 Step 2 Step 3 END

PROGRAM FLOWCHARTS cont’d Combining symbols Decision (if statement) n = sum + grade N > 50? Yes No Give certificate END

PROGRAM FLOWCHARTS cont’d Combining symbols Loops WHILE loop ( loops involve a) decisions and branching {if statements} b) Returning to previous statements ) n = n + 1 N < 50? False True < an action > < action continuing program >

PROGRAM FLOWCHARTS cont’d Combining symbols Loops REPEAT loop In a REPEAT loop the action takes place before the first check n = n + 1 < an action > N < 50? False < action continuing program > True

CASH REGISTER PROGRAM Start Sum = 0 Input price Sum = sum + price More items? Tax = sum x 0.15 Output sum, tax, End No Yes CASH REGISTER PROGRAM

Common Flowchart Symbols Terminator. Shows the starting and ending points of the program. A terminator has flow lines in only one direction, either in (a stop node) or out (a start node). Data Input or Output. Allows the user to input data and results to be displayed. Processing. Indicates an operation performed by the computer, such as a variable assignment or mathematical operation. Decision. The diamond indicates a decision structure. A diamond always has two Flow lines out. One flow line out is labeled the “yes” branch and the other is labeled the “no” branch. Predefined Process. One statement denotes a group of previously defined statements. For instance, “Calculate m!” indicates that the program executes the necessary commands to compute m factorial. Connector. Connectors avoid crossing flow lines, making the flowchart easier to read. Connectors indicate where flow lines are connected. Connectors come in pairs, one with a flow line in and the other with a flow line out. Off-page connector. Even fairly small programs can have flowcharts that extend several pages. The off-page connector indicates the continuation of the flowchart on another page. Just like connectors, off-page connectors come in pairs. Flow line. Flow lines connect the flowchart symbols and show the sequence of operations during the program execution. Common Flowchart Symbols

FYI : Other Symbols - - - - - - annotation / notes tape disk display document

Benefits of Flowcharts Communication : a better way of communicating because they are visual Effective analysis : the visual nature allows quick grasp of program logic Aids in technical documentation Good guide when it is time to code Good aid when program maintenance becomes necessary

Draw Backs of Flowcharts When programs are large or complex, the chart becomes too complicated If alterations are required, the entire chart may have to be re-drawn Because of this, the use of program flowcharts is actually in decline