SoftwareEngineering Fall24 L2
SoftwareEngineering Fall24 L2
Fundamentals of Software
Engineering
Software Modeling
Lecture 2
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
What is the problem with this Drawing?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
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
• Phone Number: 2023350190780
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
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
• Phone Number: 2023350190780
• Chunking:
• Group collection of objects to reduce complexity
• 4 chunks:
• Country-code, city-code, Place-code, Office-Part
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
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
• Phone Number: 2023350190780
• Chunking:
• Group collection of objects to reduce complexity
• Country-code, city-code, Place-code, Office-Part
Phone Number
• Chunking:
• Group collection of objects to reduce complexity
• Country-code, city-code, Place-code, Office-Part
Phone Number
20 2 335-0190 780
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
Abstraction
• Abstraction allows us to ignore unessential details
• Two definitions for abstraction:
• Abstraction is a thought process where ideas are
distanced from objects
• Abstraction as activity
• Abstraction is the resulting idea of a thought process
where an idea has been distanced from an object
• Abstraction as entity
• Ideas can be expressed by models
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
Model
• A model is an abstraction of a
system
• A system that no longer exists
• An existing system
• A future system to be built.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
We use Models to describe Software
Systems
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
2. Technique to deal with Complexity:
Decomposition
• A technique used to master complexity
(“divide and conquer”)
• Two major types of decomposition
• Functional decomposition
• Object-oriented decomposition
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Object-oriented vs. functional
decomposition
• Functional decomposition
• The system is decomposed into modules
• Each module is a major function in the application
domain
• Modules can be decomposed into smaller modules.
• Object-oriented decomposition
• The system is decomposed into classes (“objects”)
• Each class is a major entity in the application
domain
• Classes can be decomposed into smaller classes
Produce
Read Input Transform Level 1 functions
Output
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
Functional Decomposition
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
Functional Decomposition
?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Functional Decomposition: Autoshape
Autoshape
Change Draw
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
Object-Oriented View
Autoshape
Draw()
Change()
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
What is This?
An Eskimo!
Cave
Neck
Ellbow
Glove
Pocket
Coat
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
A face
Hair
Eye
Nose
Ear
Mouth
Chin
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
An Eskimo! A Face!
Cave Hair
Neck Eye
Ellbow Nose
Glove Ear
Pocket Mouth
Coat Chin
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22
Class Identification (cont’d)
• Can we do this?
• Yes - science, experimental evidence
• What are the limitations?
• Depending on the purpose of the system,
different objects might be found
• Crucial
Identify the purpose of a system
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
Modeling a Briefcase
BriefCase
Capacity: Integer
Weight: Integer What is this thing?
Open()
Close()
Carry()
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
A New Use of a Briefcase
BriefCase
Capacity: Integer
Weight: Integer
Open()
Close()
Carry()
SitOnIt()
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
3. Hierarchy
• So far we got abstractions
• This leads us to classes and objects
• “Chunks”
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
Part-of Hierarchy (Aggregation)
Computer
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27
Is-Kind-of Hierarchy (Taxonomy)
Cell
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28
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
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Systems
• A system is an organized set of communicating parts
• Natural system: A system whose ultimate purpose is not
agreed upon
• Engineered system: A system which is designed and built by
engineers for a specific purpose
• The parts of the system can be considered as
systems again
• In this case we call them subsystems
System: Airplane
Models:
Flight simulator Views:
Scale model Blueprint of the airplane components
Electrical wiring diagram, Fuel system
Sound wave created by airplane
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
Systems, Models and Views (UML Notation)
Class Diagram
* *
System Model View
Described by Depicted by
Airplane:
System
Object Diagram
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Model-driven Software Development
Reality: A stock exchange lists many companies. Each
company is identified by a ticker symbol
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 36