1. NGSSC/OOSP/OOAD. OOAD part III. On OO methodologies,. UML,. Design
patterns. NGSSC/OOSP/OOAD. On OO methodologies. Historical perspectives.
Why do we model?
On OO methodologies Historical perspectives
OOAD part III On OO methodologies, UML, Design patterns
Methodologies (OOAD) • 1991 Booch • 1991 OMT Rumbaugh et al • 1992 OOSE Jacobsen • 1995 UML 0.9 • 2002 UML 1.4
Languages: • 1969 Simula • 1972 Smalltalk • 1985 C++ • 1995 Java
NGSSC/OOSP/OOAD
NGSSC/OOSP/OOAD
OOAD motivation
OOAD
NGSSC/OOSP/OOAD
• OOAD notation is graphical: 1 bitmap = 1 megaword.
Provide structure for problem solving Experiment to explore multiple solutions Furnish abstractions to manage complexity Reduce time-to-market for business problem solutions • Decrease development costs • Manage the risk of mistakes Remark: This page and several others in this presentation, is inspired by OMG tutorials on UML by Kobryn et al.
NGSSC/OOSP/OOAD
UML • A graphical language for – specifying – visualizing – constructing – documenting
• An OOAD methodology provides a and a . • There are many different processes, but UML represents the standard for notation.
• Analysis and design was important also before OO programming languages. • But OOP requires special analysis and design. • Earlier AD often used a “waterfall” approach. • Earlier AD often used different notations in A and D (and P). • OOAD provides a more incremental approach. • OOAD avoids “semantic gap” because notation is similar in both A and D (and P).
• • • •
• “Choose your own process, but use ~UML as a notation” NGSSC/OOSP/OOAD
the artifacts of software systems • OMG UML 1.4 Specification: • • • •
UML Summary UML Semantics UML Notation Guide Object Constraint Language
NGSSC/OOSP/OOAD
1
Diagram: Classifier View
Building Blocks
Diagram: Instance View
– cf. elements, bonds and molecules in chemistry – cf. components, connectors and circuit boards in hardware NGSSC/OOSP/OOAD
Well-Formedness Rules • Well-formed: indicates that a model or model fragment adheres to all semantic and syntactic rules that apply to it. • UML specifies rules for: • • • • •
naming scoping visibility integrity execution (limited)
• However, during iterative, incremental development it is expected that models will be incomplete and inconsistent. NGSSC/OOSP/OOAD
:Hydrogen
:Hydrogen
:Hydrogen
:Carbon
:Carbon
:Hydrogen
:Hydrogen
:Hydrogen
C
C
• Simple building blocks are used to create large, complex structures
– model elements (classes, interfaces, components, use cases, etc.) – relationships (associations, generalization, dependencies, etc.) – diagrams (class diagrams, use case diagrams, interaction diagrams, etc.)
• The basic building blocks of UML are:
H
C
NGSSC/OOSP/OOAD
NGSSC/OOSP/OOAD
Well-Formedness Rules (cont’d) • Example of semantic rule: Class [1] • English: If a Class is concrete, all the Operations of the Class should have a realizing Method in the full descriptor. • OCL: not self.isAbstract implies self.allOperations-> forAll (op | self.allMethods-> exists (m | m.specification-> includes(op)))
NGSSC/OOSP/OOAD
Well-Formedness Rules (cont’d) • Example of syntactic rules: Class • Basic Notation: A class is drawn as a solid-outline rectangle with three compartments separated by horizontal lines. • Presentation Option: Either or both of the attribute and operation compartments may be suppressed.
• Example of syntactic guideline: Class • Style Guideline: Begin class names with an uppercase letter. NGSSC/OOSP/OOAD
2
UML Package structure gJ X
An instance of a metamodel. Defines a language to describe an information domain.
J `
`fG
GI dp Iq
E` pH
SYWOT VXU
OY RRk
TOY L
OT j
YmMN XU
Ol
SMZZM L
• class diagram • object diagram
+
– implementation diagrams
dependency
• component diagram • deployment diagram
IEG HJK
EFG D
-
2 +,
*
1 +
T
MY Lh MNSTY i M RU
package
An instance of a meta-metamodel. Defines the language for specifying a model.
The infrastructure for a metamodeling architecture. Defines the language for specifying metamodels.
Y^
Wn m RUU N]T Ro
89
`
`fG ded
cIE K
Structural Modeling • Structural model: a view of an system that emphasizes the structure of the objects, including their classifiers, relationships, attributes and operations. • Kinds of structural diagrams: – static structural diagrams
67
5 34
@A ?> 7
; :9
C9=
5B
`Ib _a
Four layer metamodel
ZU
TSTY VX
MSOW U
OSTQ RP
+ , ./0 / $.
An instance of a model. Defines a specific information domain.
MNO L
user objects (user data)
)(%&' & % * !"# " $!
• No temporal info in structural diagrams.
From [Kobryn 01b].
O
YY]^T R[\ NGSSC/OOSP/OOAD
©ª
±²
³´
µ¶
½ »¿ »¿
¹ ¾½ ÂÀ
{constraint}
ÀÁ
a semantic condition or restriction.
¹À
¨ ¢¤ ¦ ¤¥
¢£
§
»¼ NGSSC/OOSP/OOAD
¡
NGSSC/OOSP/OOAD
½ »¿
¹¾
Â
¿Á Ç
¼
¿
Å
Å
À
¹ An extension mechanism useful for specifying structural elements.
¹ ýÄ
«interface»
¿
a description of a set of objects that share the same attributes, operations, methods, relationships and semantics. a named set of operations that characterize the behavior of an element. a modular, replaceable and significant part of a system that packages implementation and exposes a set of interfaces. a run-time physical object that represents a computational resource.
ÂÆ
¹ºº
¹¾
½
|}
~ t v
z{
v|s t
yw
u
vw
yv x
tu
rs
¸
« ·
«
° «¬
¯ ®
(cont’d)
³ª
6WUXFWXUDO0RGHOLQJ Core Relationships
6WUXFWXUDO0RGHOLQJ Core Elements
°®
6WUXFWXUDO0RGHOLQJ Core Elements
NGSSC/OOSP/OOAD
¬
NGSSC/OOSP/OOAD
a relationship between two or more classifiers that involves connections among their instances. A special form of association that specifies a whole-part relationship between the aggregate (whole) and the component part. a taxonomic relationship between a more general and a more specific element. a relationship between two modeling elements, in which a change to one modeling element (the independent element) will affect the other modeling element (the dependent element).
NGSSC/OOSP/OOAD
3
$
& '
"
%
#
!
Classes
8
56
9:
T
X
WX
SY
NT
R
O
UV
S
Q
N
P
L
O
N
J
OL
KLM
BC @A
=>
BC
; E
F
D