Unit# 9: Computer Program Development

Slides:



Advertisements
Similar presentations
ALGORITHMS AND FLOWCHARTS
Advertisements

CS 240 Computer Programming 1
PROBLEM SOLVING TECHNIQUES
Reference :Understanding Computers
INTRODUCTION TO PROGRAMMING
ITEC113 Algorithms and Programming Techniques
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 3 Planning Your Solution
The Program Design Phases
PRE-PROGRAMMING PHASE
Algorithm & Flowchart.
Fundamentals of C programming
ALGORITHMS AND FLOWCHARTS
Simple Program Design Third Edition A Step-by-Step Approach
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Programming Concepts Chapter 3.
Software Life Cycle What Requirements Gathering, Problem definition
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
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 AND FLOWCHARTS CSCI 105 – Computer Fluency.
Algorithms & Flowchart
ITEC113 Algorithms and Programming Techniques
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Structured Programming (4 Credits)
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Program Program is a collection of instructions that will perform some task.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
 Problem Analysis  Coding  Debugging  Testing.
Learning outcomes 5 Developing Code – Using Flowcharts
ALGORITHMS AND FLOWCHARTS
Flow Charts Basic Flow Chart Symbols Few sample flowcharts Rules
Programming Languages
Unit 3: ALGORITHMS AND FLOWCHARTS
Computer Programming.
GC211Data Structure Lecture2 Sara Alhajjam.
Chapter 2- Visual Basic Schneider
ALGORITHMS AND FLOWCHARTS
COVERED BASICS ABOUT ALGORITHMS AND FLOWCHARTS
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.
Lecture 2 Introduction to Programming
Introduction To Flowcharting
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Introduction to Computer Programming
Programming Fundamentals
ALGORITHMS AND FLOWCHARTS
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Chapter 1 Introduction(1.1)
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Understanding Problems and how to Solve them by using Computers
How Are Algorithms Developed?
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Flowcharts and Pseudo Code
Introduction to Programming
Developing a Program.
Basic Concepts of Algorithm
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Introduction to Programming
Presentation transcript:

Unit# 9: Computer Program Development

Learning Objectives In this unit you will be learn about: Algorithm Problem solving tools & techniques (pseudo code, flowchart) Qualities of a good program Program life cycle

Algorithm Refers to the logic of a program and a step-by-step description of how to arrive at the solution of a given problem In order to qualify as an algorithm, a sequence of instructions must have following characteristics: Each and every instruction should be precise and clear Each instruction should be such that it can be performed in a finite time One or more instructions should not be repeated infinitely. This ensures that the algorithm will ultimately terminate After performing the instructions, that is after the algorithm terminates, the desired results must be obtained

Sample Algorithm (Example) There are 50 students in a class who appeared in their final examination. Their mark sheets have been given to you. The division column of the mark sheet contains the division (FIRST, SECOND, THIRD or FAIL) obtained by the student. Write an algorithm to calculate and print the total number of students who passed in FIRST division.

Sample Algorithm (Example) Step 1: Initialize Total_First_Division and Total_Marksheets_Checked to zero. Step 2: Take the mark sheet of the next student. Step 3: Check the division column of the mark sheet to see if it is FIRST, if no, go to Step 5. Step 4: Add 1 to Total_First_Division. Step 5: Add 1 to Total_Marksheets_Checked. Step 6: Is Total_Marksheets_Checked = 50, if no, go to Step 2. Step 7: Print Total_First_Division. Step 8: Stop.

Algorithm Example To calculate Average of three numbers: Algorithm: STEP 1     START STEP 2     INPUT X,Y,Z STEP 3     COMPUTE SUM = X + Y + Z STEP 4     COMPUTE AVG = SUM/3 STEP 5     PRINT SUM STEP 6     PRINT AVG STEP 7     END

Flowchart Flowchart is a pictorial representation of an algorithm Uses symbols (boxes of different shapes) that have standardized meanings to denote different types of instructions Actual instructions are written within the boxes Boxes are connected by solid lines having arrow marks to indicate the exact sequence in which the instructions are to be executed Process of drawing a flowchart for an algorithm is called flowcharting

Basic Flowchart Symbols

Examples of Decision Symbol

Examples of Decision Symbol

Sample Flowchart (Example) Flowchart diagram to display pass or fail a student

Flowcharting Rules First chart the main line of logic, then incorporate detail Maintain a consistent level of detail for a given flowchart Do not chart every detail of the program. A reader who is interested in greater details can refer to the program itself Words in the flowchart symbols should be common statements and easy to understand

Flowcharting Rules Be consistent in using names and variables in the flowchart Go from left to right and top to bottom in constructing flowcharts Keep the flowchart as simple as possible. Crossing of flow lines should be avoided as far as practicable If a new flowcharting page is needed, it is recommended that the flowchart be broken at an input or output point. Properly labeled connectors should be used to link the portions of the flowchart on different pages

Advantages of Flowchart Better Communication Proper program documentation Efficient coding Systematic debugging Systematic testing

Pseudocode A program planning tool where program logic is written in an ordinary natural language using a structure that resembles computer instructions “ Pseudo” means imitation or false and “ Code” refers to the instructions written in a programming language. Hence, pseudocode is an imitation of actual computer instructions Because it emphasizes the design of the program, pseudocode is also called Program Design Language (PDL)

Basic Logic (Control) Structures Any program logic can be expressed by using only following three simple logic structures: 1. Sequence logic 2. Selection logic 3. Iteration (or looping) logic Programs structured by using only these three logic structures are called structured programs, and the technique of writing such programs is known as structured programming

Sequence Logic

Selection Logic Also known as decision logic, it is used for making decisions Three popularly used selection logic structures are 1. IF…THEN…ELSE 2. IF…THEN 3. CASE

Selection Logic (IF…THEN…ELSE Structure)

Selection Logic (IF…THEN Structure)

Selection Logic (CASE Structure)

Iteration (or Loping) Logic Used to produce loops in program logic when one or more instructions may be executed several times depending on some conditions Two popularly used iteration logic structures are 1. DO…WHILE 2. REPEAT…UNTIL

Iteration (or Looping) Logic (DO…WHILE Structure)

Iteration (or Looping) Logic (REPEAT…UNTIL Structure)

Advantages of Pseudocode Converting a pseudocode to a programming language is much more easier than converting a flowchart to a programming language As compared to a flowchart, it is easier to modify the pseudocode of a program logic when program modifications are necessary Writing of pseudocode involves much less time and effort than drawing an equivalent flowchart as it has only a few rules to follow

Qualities of a good program A good computer program should have following qualities: Portability: Portability refers to the ability of an application to run on different platforms (operating systems) with or without minimal changes. Readability: The program should be written in such a way that it makes other programmers or users to follow the logic of the program without much effort. Efficiency: Every program requires certain processing time and memory to process the instructions and data. As the processing power and memory are the most precious resources of a computer, a program should be laid out in such a manner that it utilizes the least amount of memory and processing time.

Qualities of a good program Structural: To develop a program, the task must be broken down into a number of subtasks. These subtasks are developed independently, and each subtask is able to perform the assigned job without the help of any other subtask. Flexibility: A program should be flexible enough to handle most of the changes without having to rewrite the entire program. Generality: Apart from flexibility, the program should also be general. Generality means that if a program is developed for a particular task, then it should also be used for all similar tasks of the same domain. Documentation: Documentation is one of the most important components of an application development. A well-documented application is also useful for other programmers because even in the absence of the author, they can understand it.

Program life cycle When we want to develop a program using any programming language, we follow a sequence of steps. These steps are called phases in program development. The program development life cycle is a set of steps or phases that are used to develop a program in any programming language. Main phases are: Problem Definition Problem Analysis Algorithm Development Coding & Documentation Testing & Debugging Maintenance

Program life cycle

Program life cycle Problem Definition: Define the problem statement and decide the boundaries of the problem. Needs to understand the problem statement, what is requirement, what should be the output of the problem solution.

Program life cycle Problem Analysis: Determine the requirements like variables, functions, etc. to solve the problem. That means we gather the required resources to solve the problem defined in the problem definition phase Algorithm Development: Develop a step by step procedure to solve the problem using the specification given in the previous phase Very important phase for program development. That means we write the solution in step by step statements.

Program life cycle Coding & Documentation: This phase uses a programming language to write or implement actual programming instructions for the steps defined in the previous phase. Testing & Debugging: In this phase we test the program whether it is solving the problem for various input data values or not. We also test that whether it is providing the desired output or not. Maintenance: If the user encounters any problem or wants any enhancement, then we need to repeat all the phases from the starting, so that the encountered problem is solved or enhancement is added.