Lecture 2
Lecture 2
Ebrahim Karami
ENGI-9874
Software Specification and Design
Overview for the Lecture
Three ways to deal with complexity
Abstraction and Modeling
Decomposition
Hierarchy
Introduction into the UML notation
First pass on:
Use case diagrams
Class diagrams
Sequence diagrams
Statechart diagrams
Activity diagrams
What is the problem with this Drawing?
Abstraction
• Chunking:
• Group collection of objects to reduce complexity
• 4 chunks:
• State-code, Area-code, Local-Prefix, Internal-Nr
Abstraction
• Complex systems are hard to understand
• The 7 +- 2 phenomena
• Our short term memory cannot store more than 7+-2
pieces at the same time -> limitation of the brain
• A Phone Number: 498928918204
• Chunking:
• Group collection of objects to reduce complexity
• State-code, Area-code, Local Prefix, Internal-Nr
Phone Number
Produce
Read Input Transform Level 1 functions
Output
?
Functional Decomposition: Autoshape
Autoshape
Change Draw
Autoshape
Draw()
Change()
What is This?
An Eskimo!
Cave
Ellbow Neck
Glove
Pocket
Coat
A Face!
Hair
Eye
Nose
Ear
Mouth
Chin
An Eskimo! A Face!
Cave Hair
Neck Eye
Ellbow Nose
Glove Ear
Pocket Mouth
Coat Chin
Class Identification
Basic assumptions:
We can find the classes for a new software
system: Greenfield Engineering
We can identify the classes in an existing
system: Reengineering
We can create a class-based interface to an
existing system: Interface Engineering
3. Hierarchy
So far we got abstractions
This leads us to classes and objects
“Chunks”
Concept
Describes the common properties of phenomena
Example: All lectures on software engineering
Example: All black watches
A Concept is a 3-tuple:
Name: The name distinguishes the concept from other
concepts
Purpose: Properties that determine if a phenomenon is a
member of a concept
Members: The set of phenomena which are part of the
concept.
Concepts, Phenomena, Abstraction and Modeling
Name Purpose Members
Definition Abstraction:
Classification of phenomena into concepts
Definition Modeling:
Development of abstractions to answer specific questions about a set of phenomena while
ignoring irrelevant details.
Abstract Data Types & Classes Superclass
Inheritance CalculatorWatch
calculatorState
Unlike abstract data types, subclasses
can be defined in terms of other EnterCalcMode()
classes using inheritance InputNumber(n)
• Example: CalculatorWatch
Subclass
Type and Instance
Type:
A concept in the context of programming languages
Name: int
Purpose: integral number
Members: 0, -1, 1, 2, -2,…
Instance:
Member of a specific type
System: Airplane
Models:
Flight simulator Views:
Scale model Blueprint of the airplane components
Electrical wiring diagram, Fuel system
Sound wave created by airplane
(UML Notation)
Class Diagram
* *
System Model View
Described by Depicted by
Airplane:
System
Object Diagram
TrafficController FlightPlanDatabase
Aircraft
TrafficControl
Airport FlightPlan
What is UML?
UML (Unified Modeling Language)
Nonproprietary standard for modeling software systems, OMG
Convergence of notations used in object-oriented methods
OMT (James Rumbaugh and collegues)
Booch (Grady Booch)
OOSE (Ivar Jacobson)
Actor.
System boundary
Actor
ReadTime
SetTime
WatchUser WatchRepairPerson
ChangeBattery
Multiplicity
SimpleWatch
1 1 1 1
2 1 2 1
PushButton Display Battery Time
Association
Class
Multiplicity Watch
1 1 1 1
2
1 2 1
PushButton
state LCDDisplay Battery Time
blinkIdx Load Now
push() blinkSeconds()
release() blinkMinutes()
blinkHours()
stopBlinking()
Operations
Attribute referesh()
UML first pass: Sequence diagram
Actor Message Object Lifeline
:WatchUser :Watch :LCDDisplay :Time
pressButton1() blinkHours()
pressButton1()
blinkMinutes()
pressButton2()
incrementMinutes()
refresh()
pressButton1and2()
commitNewTime()
stopBlinking()
Activation
Transition button1Pressed
button1&2Pressed button2Pressed
Blink Increment
Minutes Minutes
State
button1Pressed
button2Pressed
Stop Blink Increment
Blinking Seconds Seconds
Final state