Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

I1B-Pemodelan Sistem Informasi PSI3 - 1 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Class Diagram Membantu dalam visualisasi.

Presentasi serupa


Presentasi berjudul: "I1B-Pemodelan Sistem Informasi PSI3 - 1 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Class Diagram Membantu dalam visualisasi."— Transcript presentasi:

1 I1B-Pemodelan Sistem Informasi PSI3 - 1 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Class Diagram Membantu dalam visualisasi struktur kelas-kelas dari suatu system dan hubungan antar kelas (inheritance, aggregation, and association) dan penjelasan detail tiap kelas (methode/function/behavior dan atribut/property/data) Diagram ini merupakan fondasi untuk component diagram dan deployment diagram Diagram paling penting pada object oriented analysis and design Class digambarkan dengan sebuah kotak dengan 3 section Disarankan untuk tidak menggambar tanpa 3 section ini Kadang-kadang boleh ada section tambahan untuk menggambarkan keterangan class Setiap atribut/methode/association diperbolehkan ada sebuah keterangan atribut/methode yang diletakkan diantara tanda { } Sebuah class atau atribut/methode bisa mempunyai dokumentasi dengan lambang dibawah ini dan ditarik dengan garis putus tanpa panah

2 I1B-Pemodelan Sistem Informasi PSI3 - 2 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Visibility Menyatakan level akses sebuah object Visibility dapat diterapkan pada atribut atau methode Tampilkan visibility secara urut berkelompok mulai dari urutan tertinggi Type data (int,float,char) dari sebuah atribut dapat disertakan design class model define the structure of your object source code and therefore should reflect the naming conventions for the implementation language that you using There are 4 types VisibilitySymbol Public+ Protected# Private- Class Diagram class A # A2 : int = 100 - A1 : int + ENTRYA1( ) : void Contoh :

3 I1B-Pemodelan Sistem Informasi PSI3 - 3 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Class Diagram # include # include class A { int A1 ; protected: protected: int A2; public: public: void ENTRYA1( ) { cout<<"Entry A1 ="; cin>>A1;} cin>>A1;} void ENTRYA2( ) { cout >A2;} { cout >A2;}}; class C:A { int C1; public: public: void ENTRYC() { cout >C1; // cout >A1;//error // cout >A1;//error cout >A2; cout >A2;}}; Private A1 A1 Protected A2 A2 Public Entry A1( ) EntryA2( ) Private A2 A2 Entry A1( ) EntryA2( ) Protected PublicPrivateProtected A2 A2 Public Entry A1( ) EntryA2( ) class A class B class C public public private private Contoh Program Program Contoh konsep Inheritance pada class class B : public A { int B1; public: public: void ENTRYB( ) {cout >B1; // cout >A1;//error // cout >A1;//error cout >A2; cout >A2;}}; void main() { B JONI; C TUTI; JONI.ENTRYB( ); JONI.ENTRYA1( ); JONI.ENTRYA2( ); TUTI.ENTRYC( ); //TUTI.ENTRYA1( );//ERROR //TUTI.ENTRYA2( );//ERROR }

4 I1B-Pemodelan Sistem Informasi PSI3 - 4 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Association classes/link classes (Many to Many association) Which is used to model association that have methods and attributes depicted as class attached via a dashed line to association Programming language such as C++ and java do not (yet) have native support this concept Do not name association that have association classes Center the dashed line of an association class Kurangi penggunaan association class ini, sehingga tidak perlu menambah sebuah pekerjaan pada tahap analisa Class Diagram Berikut ini adalah gambar class diagram dari gambar diatas yang tanpa menggunakan association class

5 I1B-Pemodelan Sistem Informasi PSI3 - 5 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 RelationshipAssociationInheritance/generalizationAggregationCompositionDependenciesRealizations Class Diagram Association When classes are connected together conceptually, that connection is called an association An association allows one class to know about the public attributes and methode of another class Center names on association Gunakan kalimat singkat Indicate directionality with a filled triangle (  ) to clarify an association name Sebuah association dimungkinkan adanya sebuah constraint yang menggambarkan sebuah kondisi (lihat gambar dibawah ada kata NAND) Indicate role names when multiple associations between 2 classes exist Role names are optionally indicated on association ends to indicate how a class is involved in the association Role names can be used to clarify recursive associations

6 I1B-Pemodelan Sistem Informasi PSI3 - 6 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Association - Class Diagram Association unidirectional menggunakan garis berpanah terbuka Association bi-directional menggunakan garis tanpa panah Association may be drawn as a diamond for association with more than two ends Binary and Ternary association IndicatorMeaningExample 0..1Zero or one 0..*Zero or more 0..nZero to n (where n>1)0..3 1One only 1..*One or more 1..nOne to n (where n>1)1..5 *Many nOnly n (where n>1)9 n..*n or more, where n >17..* n..mWhere n& m both >13..10 Multiplicity indicator Contoh : Dibaca : 1 object Mahasiswa punya 0..* object Nilai dan 1 object Nilai dipunyai 1 object Mahasiswa

7 I1B-Pemodelan Sistem Informasi PSI3 - 7 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Two or more classes will share the same attributres and/or the same methods Inheritance use a line with a closed arrowhead (  ) pointing from the sub class to the super class Place sub class below super class A sub class should inherit attributes and methods of its superclass Inheritance/generalization - Class Diagram

8 I1B-Pemodelan Sistem Informasi PSI3 - 8 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Represent ‘is part of’ relationship, ketika sebuah class dibuat berdasarkan class lainnya maka gunakanlah aggregation atau composition When deciding whether to use aggregation or composition over association, you can say if in doubt, leave it out There is very little difference between association, aggregation and composition at the coding level Aggregation Aggregation menggunakan lambang diamond terbuka  Aggregation is a specialization of association, specifying a whole part relationship between objects Composition Composition menggunakan lambang diamond tertutup Composition is a strong type of a aggregation Composition is a stronger form of aggregation where the whole and parts have coincident lifetimes, and it is very common for the whole to manage the lifecycle of its parts Aggregation and Composition - Class Diagram

9 I1B-Pemodelan Sistem Informasi PSI3 - 9 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Dependencies Dependencies adalah Sebuah class yang membutuhkan class lain untuk spesifikasi classnya Dependencies is shown as a dashed open headed arrow Contoh: Class mobil bergantung pada class Mesin Realizations Realizations adalah sebuah relasi antar 2 buah class, dimana class lainnya mewakili sebuah class implementation (implementation of the later) Realizations is shown as a dashed close headed arrow Disebut dengan istilah lain “Interfaces” (lihat materi berikutnya) The relationship between a class and interfaces is called realization - Class Diagram Dependencies and Realizations - Class Diagram atau

10 I1B-Pemodelan Sistem Informasi PSI3 - 10 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 An interface is a set of operation that specifies some aspect of a class’s behavior Interfaces adalah kumpulan fungsi yang dapat dipakai pada class tanpa menjadi behavior suatu class. Di bahasa C++ disebut friend function Friend function become friend more than 1 class Friend function can access private from the other class Friend function isn’t member a class - Class Diagram Interfaces - Class Diagram Contoh: program //Static harus dicompile pake turbo c #include<iostream.h> class barang { char nama[20]; float harga,jumlah; float harga,jumlah; static float bayar,total; static float bayar,total;public: void entry( ) void entry( ) { cout > nama ; { cout > nama ; cout >jumlah; cout >jumlah; cout >harga ; cout >harga ; } static void proses(barang B1) static void proses(barang B1) { bayar =B1.harga * B1.jumlah; { bayar =B1.harga * B1.jumlah; total =total + bayar; } total =total + bayar; } friend void tampil (barang B1); friend void tampil (barang B1); float kasir( ) { return total;} float kasir( ) { return total;}}; void tampil(barang B1) { cout <<"nama barang :" ; cout<<B1.nama <<endl; cout <<"harga barang :"<<B1.harga <<endl; cout <<"jumlah barang :"<<B1.jumlah<<endl; cout <<"bayar:"<<B1.bayar <<endl; }main() { barang buku,tas,pena; buku.entry( ); tas.entry( ); pena.entry( ); buku.entry( ); tas.entry( ); pena.entry( ); buku.proses(buku); buku.proses(tas ); buku.proses(pena); buku.proses(buku); buku.proses(tas ); buku.proses(pena); tampil(buku); tampil(tas ); tampil(pena); tampil(buku); tampil(tas ); tampil(pena); cout<<"jumlah bayar="<<buku.kasir( ); cout<<"jumlah bayar="<<buku.kasir( ); return 0; return 0;}

11 I1B-Pemodelan Sistem Informasi PSI3 - 11 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 The relationship between a class and interfaces is called realization Sebuah interfaces dapat digambarkan dengan cara association sebuah class dengan cara:  sebuah class ditulis > dengan tidak mempunyai attributes  small circle connected by a line to the class A class can realize more than 1 interfaces, and an interfaces can be realized by more than 1 class - Class Diagram Interfaces - Class Diagram

12 I1B-Pemodelan Sistem Informasi PSI3 - 12 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006   Menentukan Stereotype Class   Entity Class : objects menyimpan seluruh data pada application   Boundary Class : digunakan actor utk berinteraksi dg sistem contoh : form, menus, dialog boxes   Control Class : mengatur seluruh kegiatan dan menangkap main application logic contoh : discount complex policy is complex Class Diagram   Ttiga Jenis class utama : ENTITY, BOUNDARY, CONTROL

13 I1B-Pemodelan Sistem Informasi PSI3 - 13 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Catatan Kerangka berfikir object Layar/GUI Object yg terlibat pada saat Use Case Fill order Table/Relasi Modul Control Staff Pendaftaran Entry Pendaftaran Sekretaris Program Penentuan Matrikulasi Cetak Kwitansi Pendaftaran Staff Keuangan

14 I1B-Pemodelan Sistem Informasi PSI3 - 14 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Menggambarkan object dan hubungannya dalam urutan time, umumnya sebuah special case dari class diagram atau communication diagram Digambarkan sebagai sample diagram (diagram yang menggambarkan sample object dari sebuah class dan relasi diantaranya) Sebuah object dapat digambarkan dengan cara  Nama object : nama class  :nama class dan nilai atribut yang terdapat pada section ke-2 :Anggota Nama=“Joni” Object Diagram Joni : anggota Hubungan antara object digambarkan dengan sebuah garis tanpa panah yang berisi sebuah role/peran, role ini boleh dipakai atau tidak


Download ppt "I1B-Pemodelan Sistem Informasi PSI3 - 1 Fakultas Teknologi Informasi - Universitas Budi Luhur Ganjil 2005/2006 Class Diagram Membantu dalam visualisasi."

Presentasi serupa


Iklan oleh Google