software life cycle use requirements gathering, problem definition analysis and design (programming...

21
Software Life Cycle Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniq Coding Testing Implementation and Maintenan What How Do it Test

Upload: sheila-erin-montgomery

Post on 13-Jan-2016

235 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Software Life CycleSoftware Life Cycle

Use

Requirements Gathering, Problem definition

Analysis and Design (Programming techniques)

Coding

Testing

Implementation and Maintenance

What

How

Do it

Test

Page 2: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Coding and TestingCoding and Testing

Write Program

Compile Program

Run and Test Program

Submit Program

Success

Correct Errors

Correct Errors

Correct Errors

Errors

Errors

Errors

Page 3: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

How to develop a program How to develop a program • Identify the steps and execution sequence.• Every program consist of mainly three parts: Input, Processing and Output

Example: Add two numbersSteps1. Read/Input two numbers2. Add these two numbers3. Display/Output the result of addition

• Algorithm : Steps written in English language.• Program : Algorithm written in a specific high

level language.

Page 4: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

AlgorithmAlgorithm• An Algorithm is a solution to a problem that is

independent of any programming language.

• An Algorithm is – a finite sequence of steps– each step shall be clearly stated and

understandable– for each input, it shall terminate in finite time

with output

How we solve the problem with Computer?

Page 5: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Program and Programming Program and Programming

Program: • A set of instruction written in a programming

language that a computer can execute so that the machine acts in a predetermined way.

• Program solves a problem• Before writing a program:

– Have a thorough understanding of the problem – Carefully plan an approach for solving it.

Programming:• The Process of providing instructions to the

computer that tells the processor what to do.

Page 6: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Algorithms & ProgramsAlgorithms & Programs

• An Algorithm is a solution to a problem that is independent of any programming language.

While

• A program is an algorithm expressed using a specific set of instructions from any programming language.

Page 7: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Algorithm ExampleAlgorithm Example

• Maximum of two numbers Steps:

1.Read/input two numbers2.Compare two numbers3.Print the Greater number

• Average of three numbers Steps:

1.Read/input three numbers2.Add three numbers3. divide the sum by 3. 4.Print the result of divison

Page 8: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

PseudocodePseudocode

– This is a common notation for writing algorithms.

– Mixture of English language statement and a programming language( like C) code.

– It is an intermediate step in writing a program.

– Not actually executed on computers.

– Standard mathematical notations like exponents,square-root symbols etc. are allowed in pseudocode.

Page 9: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Rules for pseudo codeRules for pseudo code• The beginning and end of a pseudo code is marked with

keywords START and STOP.

• Every variable should be initialized in the beginning only using INITAILZE

• Values from user should be accepted using keyword READ, and should be display using WRITE.

• All “alphanumeric” values should be enclosed in single or double quotes.

• All the nested loops are: for-do-done, while-do-done

• All the control structures are: if-then-else-fi, switch-case.

Page 10: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

ExamplesExamples

Pseudo code to find out the sum of all odd numbers in the range 1 to 10.STARTINITIALIZE a[10], sum=0,ifor i=1 to 10 do Read a[i]; if (condition) then Calculate sum=sum+a[i]; doneWrite sum;STOP

Page 11: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

ExamplesExamplesPseudo code to find out the maximum number from 20 given numbers.

STARTINITIALIZE a[20],max,i;for i=1 to 20 do Read a[i];donemax=a[1];for i=2 to 20 do if a[i]>max then Assign max=a[i]; doneWrite max;STOP

Page 12: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Practice ExamplePractice ExampleWrite an algorithm for the given problem:10 students of a class appears for a test in three subjects. Each test is out of 100 marks. The percentage of each student has to be calculated and depending on the percentage calculated, grades are given below:

Percentage Grade

> =80 A

60-79 B

<=59 C

Page 13: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

FlowchartFlowchart– Graphical representation of an algorithm– Components:

• Arrows/lines :Flow of control• Parallelogram: Indicates input and output

operations• Rectangle symbol (action symbol): Indicates

any type of action/computational step• Oval symbol:Indicates the beginning or end

of a program or a section of code• Diamond: Decision

Page 14: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Flowchart NotationsFlowchart Notations

Arrows

Parallelogram

Rectangle

Diamond

Oval

Page 15: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance
Page 16: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Example: Add two NumbersExample: Add two Numbers

READ A,B

C=A+B

PRINT C

START

STOP

Page 17: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Draw both flow chart and pseudo Draw both flow chart and pseudo codecode

You are required to calculate area of circle and rectangle.

Accept from user the figure and then accordingly calculate and display.

Page 18: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Pseudo codePseudo code

STARTINITIALIZE FIG, area=0;READ FIG ;IF FIG = “circle”

CALL CIR_ROUTINE ;ELSE

IF FIG=“rectangle” CALL RECT_ROUTINE ;

ELSE GOTO label 1;ENDIF

ENDIFWRITE “ area of figure”, area;STOP

label 1:

Page 19: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

CIR_ROUTINE INITIALIZE radius=0; READ radius; CALCULATE area = 3.14 *

radius * radius; RETURN to Calling

procedure

RECT_ROUTINE

INITIALIZE length=0, width=0;

READ length,width;

CALCULATE area = length*width;

RETURN to Calling procedure

Page 20: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

Flow ChartFlow Chart

READ FIG

AREA=3.14*RADIUS * RADIUS PRINT AREA

FIG?

circle

rectangle

READ RADIUS

READ LENGTH & WIDTH

AREA=LENGTH * WIDTH

START

STOP

other

Page 21: Software Life Cycle Use Requirements Gathering, Problem definition Analysis and Design (Programming techniques) Coding Testing Implementation and Maintenance

ProblemsProblems• GCD of three numbers• Calculate 2n

• Roots of equation ax2+bx+c=0• Largest of N numbers• Generate the fibonacci series