download

Matakuliah
Tahun
Versi
: M0086/Analisis dan Perancangan Sistem Informasi
: 2005
:5
Pertemuan 8
Structure
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• Mahasiswa dapat Menghubungkan Class
(Structure) (C4)
• Mahasiswa dapat Membuat diagram /
skema Class (C4)
• Mahasiswa dapat Membagi Cluster (C4)
2
Outline Materi
• Cluster
• Explore Pattern
3
Clusters
«cluster»
Cars
«cluster»
People
Car
Owner
Motor
Passenger Car
Cylinder
Taxi
Clerk
4
Menentukan Structures
• Coba temukan secara sistematis
– Clusters:
• Cluster biasanya dilakukan yang terakhir
• Kelompokan Class untuk memberikan kejelasan lebih baik
– Generalisation:
• Periksa setiap pasangan class untuk struktur generalisasi
antar class, atau cari common class
• Periksa masing masing class untuk spesialisasi (inheritance)
yang relevan
5
Menentukan Structures
– Aggregation:
• Periksa setiap pasangan class untuk (1) whole-part,
container-content, atau association-member relationships
antar class, dan untuk (2) a common whole yang
menghubungkan mereka
• Periksa setiap class untuk (3) components yang relevan
– Association:
• Periksa setiap pasangan class untuk needed association(s)
• Tetapi, jangan hanya membuat structure karena
anda dapat
– Apakah mereka relevan atau berguna?
– Apakah mereka dapat di representasikan dengan
lebih sederhana ?
• Mungkin perlu melacak ulang ke class
6
Mencari Pola untuk Structures
• Pola memberikan sumber inspirasi dan
patokan untuk bagaimana memodel
situasi
• Pola yang umum termasuk …
– Role pattern: object dengan multiple roles
– Relation pattern: relationship dengan
attributes
– Hierarchy pattern:
– Item-descriptor pattern:
7
The Role Pattern
Person
Employee
Person
Customer
CustomerEmployee
Employee
Role
Customer
Role
Shouldn’t dynamically change
object from customer class or
employee class to customeremployee class or vice versa
8
The Role Pattern
Person
Person
1
0..*
1
1..*
Role
Role
Employee
Customer
Role1
Role2 ...
Rolen
Generic Pattern
9
The Relation Pattern
Person
1..* 1
Owns
Car
Party1
Person
1
0..*
1
0..*
Ownership
But … What if need attributes
for the owns relationship?
E.g., date_purchased
1..* 1
Car
Relation
0..* 1
Party2
Generic Pattern
10
The Hierarchy Pattern
University
Book
1
1..*
Division
1
1..*
1
1..*
Chapter
1
1..*
School
Leveln
1
1..*
Section
...
Leveln-1
...
1
1..*
Level1
Generic
Pattern
11
The Item-Descriptor Pattern
Book
1
0..*
Copy
Descriptor
Logical
1
0..*
Item
Physical
Generic Pattern
12
Contoh Unit Enrolment
Student
0..*
0..*
Enrolls in
Unit
• Tetapi, bagaimana dengan student dari
semester yang lama ?
• Bagaimana mendapatkan daftar student
dari unit ?
• Tetapi masih dapat diketahui unit yang
mana yang mempunyai syarat apa ?
13
Unit Enrolment
• Gunakan item-descriptor untuk
mengembangkan unit class
Unit
1
Unit title, number
Prerequisites,
etc.
0..*
Student
0..*
0..*
Unit
Enrolls in
Offering
Semester, Year,
Instructor, etc.
• Tetapi bagaimana kita dapat menyimpan nilai
atau tanggal pendaftaran unit ?
14
Unit Enrolment Example
• Gunakan relation pattern untuk
mengembangkan enroll dengan association dan
student class
Name,
Student #,
Address,
etc.
Enrol Date,
Unit Mark,
etc.
Student
Unit
1
1
0..*
0..*
0..*
1
0..*
Unit
Unit
Enrolls in
Enrolment
Offering
Unit title, number
Prerequisites,
etc.
Semester, Year,
Instructor, etc.
15
Evaluating Structures
• Evaluate systematically
– Structure types must be used correctly
• aggregation vs association
– Structures must be conceptually true
– Structures must be simple
• Another golden rule
– Structures must increase clarity
16
Summary of Principles for
Determining Structures
• Study abstract, static relationships
between classes
• Study concrete, dynamic relationships
between objects
• Model only the necessary structural
relationships
– focus on important aspects
– include only a minimal number
17
Tutorial: Structures
• Individually, identify a list of candidate
structures from the case description.
– Remember to check each pair of classes, etc.
– Remember to check for all kinds of structures.
– Be sure that the “is a kind of” and “a part of”
semantics are applied correctly
18
Terima Kasih
19