Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Visualisasi Class dan Association Relationship

Presentasi serupa


Presentasi berjudul: "Visualisasi Class dan Association Relationship"— Transcript presentasi:

1 Visualisasi Class dan Association Relationship
Oleh : Cosmas Haryawan -- Pengenalan UML – Base on : Sams Teach Yourself UML in 24 Hours, Third Edition based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

2 Diagram A diagram is typically a view of a part of the model, showing modeling elements and some of the relationships between them. A diagram do not have to be complete, some elements may be missing or presented in a simplified fashion. 2 kinds Diagram : Dynamic and Static Static -- they display what interacts but not what happens when they do interact based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

3 9 Type Diagrams Dynamic views Static views Model Use Case Diagrams
Sequence Diagrams Some part of the model might not be visible on any diagram Class Diagrams Collaboration Diagrams Object Diagrams Model Activity Diagrams Component Diagrams Statechart Diagrams Deployment Diagrams based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

4 CLASS DIAGRAM Menggambarkan Objek/Class Pada Sistem Contoh :
Object Class Program Tabel Data Pada Database based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

5 OBJET - CLASS DIAGRAM Attribut / properti Operation/Function/Method
RelationShip Note / Keterangan (Optional) based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

6 CLASS DIAGRAM Nama Class Attribut / variabel Class
Operation / Method Class Responsibilty atau Keterangan (tambahan / optional) based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

7 Konvensi Penulisan Class
Untuk nama Class : setiap kata diawali dengan huruf Besar misal Student, WashingMachine Jika diinginkan penulisan Class yang dilengkapi dengan Package-nya maka antara keduanya dibatasi double colons (dobel titik dua) Misal Household::WashingMachine based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

8 Konvensi Penulisan Attribut
Attribut / variabel adalah properti dari Class mampu menggambarkan rentang nilai yang bisa digunakan object (instance of class) Penulisan : Jika satu kata, diawali dengan huruf kecil Untuk kata kedua dan seterusnya, diawali dengan huruf besar based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

9 Penulisan Attribut Attribut juga bisa dilengkapi dengan type data yang ditulis dengan dibatasi colon (titik dua) Bahkan bisa juga ditambahkan suatu nilai default based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

10 Konvensi Penulisan Operation
Operation adalah sesuatu yang bisa dilakukan oleh sebuah class atau yang dapat dilakukan oleh class lain terhadap sebuah class Konvensi penulisan sama dengan attribut, yaitu untuk satu kata diawali dengan huruf kecil sedangkan kata kedua dan seterusnya menggunakan huruf besar Untuk memperjelas setiap operation juga perlu diakhiri dengan tanda () based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

11 Penulisan Operation Setiap Operation bisa ditambahkan parameter berupa variabel dan tipenya Untuk Operation yang menghasilkan suatu nilai maka bisa ditambahkan tipe data kembaliannya. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

12 Visualisasi Dalam prakteknya tidak selalu penggambaran class selalu dilengkapi dengan atribut dan operation nya based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

13 Visualisasi Atau bisa juga cukup menuliskan attribut dan atau operation yang dianggap penting saja, sedangkan yang lain diwakili dengan simbol elipsis ( … ) based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

14 Visualisasi Untuk Attribut atau Operation yang banyak, dapat juga ditambahkan suatu kata kunci penjelas based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

15 Responsibility Responsibility adalah suatu gambaran / keterangan tentang apa yang dikerjakan oleh class Bertujuan memperjelas fungsi class dan menghilangkan ambigu (jika ada) Diletakkan di bagian terbawah dari class based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

16 Constraint Apabila dibutuhkan suatu batasan atau aturan untuk suatu attribut maka bisa ditambahkan suatu constraint yang ditulis dalam kurung kurawal {} based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

17 Attached Note Untuk keterangan penjelas, bisa ditambahkan juga pada suatu attribut dan operation based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

18 Indikator Attribut / Operation
+ Public # Protected - Private $ Static / Derived Atribut tidak standar * Abstrak Fungsi tidak standar based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

19 Contoh Atribut dan metoda dapat memiliki salah satu sifat berikut :
Private, tidak dapat dipanggil dari luar class yang bersangkutan Protected, hanya dapat dipanggil oleh class yang bersangkutan dan anak-anak yang mewarisinya Public, dapat dipanggil oleh siapa saja Account balance: Real = 0 <<constructor>> +addAccount() <<process>> +setBalance( a : Account) +getBalance(a: Account): Amount <<query>> isValid( loginID : String): Boolean based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

20 Visualisasi Object Suatu object, instance dari class, biasanya digambarkan lengkap dengan value dari attributnya. Penulisan nama diberikan tambahan garis bawah, dengan format : namaObject : NamaClass misal myWasher : WashingMachine : NamaClass misal : WashingMachine  disebut anonymous object based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

21 Relationship based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

22 Association Relasi antara 2 elemen dimana keduanya punya posisi yang sama, tidak ada yang lebih penting diantara keduanya. Digambarkan dengan garis tegas Jenis : Bidirectional : tanpa panah, atau panah di kedua ujung garis Unidirectional : satu panah di posisi yang dituju Reflexive : garis ke dirinya sendiri based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

23 Association… Tanpa Role  player play on a team
Dengan Role (peran atau tugas untuk tiap class) based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

24 Association… Two Association
Lihat tanda panah untuk menunjukkan pembacaan assosiasi based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

25 Association… Beberapa class berasosiasi dengan 1 class
based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

26 Association with rule/constraint
Terkadang assosiasi antar kelas mengikuti suatu rule tertentu a Bank Teller serves a Customer, but each Customer is served in the order in which he or she appears in line. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

27 Association with rule/constraint
Salah satu type Constraint : {or} a high school student choosing either an academic course of study or a commercial one based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

28 Association Class An association can have attributes and operations, just like a class. In fact, when this is the case, you have an association class. You visualize an association class the same way you show a regular class, and you use a dashed line to connect it to the association line. An association class can have associations to other classes. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

29 Association Class… Plays on association between a player and a team. The association class, Contract, is associated with the GeneralManager class. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

30 Multiplicity the number of objects in one class that relate to a single object of the associated class. Contoh : Setiap nomor Rekening harus memiliki 1 nomor ATM Rekening noRek nama tglLahir alamat Atm noAtm tglBuat tglAktif password 1 based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

31 Multiplicity Setiap nomor Rekening dapat memiliki 1 nomor ATM Rekening
noRek nama tglLahir alamat Atm noAtm tglBuat tglAktif password 0..1 1 based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

32 Simbol Multiplicity Unspecified Exactly one 1
Zero or more (many, unlimited) 0..* * One or more 1..* Zero or one (optional scalar role) 0..1 Specified range 2..4 Multiple, disjoint ranges 2,4..6 When class A is in a one-to-zero or one multiplicity with class B, class B is said to be optional for class A. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

33 Contoh based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

34 Qualified Association
When an object from one class has to choose a particular object from another in order to fulfill a role in an association, the first class has to rely on a specific attribute to select the correct object. That attribute is typically an identifier, such as an ID number. For example, a hotel's reservation list has many reservations based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

35 Qualified… Dalam UML key / ID information disebut Qualifier dan menjadi satu bagian dengan assosiasi “one to many” Meski ReservationList dan Reservation “one to many” tetapi confirmationNumber dan Reservation “one to one” based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

36 Reflexive Association
Sometimes, a class is in an association with itself. Referred to as a reflexive association This can happen when a class has objects that play a variety of roles. For example, a CarOccupant can be either a driver or a passenger. In the role of the driver, one CarOccupant drives zero or more additional CarOccupants who play the role of passenger. based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)

37 Any Question? based on Sams Teach Yourself UML in 24 Hours, Third Edition (modified by cmz)


Download ppt "Visualisasi Class dan Association Relationship"

Presentasi serupa


Iklan oleh Google