Software Engineering - NYU Computer Science Department

advertisement
Software Engineering
September 5, 2001
Introduction to Software Engineering
Joseph Conron
Computer Science Department
New York University
jconron@cs.nyu.edu
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
1
What is Software Engineering

Software systems are complex
 Impossible to understand by a single person
 Many projects are never finished: "vaporware"
 The problem is arbitrary complexity

1968 Definition:
 Software Engineering means the construction of quality software
with a limited budget and a given deadline

Our definition:
 Software Engineering means the construction of quality software
with a limited budget and a given deadline in the context of constant
change

Emphasis is on both, on software and on engineering
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
2
Software Engineering Concepts: Definitions
•
•
•
•
•
Project – set of activities to develop a software system
Activity – a phase in which related tasks are carried
out
Task – effort that uses resources AND produces
WorkProduct
Resources – time, equipment, people (participants)
WorkProduct – a model, system, or artifact
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
3
Software Engineering Concepts
Project
*
Activity
is produced by
WorkProduct
*
consumes
*
Task
System
*
Participant
Model
Time
Document
Bernd Bruegge & Allen Dutoit
Resources
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
Equipment
4
Software Engineering Activities
•
•
•
•
•
Requirements Elicitation
Analysis
System Design
Object Design
Implementation
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
5
Introduction to Modeling and UML







What is modeling?
What is UML?
Use case diagrams
Class diagrams
Sequence diagrams
Activity diagrams
Summary
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
6
Systems, Models, and Views




A model is an abstraction describing system or a subset of a
system
A view depicts selected aspects of a model
A notation is a set of graphical or textual rules for representing
views
Views and models of a single system may overlap each other
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
7
Systems, Models, and Views
Flightsimulator
Blueprints
Airplane
Model 2
System
View 1
View 2
View 3
Model 1
Electrical
Wiring
Scale Model
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
8
Models, Views, and Systems (UML)
*
System
*
Model
View
depicted by
described by
airplane:System
scaleModel:Model
blueprints:View
Bernd Bruegge & Allen Dutoit
flightSimulator:Model
fuelSystem:View
electricalWiring:View
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
9
Why model software?
Software is already an abstraction: why model software?

Software is getting larger, not smaller
 NT 5.0 ~ 40 million lines of code
 A single programmer cannot manage this amount of code in its
entirety.


Code is often not directly understandable by developers who
did not participate in the development
We need simpler representations for complex systems
 Modeling is a mean for dealing with complexity
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
10
Concepts and Phenomena

Phenomenon: An object in the world of a domain as you
perceive it, for example:
 The lecture you are attending
 My black watch

Concept: Describes the properties of phenomena that are
common, for example:
 Lectures on software engineering
 Black watches

A concept is a 3-tuple:
 Its Name distinguishes it from other concepts.
 Its Purpose are the properties that determine if a phenomenon is a
member of a concept.
 Its Members are the phenomena which are part of the concept.
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
11
Concepts and Phenomena
Name
Purpose
Clock
A device that
measures time.


Members
Abstraction: Classification of phenomena into concepts
Modeling: Development of abstractions to answer specific
questions about a set of phenomena while ignoring irrelevant
details.
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
12
Concepts In Software: Type and Instance

Type:
 An abstraction in the context of programming languages
 Name: int, Purpose: integral number, Members: 0, -1, 1, 2,
-2, . . .

Instance:
 Member of a specific type



The type of a variable represents all possible instances the
variable can take.
The relationship between “type” and “instance” is similar to
that of “concept” and “phenomenon.”
Abstract data type:
 Special type whose implementation is hidden from the rest of the
system.
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
13
Class

Class:
 An abstraction in the context of object-oriented languages


Like an abstract data type, a class encapsulates both state
(variables) and behavior (methods)
Unlike abstract data types, classes can be defined in terms of
other classes using inheritance
Watch
time
date
SetDate(d)
CalculatorWatch
calculatorState
EnterCalcMode()
InputNumber(n)
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
14
Object-Oriented Modeling
Application Domain
Application Domain Model
TrafficControl
Aircraft
UML Package
TrafficController
FlightPlan
Bernd Bruegge & Allen Dutoit
Solution Domain
System Model
Airport
SummaryDisplay
MapDisplay
FlightPlanDatabase
TrafficControl
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
15
Application and Solution Domain

Application Domain (Requirements Analysis):
 The environment in which the system is operating

Solution Domain (System Design, Object Design):
 The available technologies to build the system
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
16
What is UML?

UML (Unified Modeling Language)
 An emerging standard for modeling object-oriented software.
 Resulted from the convergence of notations from three leading
object-oriented methods:





OMT (James Rumbaugh)
OOSE (Ivar Jacobson)
Booch (Grady Booch)
Reference: “The Unified Modeling Language User Guide”,
Addison Wesley, 1999.
Supported by several CASE tools
 Rational ROSE
 Together/J
 ...
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
17
UML and This Course

You can model 80% of most problems by using about 20%
UML

In this course, we teach you those 20%
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
18
UML First Pass

Use case diagrams
 Describe the functional behavior of the system as seen by the user.

Class diagrams
 Describe the static structure of the system: Objects, Attributes, and
Associations.

Sequence diagrams
 Describe the dynamic behavior between actors and the system and
between objects of the system.

Statechart diagrams
 Describe the dynamic behavior of an individual object as a finite state
machine.

Activity diagrams
 Model the dynamic behavior of a system, in particular the workflow,
i.e. a flowchart.
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
19
UML First Pass: Use Case Diagrams
Package
SimpleWatch
Actor
ReadTime
WatchUser
Use case
SetTime
WatchRepairPerson
ChangeBattery
Use case diagrams represent the functionality of the system
from user’s point of view
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
20
UML First Pass: Class Diagrams
Class
Multiplicity
1
2
PushButton
state
push()
release()
Association
SimpleWatch
1
LCDDisplay
blinkIdx
blinkSeconds()
blinkMinutes()
blinkHours()
stopBlinking()
referesh()
1
1
1
2
1
Battery
load()
Time
now()
Attributes
Operations
Class diagrams represent the structure of the system
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
21
UML First Pass: Sequence Diagram
Object
:WatchUser
:SimpleWatch
:LCDDisplay
pressButton1()
blinkHours()
pressButton1()
blinkMinutes()
pressButton2()
:Time
incrementMinutes()
refresh()
pressButtons1And2()
commitNewTime()
stopBlinking()
Activation
Message
Sequence diagrams represent the behavior as interactions
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
22
UML First Pass: Statechart Diagrams
Initial state
Event
button1&2Pressed
Blink
Hours
button2Pressed
State
Increment
Hours
button1Pressed
Transition
button1&2Pressed
Blink
Minutes
button2Pressed
Increment
Minutes
button1Pressed
Stop
Blinking
Blink
Seconds
button2Pressed
Increment
Seconds
button1&2Pressed
Final state
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
23
Other UML Notations
UML provide other notations that we will be introduced in
subsequent lectures, as needed.

Implementation diagrams
 Component diagrams
 Deployment diagrams
 Introduced in lecture on System Design

Object Constraint Language (OCL)
 Introduced in lecture on Object Design
Bernd Bruegge & Allen Dutoit
Object-Oriented Software Engineering: Conquering Complex and Changing Systems
24
Download