Upload
others
View
3
Download
1
Embed Size (px)
Citation preview
System Analysis and Design
Class Diagram
Class Diagram Component
• Class & Object• Attributes & Operation
• Associations• Association Class
• Aggregation & Composition
• Generalization
Class Diagram Syntax
A CLASS
AN ATTRIBUTE
AN OPERATION
AN ASSOCIATION
Class 1
-attribute
+operation ()
Attribute name/derived attribute name
operation name ()
1..* 0..1______verb phrase____
Classes• Templates for creating instances or objects
• Types of class• Concrete (has objects)
• Abstract
• Another types: the type of real-world thing that it represents• Application domain, user interface, data structure, file
structure, operating environment, document, and multimedia classes
Attributes
• Units of information relevant to the description of the class
• Only attributes important to the task should be included
• include only those attributes that are relevant to the current application
• “size” for a TV object is not necessary if the application is concerned only with connections between TV and other objects
• do not attempt to include every attribute at the beginning• more attributes can be added when the model is iterated
• iteration of the model occurs almost at all times, particularly for large projects
Attributes (Cont)
• Avoid derivable attributes; instead, create a function to derive each such attribute• “age” can be derived from “birthday” and “current-date”
• “total” of all transactions can be dynamically computed when necessary, rather than storing it somewhere
• “discount price” can be computed using current-price and discount factor
Operations
• Action that instances/objects can take
• Focus on relevant problem-specific operations (at this point)
Association Classes
Miscellaneous relationships between classesA patient – an appointment
Generalization
• Enables inheritance of attributes and operations
• Ex:• A CUSTOMER class and an
EMPLOYEE class can be generalized into a PERSON class by extracting the attributes and operations in common
• It is represented with the a-kind-of relationship
Composition & Aggregation
Relates parts to wholesA part of or has parts
A door is a part of a carAn employee is a-part of a department
Identify as association if it is not clear whether it is association or aggregation
• “Mail” has “Address” (aggregation)
• “Mail” uses “Address” for delivery (association)
• “Customer” has “Address” (aggregation)
• “Customer” resides at “Address” (association)
• “TV” includes “Screen” (aggregation)
• “TV” sends information to “Screen” (association)
• “Customer” is a “Users” (generalization/specialization)
Multiplicity of relationship
Example - Online shop
CASE 1
Give explanation for this class diagram
Case 2
Buatlah sebuah class diagram untuk sebuah Bank berdasarkan deskripsiberikut:
• Bank memiliki banyak cabang yang dapat diidentifikasi berdasarkan kodedan alamatnya
• Di setiap cabang memiliki account yang menyimpan informasi saldo dannomor account. Account di Bank dapat berupa Tabungan dan Deposito.
• Setiap account dapat melakukan transaksi yang memiliki ID trans, tanggal, tipe, jumlah, dan saldo setelah transaksi.
• Satu nasabah dapat memiliki satu atau lebih account di cabang. Seorangnasabah memiliki informasi nama, alamat, tanggal lahir.
• NOTE: identifikasi operation/method yang dapat dimiliki oleh masing2 class
Case 3
• Create Use Case Diagram from iGracias case study• Write additional assumption (if any)