You are on page 1of 19

relationship

joins
• Example:

• Example:
• Same type of entity (User & Customer, Vehicle and Car)

• Parent and child

• Full effect of ownership (When parent class delete effect comes on child
class)

• Inheritance is shown by arrow symbol


• Different type of entities (Customer & Product)

• Objects have their own lifecycle (Objects are independently used Eg: Customer & Product)

• No ownership between entities (When one entity deletes there is no effect on other entity)

• Association is represented by single line connecting two entities.

Association has two properties:


1- It contains a name
2- There are numbers at each end of the association
User
# id: int
Product
- username: string
- password : string - id: int
# user-type : string - product-name : string
- quantity: int
+ login(username : string, password : string) - price: int
+ add-product(name : string, quantity : int, price : int)

+delete-product(id: int)

Admin Customer + update-product(id: int, name : string, quantity : int, price : int)
+search-product(keyword: string)
- Name : string
- Address : string

+ register(username : string, Order


password : string, Name : string, - id: int
Address : string) - product-id : int
- quantity: int
- Customer-id: int
- Order-date: string
+ place-order (customer-id: int, product-id: int, quantity: int, order-date-date:
string)
+search-order(start-date : string, end-date: string)
Order
- id: int
- product-id : int
- quantity: int
User - Customer-id: int
- Order-date: string
# id: int
+ place-order (customer-id: int, product-id: int,
- username: string
quantity: int, order-date-date: string)
- password : string +search-order(start-date : string, end-date: string)
# user-type : string

1 Contains
+ login(username : string, password : string)

Admin Customer

1..*
- Name : string
- Address : string Product
1 Purchases 0 ..*
- id: int
+ register(username : string, - product-name : string
password : string, Name : string, - quantity: int
- price: int
Address : string)
+ add-product(name : string, quantity : int, price : int)
+delete-product(id: int)
+ update-product(id: int, name : string, quantity : int, price : int)
+search-product(keyword: string)
Cardinality association
Design class diagram for student attendance system. In the system admin
can register teachers, students after login into the system. Admin can also
create different batches and subjects related to different departments.
Teachers after login can add and view attendance of the students based
upon the selected batch. Students can view their personal attendance
after login inside the system.
User

Department Attendance
Student Teacher

Subject Batch
part of

is part of
Aggregation

Aggregation
Example
composition
Design class diagram for library management system. In the system admin user can
add, update and delete books from the library after login into the system. Students and
teachers can search and download books from the system after login into the system.
All the students and teachers can send request for addition of new books. They can
send maximum 5 requests. Admin creates accounts for the students and teachers.
Admin user can also view the list of books download by the students and teachers and
can also view the book requested by the students and teachers.
User

Student Teacher

Library Book

You might also like