+ All Categories
Home > Documents > CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

Date post: 13-Jan-2016
Category:
Upload: doreen-sullivan
View: 221 times
Download: 4 times
Share this document with a friend
Popular Tags:
71
CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?
Transcript
Page 1: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Welcome to CIS 068 !Lesson 2:

Software Engineering

or

Why not only code it ?

Page 2: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Page 3: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?• Which event happens more frequently ?

• Which is deadlier ?

Page 4: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?

Famous Software Failures

• AT&T long distance service fails for nine hours(Wrong BREAK statement in C-Code, 1990)

Page 5: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?Famous Software Failures cont’d:

• Mars Climate Orbiter (September 23rd, 1999)The 125 million dollar Mars Climate Orbiter is assumed lost by officials at NASA. The failure responsible for loss of the orbiter is attributed to a failure of NASA’s system engineer process. The process did not specify the system of measurement to be used on the project. As a result, one of the development teams used Imperial measurement while the other used the metric system of measurement. When parameters from one module were passed to another during orbit navigation correct, no conversion was performed, resulting in the loss of the craft.

Page 6: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?

Famous Software Failures cont’d:

• Hi-tech toilet swallows woman (2001) [Source: Article by Lester Haines, 17 Apr 2001] A 51-year-old woman was subjected to a harrowing two-hour ordeal when she was imprisoned in a hi-tech public convenience. She was captured by the toilet, which boasts state-of-the-art electronic auto-flush and door sensors, which steadfastly refused to release it’s victim, and further resisted attempts by passers-by to force the door. Finally the fire brigade ripped the roof off the cantankerous crapper.

Page 7: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?Famous Software Failures cont’d:

• E-mail buffer overflow (1998)Several E-mail systems suffer from a "buffer overflow error", when extremely long e-mail addresses are received.  The internal buffers receiving the addresses do not check for length and allow their buffers to overflow causing the applications to crash.  Hostile hackers use this fault to trick the computer into running a malicious program in its place.

Page 8: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Why not only code it ?Software is• a critically important infrastructure component• a key enabler

– militaryly– economically– scientifically– culturally

But usually• expensive• of poor quality

Page 9: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Common Software Problems

– Software can cost hundreds or thousands of dollars per line

– Lifetime maintenance costs are higher still– Software is late or fails– Software is not performant (too slow)– Software is incomprehensible– Software is more trouble to use than it is

worth

Page 10: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Past Approaches to Solutions

•Use more people•Create better programming languages•Write software tools to help create software•Design before writing

•Start by baselining requirements•Train people better

•Create more chaos•Bad programs can be written in any language•(who finds the error in

reasoning in here ?)•Are you designing the

right program ?•but they change !

•…to do what ?

Page 11: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Software Crisis

Summary:

Millions are spent for an

incomprehensible tool that comes

late just to cause trouble, and we don’t

have answers

or:

THE SOFTWARE CRISIS

(1968)

Page 12: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

History1968: NATO Software Engineering Conference in Garmisch (Germany):

Why cannot bridge-building techniques be used to build operating systems

(‘engineering’) ?

Page 13: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Nature of Software

• It is a component of a larger system that “fits” with hardware, people, mechanical devices

• It transforms data using computers

• It has a complex structure

• It is usually very large, expensive, and lengthy to build

Page 14: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Nature of Software• Software is extremely malleable – we can modify the product all too easily

• Software construction is human-intensive, there are no real costs of materials

• Software is intangible: no laws of physics are applicable

• Software is not detectable by any of the five human senses

Page 15: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Nature of SoftwareBut:

The are characteristics analogue to physical engineering processes

Studying such analogs can be useful:

• Help us learn about computer software • Find points of similarity • Suggest successful approaches to be emulated • Avoid known mistakes

Page 16: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Engineering Example

Building a house:•Land and finances•garden, garage, you are used to age wine, enjoy to sit by the fireplace, lots of storage, don’t like bauhaus•Architect will define number of floors and rooms, orientation of the driveway, size of the garage …•type of bricks, colour of the walls,…•Construction•Entering•Living in the house•Fixing minor problems, leaking in the roof …

System Feasibility

Software Plans and Requirements

Product Design

Detailed Design

Code

Integration (Product Verification)

Integration (System Test)

Operations and Maintenance

Page 17: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Waterfall ModelSystem Feasibility Validation

Plans +

RequirementsValidation

Product Design Verification

Detailed Design Verification

Code Unit Test

IntegrationProduct Verification

Integration System Test

Operation + Maintenance

RevalidationDidn’t we forget something ?

Page 18: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Waterfall ModelSystem Feasibility Validation

Plans +

RequirementsValidation

Product Design Verification

Detailed Design Verification

Code Unit Test

IntegrationProduct Verification

Integration System Test

Operation + Maintenance

Revalidation

Page 19: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

User

SOFTWARE

Customer

Programmer

Designer

The Human Factor

Page 20: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

User Programmer

SOFTWARE

Customer Designer

Programmer‘s view:• Some (holy) lines of code• A technical challenge• A pet• ...

The Human Factor

Page 21: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

User Programmer

SOFTWARE

Customer Designer

User‘s view:• A miracle• A wonderful tool making things easier• An incombprehensible tool unnecessarilly complicating life• Something that simply should work !

The Human Factor

Page 22: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

User Programmer

SOFTWARE

Customer DesignerCustomer‘s view:• A hopefully affordable tool to enhance profit.

The Human Factor

Page 23: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

User Programmer

SOFTWARE

Customer DesignerDesigner‘s view:• A reasonably complicated tool to fulfill the needs• A technical challenge

The Human Factor

Page 24: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Human Factor

• Usually one person plays multiple roles

• Separation of different roles needs discipline !

Page 25: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Review of Waterfall Model

Weaknesses:– Usually requirements change, are

incomplete or even not known– Communication ! (…see Mars Orbiter…)

Result: ‘That’s not what I meant !’ ( go back to last step )

WF-Model reacts very statically:– Each stage must be completed before next

one starts

Page 26: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Total Feedback System Feasibility Validation

Plans +

RequirementsValidation

Product Design Verification

Detailed Design Verification

Code Unit Test

IntegrationProduct Verification

Integration System Test

Operation + Maintenance

Revalidation

•Too expensive•Doesn’t force to discipline•Don’t show this to your boss !

Page 27: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Unified Model• A tradeoff, unifying different models• Shows the basic message of different

approaches

Page 28: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

The Unified ModelTime

Act

iviti

esCustomer

User

Designer

Programmer

Page 29: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Models: Review•There are a lot of models, each with it’s strong- and weaknesses•Keep in mind:

• There is a necessity to manage the workflow• There are different views of software• Smaller projects can be managed by the waterfall model• Review your programming process, check which phase you are in• Play different roles by yourself

• And NEVER forget the testing !

Page 30: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Software Life Cycle ActivitiesIndependent of how they are organized, the following activities are involved in the development of software:

Page 31: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Example: The Phone Directory

Example will show activities:• Requirements

• Analysis• Design

• Implementation

Page 32: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Phone Directory: Requirements

Phone Directory:

• Interactive Program containing collection of names and phone-numbers

• Insert new entries • Retrieve entries• Change Entries

Page 33: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Phone Directory: Detailed Req’s

• Import existing data ?• Read from file or enter interactively• If file: file-type ?• If text-file: comma separated ?• Final directory: filetype spec’s ?• Limited namelength ?• Numbers as string ?• Order alphabetically ?• Printout required ?• Double entries possible ?• …

Page 34: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Phone Directory: Analysis

Requirement – related:

• Cluster requirements to different levels of detail

• Understand ALL requirements• Explore EVERY uncertainty

Page 35: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Phone Directory: Analysis

Implementation-strategy:

• Use commercial software ?• Design specific or reusable software ?• Outsource different tasks (if specified) ?• Which language ?• Impact on existing software-packages ?• …

Page 36: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Phone Directory: Analysis

High level design:

• Again: make sure you understand the problem !

• Different methodologies:• Top Down Design• Object Oriented Approach

Page 37: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Analysis: Top Down Design

Stepwise Refinement, Divide and Conquer

• Start at top level• Divide into subproblems• For each subproblem:

• Divide into subproblems, solving the higher level problem

Page 38: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Analysis: Top Down Design

Structure chart, indicating the relationship

Page 39: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Analysis: Top Down DesignRefinement

Page 40: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Analysis: Top Down DesignRefinement

Page 41: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Analysis: Top Down Design

Question: When should we stop the refinement ?

Answer:Each subproblem should be RESPONSIBLEfor exactly ONE activity

(…in it’s description, there’s no AND)

Page 42: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

How to go on ?What happens if proceeding with

refinement, e.g. going down to flowchart ?

• the problem description then will focus on PROCEDURES

• Definition of data structures ?

This is a major problem in procedural driven design !

Alternative: Object Oriented Design

Page 43: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Object Oriented Design1. Identify objects participating in the system

• Look at nouns in the problem statement to identify objects:

…create phone directory …containing entries… read from/write to file… interact with user …

Objects:• Directory• Entry• File• User

Page 44: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Object Oriented Design

2. Identify INTERACTIONS between objects• Messages between objects• Look at verbs in the problem statement

to identify interactions:

…create phone directory …containing entries… read from/write to file… interact with user …

• Messages must be processed by object’s methods

Page 45: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Object Oriented DesignClass Diagram for Phone Book Example:

Defined by UML (Unified Modeling Language)

Page 46: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Object Oriented DesignClass Diagram for Phone Book Example:

Defined by UML (Unified Modeling Language)

Actor Class Aggregation (“part of”)

Navigability: Source Target

Page 47: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

AbstractionDefinition:Abstraction = process of separating inherent qualities or properties of something from theactual physical representation.

• Procedural Abstraction • separate what a procedure does from how it is done

• Data Abstraction• describe what information is stored, not how• logical view instead of physical view

Page 48: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

AbstractionLeads to Information Hiding:

Abstract data types are only defined by their methods, the actual implementation is hidden.

Advantage: •separation of definition and implementation•Maintenance simplification

Data protected by methods

Page 49: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Abstraction

• JAVA interfaces define Abstract Data Types.

• Specification of names, parameters, return values

• No implementation in interfaces but in classes

Page 50: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDefinition:

Use Case = Closed loop interaction with the user

The refinement process of the top down approach is replaced by listing all use cases, or: “write down

everything the system is supposed to do”

Page 51: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesUse Cases for phone book example:

The program must be able to:

• load initial directory from file

• insert new entry or change existing one

• retrieve and display entry

• save modified directory back to file

• exit

Page 52: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDetailed Description ( 1 of 5):

Page 53: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDetailed Description ( 2 of 5):

Page 54: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDetailed Description ( 3 of 5):

Page 55: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDetailed Description ( 4 of 5):

Page 56: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesDetailed Description ( 5 of 5):

Page 57: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use Cases

Compare Use Cases to results of refinement

• of course they seem similar (this is a simple example !)• refinement didn’t contain any data-structure related information• Use Cases contain messages, these messages contain implicit information about data• Use Cases and objects do not need explicit information about data• Data structures should even be hidden to other classes !

Page 58: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use Cases

(The following slides differ from the Textbook)

Page 59: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Abstraction

The class structure redefined:

Page 60: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Sequence Diagrams

Each Use Case corresponds to a

Sequence Diagram

• shows the flow of messages between classes• defined by UML standard

Page 61: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesAgain: Use Case 1

Page 62: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Sequence DiagramsSequence Diagram of Use Case 1:

Load data from file

Page 63: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Sequence DiagramsSequence Diagram of Use Case 1:

Load data from fileactor object

Object’s Lifeline:active / inactive

message

self call

Page 64: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesAgain: Use Case 2

Page 65: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Sequence DiagramsSequence Diagram of Use Case 2:

Insert / change entry

Page 66: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Use CasesAgain: Use Case 3:

Page 67: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Sequence DiagramsSequence Diagram of Use Case 3:

Retrieve and Display entry

Page 68: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

From Diagrams to ObjectsRemind:

• all messages must be processed by object’s method

• the message-processing requires data types

• the messages received and sending from an object in all use cases define the object’s methods explicitely

• data structures for implementation are defined by the needs of methods, hidden to other objects

• the objects are defined by collecting all messages for/from each object

Page 69: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

From Diagrams to ObjectsCollect all messages to define object’s methods !

Phone Directory

Page 70: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Reviewreasons for thinking about software

software 'engineering'

different views of software

software life cycle models

waterfall model

unified model

phone directory example:

requirements

analysis

top down (divide and conquer)

object oriented

use cases

abstraction

sequence diagrams to objects

Page 71: CIS 068 Welcome to CIS 068 ! Lesson 2: Software Engineering or Why not only code it ?

CIS 068

Good Bye !


Recommended