You are on page 1of 14

Unit 2

Programming Logic
Program Development Cycle
• A correct program can be written with the proper planning and its
implementation.
• Programmers develop the program in a planned manner to master
the complexity of the problem.
• They follows the series of steps which is known as Program
Development Life Cycle(SDLC).
Steps: SDLC
1. Problem Analysis
2. Design a solution
3. Program Coding
4. Testing and Debugging
5. Implementation, maintenance and Documentation
Problem Analysis
• Also called problem definition
• Must specify the following tasks:
• Objective
• Output Requirement
• Input Requirement
• Processing Requirement
• Evaluating Feasiblity
Design a solution
• Logical design
• Programming tools: algorithm, flowchart, block diagram, Data flow
diagram, E-R diagram
• Helps in coding
Program Coding
• Physical design
Testing and Debugging
• Types of error
• Syntax error
• Runtime error
• Logical error
• Testing is usually performed for:
• For verification and validation
• To improve quality
Implementation, Maintenance and
Documentation
• After debugging and testing, the overall programs are integrated.
• Finally developed program is implemented.
• Software has to go for maintenance due to change in technology,
client requirement and other factors.
Documentation
• Program documentation starts from the starting of the SDLC.
• It keeps most of the information of all phases while developing
projects.
• It is used for further reference for both the programmer and client.
• It should contain:
• Problem analysis document called Software requirement Specification (SRS).
• Program design document called Methodology
• Program verification document using test cases
• Log is used to document further program revision and maintenance activity.
Program Development Tools
1. Algorithm
• An algorithm is a finite set of sequential instructions written in a natural
language.
• The characteristics of algorithms are:
• Input
• Output
• Unambiguous
• Finiteness
Program Development Tools
2. Flowchart
it is a diagrammatic (pictorial) representation of the instruction for
solving a problem.
It is graphical representation of algorithm.
use various standard symbols
Symbols: Flowchart: defined by American National
Standard Institute (ANSI)
Flowchart structure:
Example:
• Write an algorithm and draw a flowchart to find the simple interest.
• Write an algorithm and draw a flowchart to find the largest among two
numbers.
• Write an algorithm and draw a flowchart to input a number and check if it is
positive , negative or zero.
• Write an algorithm and draw a flowchart to find the largest among three
numbers.
• Write an algorithm and draw a flowchart to display the number from 1 to 5.
• Write an algorithm and draw a flowchart to display first 20 natural numbers
and also their sum.

You might also like