the software construction process. computer system components central processing unit...

13
The Software Construction Process

Upload: julia-mosley

Post on 13-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

The Software Construction Process

Page 2: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Computer System Components

Central ProcessingUnit

(Microprocessor)

01001101101101011101100110110100001010110101100110101010010110111010011001001011

Secondary Storage(Hard Drive,

DVD-ROM Drive)

Primary Storage(RAM)

Input Devices(Mouse, Keyboard)

Output Devices(Monitor, Printer)

Communications Bus

Network Interface Devices(Modem, Network Card)

Internet

Page 3: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

A Software Requirement

Develop a program that finds and prints all integers between 1 and 10,000 that are evenly divisible by 7, and whose last digit on the right is a 4 or 6.

Page 4: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

The Requirement and the Design

Develop a programthat finds and printsall numbers between1 and 10,000 that areevenly divisible by 7,and whose last digiton the right is a 4 or 6.

Set number to 1

Number less than or equal to 10,000

Number divisible by 7

4 or 6 in ones column

Print number

Increment number by 1

S

F

Yes

Yes

Yes

No

No

No

Page 5: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Boards, Tubes, and Patch Cables

01001101101101011101100110110100001010110101100110101010010110111010011001001011

Application Program

Page 6: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Setting Switches

01001101101101011101100110110100001010110101100110101010010110111010011001001011

Application Program

Page 7: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

I/O Devices and Operating System

01001101101101011101100110110100001010110101100110101010010110111010011001001011

01010101101010101010111001001011

ApplicationProgram

OperatingSystem

Page 8: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Assembly Language, Monitor, and Keyboard

010011011011010111011001101101000010101101011001

01010101101010101010111001001011

ApplicationProgram

OperatingSystem

LOOP: LOAD A, R1LOAD 7, R2TEST R1, R2BRZ LOOP

101110101010101001011011

Assembler

Page 9: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Compiler (Syntax and Semantics)

11011001101101000010101101011001

010101011010101010101010

ApplicationProgram

OperatingSystem

101110101010111001001011

Assembler

101010110010101001101011

Compiler

#include <stdio.h>

int main (void){int answer;float value;

scanf(“%d”, &value);answer = value / 3;printf(“%d\n”,answer);return 0;}

Page 10: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Algorithm in C Source Code

#include <stdio.h>

int main(void){int number = 1;

while (number <= 10000) { if ( (number % 7) == 0 ) { if ( ((number % 10) == 4) || ((number % 10) == 6) ) { printf("%d\n", number); } // End if } // End if number++; // Increment number by one } // End whilereturn 0;} // End main

Page 11: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

From Requirements to Running Program

Software Design

program.c or program.c (Source Code)

program.o (Object Code)

program.exe (Executable Code)

Software Requirements

Text Editor

Compiler (andPreprocessor)

Linker

Operating System

Design Method

Design Fundamentals

Coding Standards

Header Files

Function Libraries

Input/Output Facilities

Page 12: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Software Construction Process

EDIT andSAVE

COMPILE

LINK

RUNTEST and

SQA

BASELINE

DESIGN

Requirements

A

B

CD

2 3

1

4

5

6

7

8

E

Note: See next slide for meanings of A - E

Page 13: The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor) 01001101 10110101 11011001 10110100 00101011 01011001

Categories of Errors

• A: Compiler errors – doesn’t follow preprocessor or C syntax

• B: Linker errors – functions declared but not defined; no main function; function library not found

• C: Run-time errors – segmentation fault; out-of-range errors; wrong data types

• D: Logic errors – wrong use of control statements; errors in function arguments; algorithm coded incorrectly

• E: Design errors – doesn’t follow design or satisfy requirements; design has flaws