Fall 2016
Soongsil University
Office 02-820-0909 Mobile 010-7392-2220 Lab. 02-824-0909
sdkim777@gmail.com
http://soft.ssu.ac.kr
1
Copyright Notice
All materials contained in this document are protected by copyright laws and
may not be reproduced, distributed, transmitted, displayed, published or
broadcast without the prior written permission of the author or in the case
of third party materials, the owner of that content. You may not alter or
remove any trademark, copyright or other notice from copies of the content.
Copyright 2016 by Soo Dong Kim, All Rights Reserved.
Contents
Unit
Title
Slide#
42
53
123
Designing Components
149
Designing Database
189
226
263
Concluding Remarks
281
Unit 1.
Nature of Software Design
SW Design (1)
[SWEBOK 2014]
SW Design (2)
Analysis
Design
Invention
Design-level Decisions
Implementation in Mind
Implementation
Benefits
To elicit requirements
To visualize the system
To specify the system precisely
To document the decisions made on the system
To provide templates for guiding implementation
Dynamic View
Functional View
Target
System
9
Structural View
Dynamic View
10
Design Artifacts
Analysis
Preliminary
Design (PIM)
Detailed
Design (PSM)
Implementation
2016 Soo Dong Kim
Software Design Principles and Techniques
Software Design
System Modeling
Requirement
Definition
Architecture
Architecture Styles
Views and Perspectives
Non-Functional Requirements
User Interface
Conventional UI
UI for Embedded Systems
Components for Control Layer
Use Cases
Workflow
Algorithms, Parallelism
State Behavior, Realtime
Hardware Interface, HAL
Components for Model Layer
(Encapsulated) Objects
Database
Database Schema
11
Structural
Diagram
Class
Diagram
Component
Diagram
Composite
Structure Diag.
Profile
Diagram
Behavior
Diagram
Object
Diagram
Deployment
Diagram
Activity
Diagram
Package
Diagram
Use Case
Diagram
Interaction
Diagram
Sequence
Diagram
Interaction
Overview Diag.
Communication
Diagram
2016 Soo Dong Kim
Software Design Principles and Techniques
State Machine
Diagram
Timing
Diagram
12
Software Quality
Definition
Three Emphases
13
Quality Model
Part 2
External Metrics
Part 3
Internal Metrics
Part 4
14
Product Quality
External quality
15
16
Software Product
Influences
Influences
Internal
Quality
Attributes
Process
Quality
Influences
External
Quality
Attributes
Depends on
Depends on
Effect of Software
Product
Quality
in Use
Attributes
Depends on
Contexts
of Use
Process
Measures
Internal
Measures
External
Measures
Quality in Use
Measures
17
Characteristic
Level 2.
Sub-characteristic
Level 3.
Metrics
Formula
18
Functionality
Reliability
Usability
Efficiency
Maintainability
Portability
Suitability
Accuracy
Interoperability
Security
Functionality
Compliance
Maturity
Fault Tolerance
Recoverability
Understandability
Time Behavior
Analysability
Changeability
Stability
Testability
Maintainability
Compliance
Adaptability
Installability
Co-Existence
Replaceability
Portability
Compliance
Reliability
Compliance
Learnability
Operability
Attractiveness
Usability
Compliance
Resource
Utilization
Efficiency
Compliance
19
Six Characteristics
1. Functionality
2. Reliability
3. Usability
20
Six Characteristics
4. Efficiency
5. Maintainability
6. Portability
21
Sub-characteristics of Functionality
Suitability
Accuracy
Interoperability
22
Sub-characteristics of Functionality
Security
Functionality Compliance
23
Sub-characteristics of Reliability
Maturity
Fault Tolerance
24
Sub-characteristics of Reliability
Recoverability
Reliability Compliance
25
Sub-characteristics of Usability
Understandability
Learnability
Operability
26
Sub-characteristics of Usability
Attractiveness
Usability Compliance
27
Sub-characteristics of Efficiency
Time Behavior
Resource Utilization
Efficiency Compliance
28
Sub-characteristics of Maintainability
Analyzability
Changeability
Stability
29
Sub-characteristics of Maintainability
Testability
Maintainability Compliance
30
Sub-characteristics of Portability
Adaptability
Installability
Co-existence
31
Sub-characteristics of Portability
Replaceability
Portable Compliance
32
Quality In Use
Quality Model for Quality in Use
Quality In Use
Effectiveness
Productivity
Safety
Satisfaction
33
Four Characteristics
1. Effectiveness
2. Productivity
34
Four Characteristics
3. Safety
4. Satisfaction
35
Software Reviews
Concept
Types of review
Informal Review
Formal Technical Review (FTR)
Walkthrough
36
Defect (Fault)
Error
Objective of Review
Industry Studies
37
of developing software.
Detection
Percent
efficiency
for error
detection
A Development Step
Errors passed
to next step
38
0
0
10
0%
10 6
Detail design
4 X 1.5
x = 1.5
0%
25
Code/unit test
37
10
27 X 3
x =3
20%
94
25
94
Integration test
To Integration
47
0
0
50%
Validation test
0
0
50%
24
System test
0
0
50%
12
Latent errors
2016 Soo Dong Kim
Software Design Principles and Techniques
39
0
0
10
70%
3 2
24
Integration test
12
0
0
50%
Detail design
2
1 X1.5 50% 15 5 Code/unit test
5
25
24
10
X
3
60%
10
25
To Integration
Validation test
0
0
50%
System test
0
0
50%
3
Latent errors
40
Defects on SRS
Typical Problems in SRS
Incompleteness
Inconsistency
Redundant
Ambiguity
Irrelevant
Software Requirement
Specification (SRS)
Incompleteness
Inconsistency
Real
Requirement
X
Y
Z
Q
Redundant
Ambiguity
Irrelevant
41
Unit 2.
Principles of Software Design
42
P2. Refinement
P3. Separation of Concerns
P4. Modularity
P5. Functional Independence
P6. Information Hiding
43
Principle 1. Abstraction
Many levels of abstraction
Procedural Abstraction
Data Abstraction
44
Principle 2. Refinement
Refinement
45
It follows that;
46
Examples)
Separation of Functionality
Separation of Layers
47
Principle 4. Modularity
Modularity
48
Functional independence
Independence
49
Features
Data Coupling
A & B communicate
by simple data only.
Stamp Coupling
A & B use
a common type of data.
Control Coupling
A transfers control to B
by procedural call.
Necessary
A passes a flag to B
to tell it how to behave.
Content Coupling
Desirability
Undesirable
To Avoid
50
Features
Desirability
Data Cohesion
Very High
Functional Cohesion
High
Sequential Cohesion
Okay
Communicational Cohesion
Moderate
Procedural Cohesion
Low
Temporal Cohesion
Low
Logical Cohesion
To Avoid
Coincidental Cohesion
To Avoid
51
Paradigm
52
Unit 3.
Designing Software Architecture
53
54
55
Architecture
56
57
Software Architecture
Definitions
Structure or structures of the system, which comprise software elements, the externally
visible qualities of those elements, and the relationships among them [Bass et el]
Design that involves the description of elements from which systems are built,
interactions among those elements, patterns that guide their composition, and constraints
on these patterns [Shaw and Garlan]
Software architecture deals with the design and implementation of the high-level
structure of software. Architecture deals with abstraction, decomposition, composition,
style, and aesthetics [Kruchten]
58
Functional
Requirement
OOAD
Non-Functional
Requirement
SW Architecture
requirements.
Reusing architectural knowledge for productivity and quality
2016 Soo Dong Kim
Software Design Principles and Techniques
59
Architecture Styles
60
Cantilever Style
Arch Style
Suspension Style
61
62
Client/Server
Tiered Computing
Peer-to-Peer
Layered Implementation
Publisher/Subscriber
Distribution Tree
Integration Hub
Tuple Space
63
Influenced Styles
subroutines
Object-oriented
Layered
Virtual machines
Client-server
Dataflow Styles
Batch-sequential
Pipe-and-filter
Shared Memory
Interpreter
Interpreter
Mobile code
Implicit Invocation
Publish-subscribe
Event-based
Peer-to-Peer
Complex Styles
C2 (Components and
Connectors)
Distributed Objects
Blackboard
Rule-based
2016 Soo Dong Kim
Software Design Principles and Techniques
64
Balanced MVC
When an application consists of two types of functionality;
65
Structure (1)
Partitioning Functionality & Dataset into two parties.
Mobile Device
Server
View Layer
(C.View)
Control Layer
(C.Control)
Internet
Control Layer
(S.Control)
Model Layer
(C.Model)
Model Layer
(S.Model)
Local
DB
Master
DB
Mobile Device
Server
66
Structure (2)
Mobile device may maintain a local cache DB for benefits,
67
Structure (3)
C.Control vs. S.Control
C.Control carries out the business process logics for a userspecific system.
S.Control implements common business logics that can be
reused by multiple users.
68
Structure (4)
Mobile Device
C.View
Server System
Internet
C.View
C.Control
C.View
C.Control
C.View
C.Control
S.Control
Internet
Internet
S.Control
Internet
S.Model
Type #1
S.Model
Type #2
S.Model
Type #3
S.Model
Type #4
S.Model
Type #5
C.Model
C.View
C.Control
Internet
S.Control
C.Model
2016 Soo Dong Kim
Software Design Principles and Techniques
69
Structure (5)
Type 1
Only S.Control and S.Model exist.
Realizing thin client side for resolving resource constraints
Always needs network capability
Type 2
Only C.Control and S.Model exist.
Applicable situations
Type 3
Both C.Control and S.Control, and also S.Model exist.
Applicable situations
Intensive interaction between C.View and C.Control, and S.Control and S.Model
Low interaction between C.Control and S.Control
70
Structure (6)
Type 4
Type 5
71
Structure (7)
Type
Computation
on Client Side
Network Overhead
Parallelism
Low
Low
Low
Middle
High
Low
Middle
Low
High
High
High
Middle
High
Low
High
72
Interaction (1)
Diverse Interaction Paths
Client System
on Mobile Device
Server System
C.View
S.View
User
C.Control
1
S.Control
C.Model
System
Administrator
S.Model
4
C.DB
S.DB
73
Interaction (2)
Path 1 : between C.Control and C.Model
and S.Control.
74
Interaction (3)
Path 4: between C.Model and S.Model
75
Interaction (4)
C.Control manages its business process by invoking other components.
:C.View
:C.Control
:C.Model
:S.Control
:S.Model
Users
76
Example
Mobile Mate Service
View Layer
Member
Form
ProfileForm
GroupForm
Invitation
Form
LoginForm
HelpForm
TextMessage
Form
cMemberCtrl
cGroupCtrl
cMiscellCtrl
sGroupCtrl
sMiscellCtrl
Profile
ColleagueList
MemberSub
sMemberCtrl
Profile
Colleague
ColleagueList
Group
Member
Colleague
Group
Invitation
TextMessage
77
Cons
Network overhead
May need to synchronize replicated objects.
78
79
application
no
Classes in
Client Side?
Calculate
Depends(V, C)
yes
Calculate
Depends(C, M)
High?
High?
no
Apply Pattern 1
no
yes
Calculate
Depends(C, M)
yes
Apply Pattern 4
Apply Pattern 5
no
Apply Pattern 2
2016 Soo Dong Kim
Software Design Principles and Techniques
Depends(A, B)
yes
Apply Pattern 3
Estimated degree of
dependency between A and B
Measured by the intensity of
message exchanges in the use
case descriptions.
80
Classes in C.View
From interactions between actor and client system specified in use case
descriptions
Classes in the object models
From interactions between actor and client system, and between client
system and service system in the use case description
81
Control Layer
Customer
Manager
Inventory
Manager
Reservation
Manager
Rental
Manager
Report
Generator
Model Layer
0..*
Reservation
0..*
0..*
1..*
AutoType
1
Customer
1
0..*
Rental
AutoItem
82
83
ArchitecturalView
Definition
Strategy
84
FunctionalView
Describes systems functional elements, their
85
InformationView
Describes the way that the architecture stores, manipulates,
86
ConcurrencyView
Describes the concurrency structure of the system.
Consider
87
DeploymentView
Describes the environment into which the system will be
deployed.
Consider
Hardware Environment
Technical environment
Mapping of software elements to the runtime environment that
will execute them
88
OperationalView
Describes how the system will be operated, administered,
89
ArchitecturalView Groups
Deployment
View
defines
operation of
Operational
View
defines
runtime environment for
Context
View
defines scope,
context,
and interfaces for
Functional
View
Software
Design
Information
View
defines
implementation
constraints for
Development
View
Concurrency
View
90
ArchitecturalViewpoint
Definition
knowledge.
Benefits
Separations of Concerns
Communication with Stakeholder Groups
Management of Complexity
Improved developer focus
91
ArchitecturalView Catalog
Deployment
View
defines
operation of
Operational
View
defines
runtime environment for
Context
View
defines scope,
context,
and interfaces for
Functional
View
Software
Design
Information
View
defines
implementation
constraints for
Development View
Concurrency View
92
Overview of FunctionalViewpoint
Functional Viewpoint
Definition
Concerns
Models
Problems and
Pitfalls
Stakeholders
All stakeholders
Applicability
All systems
93
Overview (2)
To define architectural elements that deliver the systems
functionality
94
On projects
95
Inward Data
Outward Data
96
such as;
97
What the system does and the interfaces it presents to user and
to other system
How well the architecture adheres to sound principles of design
Good architecture to build, operate, and enhance easily
98
Design Philosophy
Description
Significance
High separation
(+)to build, support, and enhance easier
(-)Performance and scalability
Cohesion
Coupling
Volume of
Interactions
Functional
Flexibility
Overall
Coherence
Specification
of concerns
99
Concerns
Acquirers
Assessors
All concerns
Communicators
Developers
System
administrators
Testers
Users
100
Systems Elements
Functional Elements
Interfaces
Connectors
External entities
101
Variable
Reporting
Variable Capture
Component interface
and use by another
component
{type=XML RPC,
protocal=HTTP,
number = 10 concurrent}
external
Temperature Monitor
Limit Condition
Alarm Initiator
Stereotype used
to indicate an
external entity
UML component
represents system
element
102
Customer
Web Browser
{type=HTML user interface,
protocol=HTTP,
number=1000 concurrent}
external
Customer Care
Interface
{number=80
concurrent}
external
Customer Admin
Web Browser
Customer Web
Interface
WebShop
Customer
Management
Interface
Manage
Customer
Customer
Information
System
Employee Web
Interface
Query
Customer
Place Order
Order
Processor
Receive Message
{type=API callback}
Query
Catalog
Product
Catalog
{type=RPC,
protocol=LU6.2}
{type=API call}
Publish
Message
infrastructure
Message Bus
Manage
Catalog
checklevel
Stock
Inventory
Order message
propagated via PUR1
EAI message end point
to order fulfillment.
Receive
Message
external
Order
Fulfillment
2016 Soo Dong Kim
Software Design Principles and Techniques
103
Assign Responsibilities to
the Elements
104
Architecture Perspectives
105
Orthogonal to Viewpoints
Issues addressed by architectural perspectives are often
106
Explanation
Applicability
Concern
Activities
Architectural Tactics
To explain the most common things that can go wrong and gives
guidance on how to recognize and avoid them
Checklists
Further Reading
107
Accessibility Perspective
Performance Perspective
Location Perspective
Availability Perspective
Regulation Perspective
etc.
Context View
Functional View
Development View
Information View
Deployment View
Concurrency View
Operational View
108
Applicability
The ability of the system to reliably control, monitor, and audit who can perform
what actions on these resources and the ability to detect and recover from
failures in security mechanisms
Any systems with publicly accessible interfaces, with multiple users where the
identify of the user is significant, or where access to operations or information
needs to be controlled
Concerns
Activities
Architectural
Tactics
Problems and
Pitfalls
109
Applicability toViews
View
Functional
Applicability
To allow to see which of the systems functional elements need to be
protected
The functional structure of the system may be impacted by the need to
implement security policies.
Information
To help you see what needs to be protected, i.e. sensitive data in the
system
To be modified as a result of security design (e.g. partitioning information
by sensitivity)
Concurrency
Development To identify guidelines or constraints that the software developers will need
to be aware of in order to ensure the security policy is enforced
Deployment
Operational
110
Concerns (1)
Policies
To define controls and guarantees that the system requires for its resources
The different types of principals the system contains
For each type of information, what sort of access each principal group
requires
Threats
111
Concerns (2)
Security Mechanisms
A set of technologies, configuration setting, and procedures required
to enforce the rules established by the security policy
To select the right set of technologies from the wide array available
and to apply them appropriately for the system
Accountability
Availability
112
Micro Process
Identify Sensitive
Resources
Identify Threats to
System
Design Security
Implementation
Not Acceptable
Acceptable
113
114
Sensitivity
Owner
Access Control
Customer account
records
Customer Care
Group
Descriptive
product catalog
entries
Stock
Management
Group
Pricing product
catalog entries
Pricing Team in
Stock
Management
Group
Business
operations on
customer account
records
Needs to be controlled to
protect data access and integrity
Customer Care
Group
Access to individual
record or all records by
authenticated principal
Descriptive
catalog operations
Needs to be controlled to
protect data access and integrity
Stock
Management
Group
Access to catalog
modification operations
by authenticated principal
115
116
117
Consider;
The security threats your system faces from the perspective of the
sensitive resource
The possible access to these resources that potential attackers might wish
to gain
The main characteristics of the potential attackers
The types of attacks they are likely to carry out
118
Desc. Catalog
Records
Pricing
Records
User Account
Operations
Desc. Catalog
Operations
Data
Administrator
Catalog Clerk
None
None
None
All
Read-only
Operations
Catalog Manager
None
None
None
Read-only
operations with
audit
All
Product Price
Administrator
None
None
None
None
Read-only
Operations
Customer Care
Clerk
None
None
None
All
Read-only
Operations
Registered
Customer
None
None
None
All on own
record
Read-only
Operations
None
None
None
None
Read-only
Operations
119
To include;
120
Estimated
Likelihood
Notional Cost
Risk
Estimated
Cost
$8,000,000
0.2%
$16,000
$800,000
4%
$32,000
$4,000,000
1.5%
$60,000
121
SRS
Implementation
Architecture
Styles
Architecture
Viewpoints
Architectural
Tactics for NFR
122
Unit 4.
Designing User Interface
123
User Familiarity
Consistency
Minimal Surprise
Recoverability
User Guidance
User Diversity
124
125
ISO 9241-210
126
Definition of UX
A person's perceptions and responses that result from the
ISO 9241-210
ISO 9241-210
127
Principles of UX (1)
User Experience Honeycomb
128
Principles of UX (2)
Useful
Usable
Desirable
129
Principles of UX (3)
Findable
Accessible
Credible
Valuable
130
131
Apple
http://developer.apple.com
As of 2013.05.01
219 Pages
Guidelines
132
133
9 Platform Characteristics
Display Is Paramount, Regardless of Its Size
134
Consistency
Direct Manipulation
Feedback
Metaphors
User Control
135
Examples
136
Principle 2. Consistency
To allows people to transfer their knowledge and skills from
Considerations
137
controls
Examples
Manipulation
138
Principle 4. Feedback
To acknowledges peoples actions and assures them that
processing is occurring
Examples
To animate the addition of a new row to help people track the change
visually
139
Principle 5. Metaphors
To suggest a usage or experience without enforcing the
140
141
142
143
32 UX Guidelines (1)
1.
14. Be Succinct
2.
3.
4.
5.
6.
7.
8.
9.
Necessary
23. Make Modal Tasks Occasional and
Simple
Description
2016 Soo Dong Kim
Software Design Principles and Techniques
Agreement or Disclaimer
144
32 UX Guidelines (2)
28. For iPad: Enhance Interactivity
29. For iPad: Reduce Full-Screen
Transitions
30. For iPad: Restrain Your Information
Hierarchy
31. For iPad: Consider Using Popovers for
the Top
145
Passbook
Social Media
iCloud
Privacy
Quick Look Document
Preview
In-App Purchase
Sound
Game Center
Multitasking
Edit Menu
Notification Center
Printing
146
Content Views
Alerts, Action Sheets, and Modal Views
Controls
System-Provided Buttons and Icons
147
App Icons
Launch Images
Small Icons
Document Icons
Newsstand Icons
148
Unit 5.
Designing Components
149
Types of Components
Components for Running Workflows
Control Layer
Model Layer
Proxy-Type Components
RMI
150
151
Class (1)
A class specifies related attributes and their operations.
UML Notation
Rectangle
Class Name
p1:Point
p2:Point
Attributes
area():Real
aspect():Real
.
move(int x, int y);
scale(float r);
Operations
152
Class (2)
Name of Classes
Noun Phrase
Example)
Customer
Staff
Product
Rental
Reservation
controller
PenTracker
{leaf, author = Mary Jones}
153
Class (3)
Incremental Refinement
Window
Conceptual Level
Window
size:Area
visibility:Boolean
display()
hide()
Window
{abstract, author=Joe}
+size:Area = (100,100)
#visibility:Boolean=true
+default-size:Rectangle
+display()
+hide()
-attachXWindow(xwin:Xwindow*)
2016 Soo Dong Kim
Software Design Principles and Techniques
154
Association
Aggregation
Composition
A strong aggregation
Inheritance
A parent-of relationship
155
Weaker
Dependency
Dashed Arrow
Stronger
Association
Aggregation
Composition
Inheritance
Empty Arrow
When one class is a
type of another class
156
Dependency
Definition
Example
invoke
Exchange Rate
0..*
Currency
157
Association
Definition
Customer
Bank
Account
Passenger
Flight
Ticket
158
Rental
Car Item
R 21
John
R8
R7
Susan
Ohio
E331AV
R2
R 13
Mike
CA
4AQ688
PENN
GHG529
R1
R 15
CA
7YG233
159
{xor} Constraint
Usage
Example
Person
Account
{xor}
Corporation
160
Cardinality (1)
Semantics
Notation
Class
Exactly One
0..*
Class
0..1
Class
m..n
Class
Numerically Specified
161
Cardinality (2)
{ordered}
3..*
{ordered}
p1
p2
Point
p5
p3
Person
0..*
{ordered}
Employment 1..*
1..*
p4
Company
0..*
/employer
E5
2004.9.1 ~ 2010.3.31
E 62
2010.4.1 ~ 2010.7.20
E88
2012.1.2 ~ Current
#1
John
#2
#3
162
Cardinality (3)
Car Rental System
Person
0..*
Customer
Reservation 0..*
1
1
Car Model
1
0..1
0..*
0..*
0..1
Rental
0..*
Car Item
0..*
Staff
163
Cardinality (4)
eCommerce System
Manufacturer
0..*
Product
Model
1
0..*
Customer
0..*
Order
1
0..*
Payment
Credit Card
Payment
Bank
Transfer
0..1
1..*
Product
Item
1
0..1
Delivery
PayPal
164
Derived Attribute
Derived Association
Time Period
start: Date
end: Date
/duration: Date
Use a slash, /
Consideration
Redundancy
Efficiency
Person
0..*
Employment 1..*
{ordered}
1..*
Company
0..*
/employer
165
Composition
Polygon
After Deletion
{ordered} 3..*
Point
2016 Soo Dong Kim
Software Design Principles and Techniques
Fill Pattern
166
p1
Independent Existence
Triangle
1
3
t7
Point
p2
p3
Aggregation
p1
Point
p1
After Deletion
t7
p2
p3
p2
p3
Composition
Triangle
1
3
Point
t7
p2
After Deletion
p3
167
Inheritance
Definition
Superclass, Subclass
Account
Checking
Account
Person
Savings
Account
Customer
Staff
168
Realization
Definition
Notation
MAPS API
Specification
Realizes
Google MAP
Naver MAP
Implementation
169
Interface
An interface only has method signatures, not their
implementations.
An interface specifies a protocol for a class or a component.
An interface cannot be instantiated, it can only be realized.
Use interface
Can an interface have attributes?
170
Interface Realization
Interface iSensor
interface
iSensor
- sensorID
+ start();
+ stop();
+ read(): string;
+ getStatus(): string;
Proximity Sensor
interface
iSensor
interface
iSensor
171
Provided Interface
A provided interface of a class is an interface
realizes.
A component's provided interface describes the services
Proximity Sensor
iSensor
Provided Interface
Proximity Sensor
iSensor
interfaces.
2016 Soo Dong Kim
Software Design Principles and Techniques
172
needs to function.
The class invokes the needed services only through the required
interface.
Required Interface
Theft Alarm
iSensor
173
interface
iSensor
- sensorID: integer
Role of
Service Provider
+ start();
+ stop();
+ read(): string;
+ getStatus(): string;
iSensor
Role of
Service Consumer
Theft Alarm
Proximity Sensor
Class ProximitySensor
implements iSensor; {
Role of
Standardization
iSensor
Class TheftAlarm {
TheftAlarm (iSensor s, ) { };
check( ) {
s.read( );
}
}
ProximitySensor ps =
new ProximitySensor ();
TheftAlarm myAlarm =
new TheftAlarm (ps, );
myAlarm.check( );
174
Variability Modeling
Standardization
Control for
Powered or Manual
Control for
Forward or Backward
Control for
Move or Stop
Plug-in Objects,
i.e. Variants
175
Technologies
Design Patterns
Component-based Development (CBD)
Product-Line Engineering (PLE)
Service-Oriented Architecture (SOA)
Cloud Computing
Model-Driven Architecture (MDA)
Related Terms
Plug-n-Play Scheme
Mix-n-Match Scheme
Mash-up Service Composition
Service Dynamic Adaptation
Building System by
Assembling Software Parts
Maintaining System by
Exchanging Software Parts
176
Utility
A class that has no instances, but rather specifies a named
MathPak
+ Sin(Angle) : Real
+ cos(Angle): Real
+ Sqrt(Real): Real
+ Random():Real
177
178
Overview
Shows the definition, internal structure, and dependencies
of component types.
Necessity
179
Interface
Port
Connector
180
Component
Definition
Notation
Keyword <<component>>
A component icon in the right hand corner
<<component>>
Order
Semantic
181
Component Description
Basic Components
Packaging Components
182
Interface
Provided Interface
An interface that the component provides as a service to other
components
To be realized directly by the component
Provided Interface
<<component>>
Required Interface
Provided Port
Order
Required Interface
Required Port
2016 Soo Dong Kim
Software Design Principles and Techniques
<<component>>
Order
183
Connector
Definition
An extended concept in the Components package to include
contracts and notation
A link that enables communication between two or more
instances
Delegation Connector
Assembly Connector
184
Delegation Connector
Definition
Notation
Semantics
185
Order
:OrderHeader
:LineItem
Person
186
Assemble Connector
Definition
Notation
Semantics
187
:Order
OrderableItem
OrderableItem
<<component>>
:Product
188
Unit 6.
Designing Database
189
190
3 Types of Instantiations
191
192
dbCreateObj ( );
dbRetrieveObj ( );
dbUpdateObj ( );
dbDeleteObj ( );
Creating a new record in the database table.
193
Business Methods
getMethod-1 ( );
setMethod-2 ( );
Database Operations
private dbCreateObj ( _);
private dbRetrieveObj ( _);
private dbUpdateObj ( );
private dbDeleteObj ( );
Database
194
Using a flag
A (x, y);
A (x, y, db);
195
Mapping Inheritance
Horizontal Partitioning
Vertical Partitioning
Unification
196
Horizontal Partitioning
Entire object within one table
197
Horizontal Partitioning
Each concrete class is mapped to a table
Account
Owner
name_ : String
taxId_ : String
id_ : String
balance_ : double
owner_
1
OwnerTable
name
taxId
InterestBearingAccount
rate_ : double
termDays_ : int
CheckingAccount
checkFee_ double
CheckingAccountTable
id
balance
ownerID
checkFee
InterestBearingAccountTable
id
balance
ownerID
rate
termDays
198
Horizontal Partitioning
Good strategy when changing types is rare
Advantages
Disadvantages
Change to a class will affect its table and the table of its
subclasses
Whenever an object changes its role, you need to copy data into
the appropriate table
199
Vertical Partitioning
Object spread across different tables
properties
200
Vertical Partitioning
Each class is mapped to a table
Account
Owner
name_ : String
taxId_ : String
id_ : String
balance_ : double
owner_
1
OwnerTable
name
taxId
AccountTable
id
balance
InterestBearingAccount
ownerID
rate_ : double
termDays_ : int
CheckingAccount
checkFee_ double
InterestBearingAccountTable
id
rate
termDays
CheckingAccountTable
id
2016 Soo Dong Kim
Software Design Principles and Techniques
checkFee
201
Vertical Partitioning
Good strategy when types change often
Advantages
Disadvantages
202
Unification
Entire object within one table
203
Unification
Each sub-class is mapped to the same table
Owner
name_ : String
taxId_ : String
Account
owner_
id_ : String
balance_ : double
InterestBearingAccount
rate_ : double
termDays_ : int
OwnerTable
name
CheckingAccount
checkFee_ double
taxId
AccountTable
id
accType
balance
ownerId
rate
termDays
checkFee
204
Unification
Advantages
Simple
Easy to add classes
Easy support for polymorphism
Single table leads to good data access performance
Disadvantages
205
206
Types of Databases
Relational Database
Object-Oriented Database
NoSQL Database
Key-Value Stores
Document-Oriented Databases
Column-Oriented Databases
Graph Databases
207
Pros
Cons
208
MySQL
MariaDB
Oracle Database
IBM DB2
209
NoSQL (1)
Not no to SQL
points
being non-relational, distributed, open-source and horizontally
scalable.
Often more characteristics apply as: schema-free, easy
replication support, simple API, eventually consistent (BASE,
not ACID), a huge data amount, and more
210
NoSQL (2)
Main objective: implement distributed state
To improve performance
Simple interface:
211
212
Both data and use cases are getting more and more dynamic.
Social networks (relying on graph data) have gained
impressive momentum.
by RDBMS.
213
Big Data
214
Economics
215
Support
Administration
216
Expertise
217
Key-value databases
Document databases
Column-family (column-oriented/columnar) stores
Graph databases
Non-core:
Object databases
XML databases
218
Key-value Database
A simple hash table (map), primarily used when all access to the
database is via primary key
Basic operations:
Get the value for the key
Put a value for a key
Delete a key from the data store
219
Column families
220
221
Documents are
Self-describing
Hierarchical tree data structures
Can consist of maps, collections (lists, sets, ), scalar values, nested
documents,
222
223
e.g., name
224
225
Unit 7.
Design with Patterns
226
227
Motivation
Software Cost
& Productivity
Reusable
Software Assets
Software
Quality
Library
Design
Patterns
Components
Services
Process
228
Design Patterns
To represent solutions to problems that arise when
designs
229
of programming
230
Structural Patterns
Behavioral Patterns
231
5 Creational Patterns
Factory Method
Abstract Factory
Builder
Prototype
Singleton
232
7 Structural Patterns
Adapter
Bridge
Composite
Decorator
Faade
Flyweight
Proxy
233
11 Behavioral Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template Method
Visitor
234
Key Principles
Successful patterns and frameworks can be boiled down to a
Common Stable
Variable Unstable, To be resolved
235
Open/Closed Principle
Determining Common vs. Variable Features
Open/Closed principle
236
For Common?
For Variable?
Impacts
Abstraction is good
Inheritance and polymorphism are good
Public data members and global data are bad
Run-time type identification can be bad
237
Proxy Pattern
238
Intent
A proxy is
There are situations in which a client does not or can not reference an
object directly, but wants to still interact with the object.
A proxy object can act as the intermediary between the client and the
target object.
The proxy object has the same interface as the target object.
The proxy holds a reference to the target object and can forward requests to
the target as required (delegation!).
In effect, the proxy object has the authority the act on behalf of the client to
interact with the target object.
239
Types of Proxy
Remote Proxy
Virtual Proxy
240
Structure
Subject
+ request() : void
RealSubject
realSubject
+ request() : void
aClient
subject
Proxy
+ request() : void
aProxy
aRealSubject
realSubject
241
Participants (1)
Proxy (ImageProxy)
Proxy may refer to a Subject if the RealSubject and Subject interfaces are
the same.
Remote Proxies To encode a request and its arguments and send the
encoded request to the real subject in a different address space
Virtual Proxies To cache additional information about the real subject so
that they can postpone accessing it
Protection Proxies To check that the caller has the access permissions
required to perform a request
242
Participants (2)
Subject (Graphic)
RealSubject (Image)
243
State Pattern
244
Intent
Allow an object to alter its behavior when its internal state
changes.
The object will appear to change its class.
Use the State pattern whenever:
The State pattern puts each branch of the conditional in a separate class.
245
Motivation
A TCPConnection object receives requests from other
state
+ open() : void
+ close() : void
+ acknowledge() : void
TCPState
+ open() : void
+ close() : void
+ acknowledge() : void
TCPEstablished
TCPListen
TCPClosed
+ open() : void
+ close() : void
+ acknowledge() : void
+ open() : void
+ close() : void
+ acknowledge() : void
+ open() : void
+ close() : void
+ acknowledge() : void
246
Structure
Context
+ request() : void
State
state
+ handle() : void
ConcreteStateA
+ handle() : void
ConcreteStateB
+ handle() : void
247
Participants
Context (TCPConnection)
State (TCPState)
TCPClosed)
248
249
Intent
Define the skeleton of an algorithm in an operation,
250
Motivation (1)
Consider an application framework that provides Application
Document
+ save() : void
+ open() : void
+ close() : void
+ doRead() : void
Application
docs
*
MyDocument
+ doRead() : void
+ addDocument() : void
+ openDocument() : void
+ docreateDocument() : void
+ canOpenDocument() : void
+ aboutToOpenDocument() : void
MyApplication
create
+ doCreateDocument() : void
+ canOpenDocument() : void
+ aboutToOpenDocument() : void
251
Motivation (2)
}
}
252
Structure
AbstractClass
+ templateMethod() : void
+ primitiveOperation1() : void
+ primitiveOperation2() : void
primitiveOperation1();
primitiveOperation2();
ConcreteClass
+ primitiveOperation1() : void
+ primitiveOperation2() : void
253
Participants
AbstractClass (Application)
ConcreteClass (MyApplication)
To implement the primitive operations to carry out subclassspecific steps of the algorithm
254
Observer Pattern
255
Intent
To define a one-to-many dependency
between objects so
that when one object changes state, all its dependents are
notified and updated automatically
256
Motivation
Consider graphical user interface toolkits which separates
a = 50%
b = 30%
c = 20%
2016 Soo Dong Kim
Software Design Principles and Techniques
change notification
Requests, modification
257
Applicability
Use the Observer pattern in any of the following situations:
Encapsulating these aspects in separate objects lets you vary and reuse
them independently.
258
Structure
Subject
+ attach(Observer) : void
+ detach(Observer) : void
+ notify() : void
Observer
observers
* + update() : void
public void notify() {
for all o in observers {
o.update();
}
}
aConcreteObserver
aConcreteSubject
subject
+ update() : void
- subjectState
+ getState()
+ setState() : void
- observeState
259
Participants
Subject
To keep track of its observers
To provide an interface for attaching and detaching Observer objects
Observer
ConcreteSubject
The object being observed
To store state of interest to ConcreteObserver objects
To send a notification to its observers when its state changes
ConcreteObserver
The observing object
To store state that should stay consistent with the subject's
To implement the Observer update interface to keep its state
consistent with the subject's
260
Collaborations (1)
Notifying changes to observers
261
Collaborations (2)
Object
aConcreteSubject
aConcreteObserver
anotherConcreteObserver
setState()
notify()
update()
getState(): String
update()
getState(): String
262
Unit 8.
Design with Traceability
263
What is SW Traceability?
Traceability is the feasibility in defining and enforcing
264
Artifacts Transformation
Transformation from Source Artifact(s) to Target Artifact(s)
PHASEi
A i1
PHASEj
A i2
transforms
Aj1
A j2
i2
Example
265
266
Source Artifact
Use Case Description
Workflow
267
Target Artifact
Sequence Diagram
Workflow
268
269
Additional Information,
Control Flow of the System part
270
271
Traceability Map
Showing the trace links among artifacts
Trace Link 3
Trace Link 5
Trace Link 8
Conceptual
Class Diagram (CCD)
Trace Link 2
Detailed
Class Diagram (DCD)
Trace Link 7
Trace Link 10
Conceptual Sequence
Diagram (CSD)
Trace Link 12
Trace Link 11
Trace Link 9
Trace Link 1
Trace Link 6
Trace Link 4
Software Requirement
Specification (SRS)
Trace Link 13
Detailed Sequence
Diagram (DSD)
272
Trace Link
Defines a common form of trace information between
s: Source Artifact
t: Target Artifact
lType: Link Type
modality: Optionality of the Link
mul: Multiplicity of the Mapping
273
274
VerRule4
Trace Link 1
Trace Link 2
Trace Link 3
(3) Verify SA
Trace Link 4
Trace Link 5
Trace Link 6
Trace Link 7
Trace Link 8
Trace Link 9
Trace Link 10
Trace Link 11
Trace Link 12
Trace Link 13
VerRule8
A6. Conceptual
Sequence Diagram
VerRule15
VerRule14
VerRule13
VerRule12
VerRule11
A4. Software
Architecture
VerRule7
VerRule9
VerRule5
VerRule1
VerRule6
VerRule3
A1.SRS
275
Artifacts in OO Projects
Requirements
Class Diagram
Architecture
Object-Relation Mapping
SRS
Sequence Diagram
UI Design
Java Code
Software
Product
Test Cases
2016 Soo Dong Kim
Software Design Principles and Techniques
276
Class Diagram
Architecture
Object-Relation Mapping
SRS
Sequence Diagram
UI Design
Database
Java Code
Software
Product
Test Cases
2016 Soo Dong Kim
Software Design Principles and Techniques
277
Class Diagram
Class
Actor
Class Name
Use Case
Attribute
Sequence Diagram
Object
Message Flow
Operation
Use Case Description
Relationship between
Classes
Directly mapped to
May be mapped to
(provide information)
2016 Soo Dong Kim
Software Design Principles and Techniques
A name of the
use case can
be mapped to
the operation
name.
Operations participated in
the message flow should
conform to the operation
declaration in class diagram.
278
The set of use cases The set of all methods of classes in C.D.
279
Traceability-Centric Development
J.S.Her, H. Yuan, S.D. Kim, Traceability-Centric
Model-Driven
Object-Oriented Engineering, Information and Software
Technology, 2010.
280
Unit 9.
Concluding Remarks
281
Beyond IoT
Analytics
Big Data
Being Autonomous!
Increased
Complexity
of Systems
Sys
282
BUT
Engineering Approach
Design Principles
Reuse Engineering with Reusable Assets
Quality Engineering
Architectural Approaches
More
Increased
Complexity
of Systems
2016 Soo Dong Kim
Software Design Principles and Techniques
283
Thank You !
284