Download presentation
1
Programming Lifecycle
Chapter 1 (Cont..) Programming Lifecycle CSC425 - Introduction To Computer Programming
2
OBJECTIVES Introduce the general step programmers go through to develop computer programs and software Explain the phases in the system development life cycle. CSC425 - Introduction To Computer Programming
3
Programming Life Cycle
D o c ume n t a I Problem Analysis Programs Modelling Coding Programs Testing and Debugging Maintenance CSC425 - Introduction To Computer Programming
4
Step 1 : Problem Analysis
Defining the problem Identify : 1. Input (given data) 2. Output (the result) 3. Process - relation between input and output - using formula Input Process Output CSC425 - Introduction To Computer Programming
5
Example Problem 1 Write a program that can input 3 integer number from user. Find the average for the number. Display all the numbers and the average Problem analysis Input : 3 numbers Process : 1. total up 3 numbers 2. Divide the number by 3 Output : 3 numbers and the average CSC425 - Introduction To Computer Programming
6
Step 2 : Programs Modeling
Planning the solution to a problem Using algorithm, flowchart or pseudocode [Refer Problem 1] 1. Set sum = 0, avg = 0 2. Read 3 integer number 3. Total up 3 integer number sum = a+b+c 4. Find the average avg = sum / 3 5. Display 3 integer number and average algorithm CSC425 - Introduction To Computer Programming
7
[Refer Problem 1] Pseudocode Flowchart start sum =0 , avg = 0 START
Read a, b, c sum = a+b+c avg = sum / 3 Display a,b,c Display avg End START INPUT a,b,c sum = a+b+c avg = sum / 3 PRINT a,b,c PRINT avg END Pseudocode Flowchart CSC425 - Introduction To Computer Programming
8
Step 3 : Coding and programs source code
Express solution in a programming language Translate the logic from the flowchart or pseudocode. There are many programming languages : BASIC, COBOL, Pascal, Fortran, C, C++, Java etc Each language has it’s own syntax (rules of language) CSC425 - Introduction To Computer Programming
9
[Refer problem 1] Coding in C++ Language Output of the program
CSC425 - Introduction To Computer Programming
10
Step 4 : Testing and Debugging
Trace error either syntax or logic error Testing running the program with a set of data Debugging Trace and fixed the error CSC425 - Introduction To Computer Programming
11
Occur during program execution Detected by compiler
Run-time error Occur during program execution Detected by compiler Occur because of logic error or memory leak Syntax error Error in the structure or spelling of a statement Detected by the compiler during compilation of the program Example: Missing semicolon, quote CSC425 - Introduction To Computer Programming
12
Produce undesired result/output Cannot be detected by compiler
Logic error Unexpected/unintentional errors resulted from flaw in the program’s logic Produce undesired result/output Cannot be detected by compiler Compare the result with manual process CSC425 - Introduction To Computer Programming
13
Documentation 1. Description of the program
An ongoing process Written detailed description of the program cycle and specific facts about the program Documentation materials include : 1. Description of the program 2. Logic tools : flowcharts, pseudocode 3. Data- record descriptions 4. Program listing 5. Testing results 6. Comments CSC425 - Introduction To Computer Programming
14
Why programmers put comment?
To explain/describe the program/function/statement To help other programmers understand the program/function/statement 2 types of comments Line comment: single line comment Block comment: multiple line comment Syntax comment is differ to certain languages CSC425 - Introduction To Computer Programming
15
Step 5 : Maintenance Modification made to the finished program
Software to meet current requirement Need to refer the previous documentation CSC425 - Introduction To Computer Programming
16
A good program must have
Accuracy Reliability Efficiency A good program must have Maintainability Readability Usability CSC425 - Introduction To Computer Programming
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.