+ All Categories
Home > Documents > Lecture 2: Software Engineering Fundamentals

Lecture 2: Software Engineering Fundamentals

Date post: 19-Jan-2016
Category:
Upload: mahina
View: 69 times
Download: 1 times
Share this document with a friend
Description:
Lecture 2: Software Engineering Fundamentals. Today. We try to put Software Engineering in an historical perspective We present several methods and ideas that can help you build software in a practical way We show what most people software engineers remember of Software Engineering (sic!). - PowerPoint PPT Presentation
Popular Tags:
53
Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. Bernd Schoeller Chair of Software Engineering Lecture 2: Software Engineering Fundamentals
Transcript
Page 1: Lecture 2: Software Engineering Fundamentals

Software EngineeringProf. Dr. Bertrand Meyer

Dr. Manuel Oriol

Dr. Bernd Schoeller

Chair of Software Engineering

Lecture 2: Software Engineering Fundamentals

Page 2: Lecture 2: Software Engineering Fundamentals

Today

We try to put Software Engineering in an historical perspective

We present several methods and ideas that can help you build software in a practical way

We show what most people software engineers remember of Software Engineering (sic!)

Software Engineering, lecture 2: Fundamentals 2

Page 3: Lecture 2: Software Engineering Fundamentals

Software Engineering

Two Notions are Important:

Software Programs Achievements: Internet, Personal Computers,

Information Society…

Engineering: Building Process Achievements: Pyramids, Eiffel Tower, Bridges,

Cars…

Software Engineering, lecture 2: Fundamentals 2

Page 4: Lecture 2: Software Engineering Fundamentals

Where it all started

Software Engineering, lecture 2: Fundamentals 2

Augusta Ada King, Countess of Lovelace

(1815 – 1852)“First Computer Programmer”

Page 5: Lecture 2: Software Engineering Fundamentals

In notes on the analytical engine

“...an analyzing process must equally have been performed in order to furnish the Analytical Engine with the necessary operative data; and that herein may also lie a possible source of error. Granted that the actual mechanism is unerring in its processes, the cards may give it wrong orders.”

in Sketch of The Analytical Engine Invented by Charles Babbage by L. F. Menabrea

with notes upon the Memoir by the translator Ada Augusta, Countess of Lovelace

Software Engineering, lecture 2: Fundamentals 2

Page 6: Lecture 2: Software Engineering Fundamentals

Bugs?

“It has been just so in all of my inventions. The first step is an intuition, and comes with a burst, then difficulties arise—this thing gives out and [it is] then that "Bugs"—as such little faults and difficulties are called—show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached.”

Thomas Eddison, in a letter, 1878 (wikipedia, Software Bugs)

Software Engineering, lecture 2: Fundamentals 2

Page 7: Lecture 2: Software Engineering Fundamentals

More bugs…

Software Engineering, lecture 2: Fundamentals 2

Mark II operator William "Bill" Burke, 1947, Pasted into log book by Grace Hopper -> coined term Debug

Page 8: Lecture 2: Software Engineering Fundamentals

At that time…

Harvard Architecture separates data and program: Program on punched tape

Data in memory

Software Engineering, lecture 2: Fundamentals 2

Page 9: Lecture 2: Software Engineering Fundamentals

How to make programs that do not bug?

That’s the real question… Idea: When your actual code is too close to the

machine, it is hard to debug

How to read: (x86 asm) cseg segment para public 'CODE' assume cs:cseg,ds:cseg start: jmp start1 msgstr db 'Enter Fahrenheit ' crlf db 13,10,'$’

Software Engineering, lecture 2: Fundamentals 2

Page 10: Lecture 2: Software Engineering Fundamentals

Main Idea

Change the Programming Language!

Software Engineering, lecture 2: Fundamentals 2

Page 11: Lecture 2: Software Engineering Fundamentals

The example of FORTRANFORTRAN 53 (32 instructions)FORTRAN 58

added procedures!FORTRAN IV (1962)

Added logical expressions and logical IF (before only arithmetical IF)

FORTRAN 66 ANSI standard

FORTRAN 77 ELSE, DO WHILE (before GOTO was used)…

FORTRAN 90 and 95 Modules, abstract data types,

FORTRAN 2003, 2008 Objects, procedure pointers Software Engineering, lecture 2: Fundamentals 2

Page 12: Lecture 2: Software Engineering Fundamentals

First idea

In structured programming (Böhm&Jacopini’66, Dijkstra’69), a program is always expressible as the control-flow instructions:

Concatenation (blocks) Selection (if, switch…) Repetition (loops) One entry-point

What is missing?Software Engineering, lecture 2: Fundamentals 2

GOTO, Multiple entry points

Page 13: Lecture 2: Software Engineering Fundamentals

Why does it help?

It is easier to understand the code

Easier to prove that it works (Dikstra thought that code should show a proof)

Easier to maintain

Easier to write

Top-down design and programming

Software Engineering, lecture 2: Fundamentals 2

Page 14: Lecture 2: Software Engineering Fundamentals

This translate into…

Procedural programming

The unit is the procedure and it groups individual statements

Programmers do not use destructuring instructions (goto)

Top-down approach for designing

Software Engineering, lecture 2: Fundamentals 2

Page 15: Lecture 2: Software Engineering Fundamentals

Top-Down approach

Also called “Divide and Conquer”Best example: Stepwise refinements (Wirth’75, http://sunnyday.mit.edu/16.355/wirth-

refinement.html)

The idea is to consider the problem in its entirety and state it simply

Then decompose into smaller units in a recursive manner

When not possible to decompose anymore, code the smaller units

Software Engineering, lecture 2: Fundamentals 2

Page 16: Lecture 2: Software Engineering Fundamentals

Example

A program that removes the comments of source code

Software Engineering, lecture 2: Fundamentals 2

Page 17: Lecture 2: Software Engineering Fundamentals

Example (2)

A program that removes the comments of source code Read the file Remove comments Store the modified file back

Software Engineering, lecture 2: Fundamentals 2

Page 18: Lecture 2: Software Engineering Fundamentals

Example (3)

A program that removes the comments of source code Read the file

Open the file Read line by line and put in an array of strings

Remove comments Iterate through the array, in each line, remove

the comment Store the modified file back

Iterate through the array, store each line

Software Engineering, lecture 2: Fundamentals 2

Page 19: Lecture 2: Software Engineering Fundamentals

Example (4)

A program that removes the comments of source code Read the file

Open the file Read line by line and put in an array of strings

Remove comments Iterate through the array,

in each line look for first sequence “--” remove the rest of the line

Store the modified file back Iterate through the array, store each line

Software Engineering, lecture 2: Fundamentals 2

Page 20: Lecture 2: Software Engineering Fundamentals

Example (5)

Write the code!

Software Engineering, lecture 2: Fundamentals 2

Page 21: Lecture 2: Software Engineering Fundamentals

Evaluation

Advantages: Code is modular Skeletons illustrate the use Programmers do not miss a part of the

implementation

Disadvantage: The program works at the end only

Software Engineering, lecture 2: Fundamentals 2

Page 22: Lecture 2: Software Engineering Fundamentals

Bottom-up Approach

The idea is to make the small parts first and let the environment assemble them

As an example, PROLOG programs are a specification of the inferences. The system deduces the facts

Software Engineering, lecture 2: Fundamentals 2

Page 23: Lecture 2: Software Engineering Fundamentals

Top-down AND Bottom-up

Most of the current approaches actually mix the two approaches:

Top-down for the design

Bottom-up, by using libraries or composing components

Software Engineering, lecture 2: Fundamentals 2

Page 24: Lecture 2: Software Engineering Fundamentals

And the world became Objects

Breakthrough with Simula 67

Coupling data types and code

Objects deal with reuse

Objects deal with modularity

Objects model naturally some paradigms (e.g. GUI, libraries)

Software Engineering, lecture 2: Fundamentals 2

Page 25: Lecture 2: Software Engineering Fundamentals

Modularity

Classes are whole units they allow the co-localization of code and relevant data

Deferred (abstract) classes help enforce that

Client relationship helps to encapsulate

Easy graphical representation

Software Engineering, lecture 2: Fundamentals 2

Page 26: Lecture 2: Software Engineering Fundamentals

Reuse

Easy extensions with inheritance.

Generics help reuse the code across types

Strong types help with the possible mismatches

Libraries shorten development time

Software Engineering, lecture 2: Fundamentals 2

Page 27: Lecture 2: Software Engineering Fundamentals

Design by Contracts

Design by contracts is the next step towards correctness of the code and the data (in Eiffel, Java/JML, Spec#)

Invariants check data at each method call

Preconditions ensure that the application is in a valid state before a call

Postconditions ensure that the code proceeded in a good manner

Software Engineering, lecture 2: Fundamentals 2

Page 28: Lecture 2: Software Engineering Fundamentals

Languages only are not the solution…

The fact is that bugs are still found in most (if not all) programs, classes…

As an example automated tools find bugs in (almost) all classes

Software Engineering, lecture 2: Fundamentals 2

Page 29: Lecture 2: Software Engineering Fundamentals

Bugs found by AutoTest in Eiffel classes

The fact is that bugs are still found in most (if not all) programs, classes…

As an example:

Software Engineering, lecture 2: Fundamentals 2

Page 30: Lecture 2: Software Engineering Fundamentals

Other factors

The final programmer code is not the only parameter to consider when executing the code: the operating system, the libraries, the runtime system

What is needed is not easily identifiable

Programmers can make mistakes

Software Engineering, lecture 2: Fundamentals 2

Page 31: Lecture 2: Software Engineering Fundamentals

How do you develop a project?

Code and fix?

Design, code and fix?

Design, code, test, fix?

Design, code, test, document and fix?

Software Engineering, lecture 2: Fundamentals 2

Page 32: Lecture 2: Software Engineering Fundamentals

Suggestions to improve the situation?

What would you do to improve the situation?

Software Engineering, lecture 2: Fundamentals 2

Page 33: Lecture 2: Software Engineering Fundamentals

How to reduce the issues?

By Describing: Specifying and Documenting

By Implementing: Designing and Coding

By Assessing: verifying, validating, analyzing, testing, measuring (both products and processes).

By Managing: organizing the work, communicating, collaborating

By Operating: deploying systems and overseeing their proper functioning.

Software Engineering, lecture 2: Fundamentals 2

Page 34: Lecture 2: Software Engineering Fundamentals

Software Development Process

A software development process is a process used to develop applications.

Proponents of the process hope that it reduces the discrepancies between what the program is supposed to do and what it actually does.

There are two main types of processes: Sequential Iterative

Software Engineering, lecture 2: Fundamentals 2

Page 35: Lecture 2: Software Engineering Fundamentals

What is considered?

Software Engineering, lecture 2: Fundamentals 2

Feasibilitystudy

Requirements

Specification

Globaldesign

Detaileddesign

Implemen-tation

Distribution

V & V

Prototyping

Unit Testing

Acceptance Testing

System Testing

Page 36: Lecture 2: Software Engineering Fundamentals

Original waterfall model

Software Engineering, lecture 2: Fundamentals 2Winston Royce, 1970, source: wikipedia, waterfall model

Page 37: Lecture 2: Software Engineering Fundamentals

Sequential Model: Waterfall Model

Software Engineering, lecture 2: Fundamentals 2

Feasibilitystudy

Requirements

Specification

Globaldesign

Detaileddesign

Implemen-tation

Distribution

V & V

Page 38: Lecture 2: Software Engineering Fundamentals

Software Engineering, lecture 2: Fundamentals 2

Waterfall risk profile

Requirements Design Implementation Integration, V&V…

Time

Po

ten

tial

imp

act

of r

isk

bei

ng

tac

kled

C. Larman Agile & Iterative Development A Manager guide Addison Wesley 2003 p. 58

Page 39: Lecture 2: Software Engineering Fundamentals

Strength and Weaknesses

Advantages: Widely used… Time spent early on helps later on to remove

some unnecessary delays Emphasis on documentation and source code Simple

Disadvantages Difficult for big projects to have one phase only Most steps are not easily finished Even Royce advocated for an iterative model in

the original paper!

Software Engineering, lecture 2: Fundamentals 2

Page 40: Lecture 2: Software Engineering Fundamentals

The sashimi model?

The steps are overlapping:

Software Engineering, lecture 2: Fundamentals 2

Distribution

Feasibilitystudy

Requirements

Specification

Globaldesign

Detaileddesign

Implemen-tation

Distribution

V & V

Peter DeGrace

Page 41: Lecture 2: Software Engineering Fundamentals

Sequential Model: V-model

Software Engineering, lecture 2: Fundamentals 2

Feasibilitystudy

Requirements

Specification

Globaldesign

Detaileddesign

Implemen-tation

Distribution

Unit Testing

Acceptance Testing

System Testing

Distribution

German Ministry of Defense, 1992

Page 42: Lecture 2: Software Engineering Fundamentals

V-Model (2)

Software Engineering, lecture 2: Fundamentals 2Source: V-model, wikipedia

Page 43: Lecture 2: Software Engineering Fundamentals

Strength and Weaknesses

Advantages: The testing begins very early on in the project The implementation and design are guided by

testing

Disadvantages It is still a sequential model (requirements do not

change etc…)

Software Engineering, lecture 2: Fundamentals 2

Page 44: Lecture 2: Software Engineering Fundamentals

Sequential Model: Evolutionary Model

Software Engineering, lecture 2: Fundamentals 2Brooks, 1995

Implemen-tation

User Tests

Prototyping

Implemen-tation

Distribution

Page 45: Lecture 2: Software Engineering Fundamentals

Strength and Weaknesses

Advantages: The prototype permits an early assessment User test the first prototype and give feedback

Disadvantages Code it twice! (sometimes not possible)

Software Engineering, lecture 2: Fundamentals 2

Page 46: Lecture 2: Software Engineering Fundamentals

Iterative Model: Prototype Model

Software Engineering, lecture 2: Fundamentals 2

Implemen-tation

User Tests

Prototyping

Distribution

Page 47: Lecture 2: Software Engineering Fundamentals

Strength and Weaknesses

Advantages: The prototype permits an early assessment User test the prototype and give feedback Feedback integrated

Disadvantages You have to code it twice! (sometimes not

possible)

Software Engineering, lecture 2: Fundamentals 2

Page 48: Lecture 2: Software Engineering Fundamentals

Iterative Model: Spiral Model

Software Engineering, lecture 2: Fundamentals 2Barry Boehm, 1988

Page 49: Lecture 2: Software Engineering Fundamentals

Characteristics

The iterations typically take 6 months to 2 years to proceed

It creates successions of prototypes as well

Software Engineering, lecture 2: Fundamentals 2

Page 50: Lecture 2: Software Engineering Fundamentals

Strength and Weaknesses

Advantages: Manages the risk Estimates are more realistic with time Manage changes Software Engineers start working earlier

Disadvantages A bit of an overkill for small projects

Software Engineering, lecture 2: Fundamentals 2

Page 51: Lecture 2: Software Engineering Fundamentals

Why did it evolve?

Agencies need to control the development and have accountability for delays

The quality of the software is at the core of the processes

People can then rely on a more codified process

Software Engineering, lecture 2: Fundamentals 2

Page 52: Lecture 2: Software Engineering Fundamentals

Today

We saw how programming languages evolved to help programmers avoid writing bugs as much as possible

We talked about the emergence of processes for engineering software

We showed processes that are very used in companies

Software Engineering, lecture 2: Fundamentals 2

Page 53: Lecture 2: Software Engineering Fundamentals

Next week

Requirements

Standards Categories

Software Engineering, lecture 2: Fundamentals 2


Recommended