15
Excercise from last class Inform yourself about unary – binary – ternary relationships relationships Di i / l t l ! Discussion / new examples next class! 6-Nov-17 Database System Concepts for Non- Computer Scientists WS 2017/2018 1

Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Embed Size (px)

Citation preview

Page 1: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Excercise from last class

Inform yourself about unary – binary – ternary relationshipsrelationships

Di i / l t l !Discussion / new examples next class!

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 1

Page 2: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Design criteriag

Rules for Classification of Entities andRules for Classification of Entities andAttributes:Entities should contain descriptive informationEntities should contain descriptive informationMulti valued attributes should be classified as

EntitiesAttribute should be assigned to that Entity which

desribes it most directlyRedundant relationships should be avoided

It is dependent on the application how to representan information

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 2

Page 3: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Example:OrderAs Entity:y

Client place Order for_a1 N M

As Relationship: 1

ProductClient order ProductM N

As Attribute: Order-Nr

Client buy ProductM N

Nr

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 3

Page 4: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Modeling a small exampleapplication: E/Rapplication: E/R

Students

Lectures

Real Worl: University

C t l M d li

e Wo : U ve s y

StudNrStudents tt d Lectures

Conceptual Modeling

NameStudents attend Lectures

TitleLectureNr6-Nov-17 Database System Concepts for Non-

Computer Scientists WS 2017/2018 4

TitleLectureNr

Page 5: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Modeling a small example application: UMLapplication: UML

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 5

Page 6: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Data modelling with UMLg

UML: Unified Modelling LanguageUML: Unified Modelling Language De facto standard for object orientierted software designCentrales construct: class,Centrales construct: class,

models similar objects according to• Structur (~Attributes)

B h i ( O i /M h d )• Behavior (~Operations/Methods)

Associations between classes correspond to relationshipsssoc a o s be ee c asses co espo d o e a o s psGeneralisationAggregationgg gCheat sheet Class Diagram:http://www.code-meets-design.de/wp-

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 6

p g pcontent/uploads/2013/07/uml-classdiagram-cheat-sheet.pdf

Page 7: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

UML Notation

Association:Association: * *

Generalisation:

Aggregation:(Part-of)(Part of)

Composition:Composition:(Special case of Aggregation)

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 7

Page 8: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

MultiplicityyClass A Class B

+Att1+Att2

+Att1+Att2

()k..l i..j

Every element of ClassA is associated with at least i elements

+ op() + op()j

yof ClassB

... and with at most j elements of ClassB

Analogously for the intervall k..l

Multiplicity is analogously to the functionalities in the ER-ModelNot to the (min max)-Notation: Watch out!

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 8

Not to the (min,max) Notation: Watch out!

Page 9: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Association class

+Att1

Class A+Att1

Class B

+Att2

+ op()

+Att2

+ op()* *

Class C

+ op() p()

+Att1A 2

Class C

+Att2

for attributes of the association6-Nov-17 Database System Concepts for Non-

Computer Scientists WS 2017/2018 9

… for attributes of the association

Page 10: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Klassen und Assoziationen

+: publicArrows: Navigation p

A B

g(Implementation)

No statement on navigation A

A B

No statement on navigation

Navigation from A to B allowed

xA BNavigation from A to B forbidden

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 10

Page 11: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Komposition

+StudNr: int

Students

+Grade: decimal

Exams

*+Examinee+StudNr: int

+Name: string+Semester: int

+GPA(): float

+Grade: decimal+Date: date

+move()

11 *pass

+Subject

…GPA(): float

+SumWeeklyHours(): short… 1 *

+Examiner

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 11

Page 12: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat
Page 13: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat
Page 14: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

More useful DiagramsMore useful Diagrams

• Use Case Diagram

• Interaction Diagram

• Sequence DiagramSequence Diagram

Search for examples in the internet

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 14

Page 15: Excercise from last class - db.in.tum.de · UML: UnifiedUML: Unified Modelling Language De facto standard for object orientierted software design Centrales construct: class, ... Cheat

Quiz UML

F th St f d MOOCFrom the Stanford MOOC:

https://lagunita stanford edu/courses/DB/UML/SelfPaced/https://lagunita.stanford.edu/courses/DB/UML/SelfPaced/courseware/ch-unified_modeling_language/seq-quiz-uml/

Quiz Q2 + Q5 – Q7

6-Nov-17 Database System Concepts for Non-Computer Scientists WS 2017/2018 15