ch3: software engineering principles 1 what is a principle? definition: goals of accounting...

Post on 20-Dec-2015

224 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Ch3: Software Engineering Principles

2

What is a principle?

Definition:

Goals of accounting principles:

Goals of software engineering principles?

3

Why are software engineering principles needed?

Characteristics of target software

Summary:

4

Outline

Principles involve software engineering process and product

Seven important principles used in all phases of software development

Cornerstone principle:

5

Rigor and formality: Motivation

Problem statement:Write a program that computes the square root of a number

What is wrong/missing in this simple problem statement?

6

Rigor and formality: Motivation

More rigorous problem statement:

Write a program to compute the square root of a given number. The program accepts positive and negative numbers as well as zero as input. If the input is a positive number, then the output should be both positive and negative square roots of the number. If the inputis zero, then the output should be zero. If the input is a negative number, then the program should print an error message and exit.

Can you find anything lacking in this problem statement?

7

Rigor and formality: Motivation

What is formality?

SquareRoot(x)

Output = + sqrt(x), if x > 0 = 0 if x = 0 = “Error” if x < 0

Input x;

8

Rigor and formality

Software engineering is a creative design activity:

Why is rigor necessary?

What is formality?

9

Rigor and formality (contd..)

Who should practice rigor and formality?

When should rigor and formality be practiced?

Influence of rigor and formality on other software qualities

10

Examples of rigor and formality

Product:

Process:

11

Separation of concerns

Problem statement:Positive input:Negative input:Zero:Response time:

Different concerns:

Address different concerns separately:

12

Separation of concerns

Divide and conquer strategy:

Master complexity by:

Identify the different aspects of problem:

13

Separation of concerns (contd..)

Advantages of separation of concerns supports:

14

Examples

Go through phases one after the other (as in waterfall)

Keep product requirements separate

15

Modularity: Motivation

Problem statement:Write a program to compute the square root of a given number. The program accepts positive and negative numbers as well as zero as input. The program accepts input from an ASCII file. If the input is a positive number, then the output should be both positive and negative square roots of the number. If the input is zero, then the output should be zero. The output should be written to a file.

Should the code for input and output be embedded with the codethat computes square root, or should the code be in separate modules?

16

Modularity: Motivation

Monolithic application

File i/pSquare rootFile o/p

Modular application

File i/p Square root File o/p

17

Modularity

Definition:

Two-phase application of separation of concerns

Methodological approaches:

Is modularity unique to software engineering?

18

Modularity (contd..)

Four benefits of modularity

Key supporting concepts: Cohesion and coupling Cohesion:

Coupling:

19

Modularity (contd..)

Modularity supported in programming languages:

C++:

Ada95/Java:

20

Abstraction: Motivation

•For a module, which uses the square root program, the only relevant information is the input it accepts and the output it provides.

•Thus, the user of the square root program is only concerned with itsinput/output behavior and may ignore the details of the implementation.

21

Abstraction

Definition:

Goals of advances in design and programming

Type of abstraction to apply depends on purpose

22

Abstraction (contd..)

Abstraction yields models:

23

Example

Programming language semantics described through an abstract machine that ignores details of the real machines used for implementation

Abstractions in process

24

Anticipation of change: Motivation

Problem Statement:Consider the square root program. In addition to accepting input and writing output to a file, the program should also accept input from a terminal and provide output to a terminal.

File i/p Square root File o/p

Terminal i/p Terminal o/p

What if a combination of file and terminal I/p and o/p is desired?

25

Anticipation of change: Motivation

Another example:

Initially, the user wants an error message if the input is negative.Later, he changes his mind, and wants the complex root as output.

26

Anticipation of change

Why is this necessary?

Is anticipation of change unique to computing?

Can future products be predicted? Is planning cycle 5 or more years?

27

Generality: Motivation

Square root routine is being written for use in an application where itsinput will never be negative.

Later, a new application needs square root computation. But this, time, the output should be a complex root, if input is negative.

28

Generality

Why generality?

Advantages and drawbacks of generality

Some examples of generality

29

Generality (contd..)

Domain and organization specific reuse What products will company develop in the future? Leverage additional short-term effort with long-term

gains with respect to maintenance, reuse, etc.

30

Generality (contd..)

Domain-Independent20% Domain-Specific

65%

Application-Specific15%

Three classes of software

in a typical software application

31

Incrementality: Motivation

To provide a quick solution, we may first write a program that acceptspositive numbers as input, and provides positive square root as output.

Later, we can add the capability to accept negative numbers as input.Depending on the experience of the user in using the original program,upon receiving a negative input, he may choose to: - Print an error message - Produce complex root

32

Incrementality

Accepted practice across disciplines

Incrementality in software:

33

Incrementality (contd..)

Advantages of incrementality:

Difficulty in constructing solutions to complex computing problems:

top related