Class Diagram
Introduction
• A class diagram is a static structure that is used in software
engineering.
• Class Diagram shows the classes, attributes, operations, and the
relationship between them.
• Class diagrams are one of the most important diagrams in coding as
they form the basis for component and deployment diagrams and
describe the responsibilities in a system.
• They are also used for the analysis and design of an application and are
also used in forward and reverse engineering.
Example
• Create a class diagram for a web based public library.
A public library typically stores a collection of books, movies, or other library items
available to be borrowed by people living in a community.
• Each library member typically has a library account and a library card with the
account’s ID number, which he/she can use to identify herself to the library.
• A member’s library account records which items the member has borrowed
and the due date for each borrowed item.
• Each type of item has a default rental period, which determines the item’s
due date when the item is borrowed.
• If a member returns an item after the item’s due date, the member owes a late
fee specific for that item, an amount of money recorded in the member’s library
account
Task 1 : Identify the classes and their attributes
Library has a member
Library contains items
Items can be books or movies
Multiplicity
Class Relationships
1.Generalizations
2.Associations
3.Dependencies
Generalizations
- inheritance
Association
Aggregation and Composition
Example 1
• Draw a relationship “a course consists of 5-20 students and atleast 1
instructor
• Type of relationship
• Multiplicity
Example 2
• Classify the following into generalization (G), association (A), aggregation
(AG), or composition (C):
a) A country has a capital city
b) A dining philosopher uses a fork
c) A file is an ordinary file or a directory file
d) Files contain records
e) A class can have several attributes
f) A relation can be association or generalization
g) A polygon is composed of an ordered set of points
h) A person uses a computer language on a project
Dependencies
Cart
Total price
Showcart()
Product
Product id
Product price
Related Product()
Class Diagram
• The XYZ Bank is introducing a new system to streamline its operations and improve customer
experience. The system will manage customer accounts, transactions, and interactions with
ATMs. Bank offer following functionalities
1. Customer Management:
• The system manages customer information, including the ability to add new customers, remove existing customers,
and associate customers with different types of accounts (e.g., savings, checking).
2. Account Management:
• Each customer can have one or more accounts, and each account is uniquely identified by an account number.
Customers can view the balance of their accounts and perform transactions such as depositing and withdrawing
cash.
3. Transaction Recording:
• The system records all financial transactions within the bank. This includes transactions related to deposits,
withdrawals, and any other financial activities carried out by customers.
4. ATM Operations:
• The bank has deployed Automated Teller Machines (ATMs) at various locations. Each ATM is uniquely identified.
Customers can interact with these ATMs using debit cards to perform transactions, including cash withdrawals and
balance inquiries.
Class Diagram for easy understanding and concept
Class Diagram for easy understanding and concept
Class Diagram for easy understanding and concept
Class Diagram for easy understanding and concept
Class Diagram for easy understanding and concept
Class Diagram for easy understanding and concept

Class Diagram for easy understanding and concept

  • 1.
  • 2.
    Introduction • A classdiagram is a static structure that is used in software engineering. • Class Diagram shows the classes, attributes, operations, and the relationship between them. • Class diagrams are one of the most important diagrams in coding as they form the basis for component and deployment diagrams and describe the responsibilities in a system. • They are also used for the analysis and design of an application and are also used in forward and reverse engineering.
  • 3.
    Example • Create aclass diagram for a web based public library. A public library typically stores a collection of books, movies, or other library items available to be borrowed by people living in a community. • Each library member typically has a library account and a library card with the account’s ID number, which he/she can use to identify herself to the library. • A member’s library account records which items the member has borrowed and the due date for each borrowed item. • Each type of item has a default rental period, which determines the item’s due date when the item is borrowed. • If a member returns an item after the item’s due date, the member owes a late fee specific for that item, an amount of money recorded in the member’s library account Task 1 : Identify the classes and their attributes
  • 5.
    Library has amember Library contains items Items can be books or movies
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
    Example 1 • Drawa relationship “a course consists of 5-20 students and atleast 1 instructor • Type of relationship • Multiplicity
  • 12.
    Example 2 • Classifythe following into generalization (G), association (A), aggregation (AG), or composition (C): a) A country has a capital city b) A dining philosopher uses a fork c) A file is an ordinary file or a directory file d) Files contain records e) A class can have several attributes f) A relation can be association or generalization g) A polygon is composed of an ordered set of points h) A person uses a computer language on a project
  • 13.
  • 14.
    Class Diagram • TheXYZ Bank is introducing a new system to streamline its operations and improve customer experience. The system will manage customer accounts, transactions, and interactions with ATMs. Bank offer following functionalities 1. Customer Management: • The system manages customer information, including the ability to add new customers, remove existing customers, and associate customers with different types of accounts (e.g., savings, checking). 2. Account Management: • Each customer can have one or more accounts, and each account is uniquely identified by an account number. Customers can view the balance of their accounts and perform transactions such as depositing and withdrawing cash. 3. Transaction Recording: • The system records all financial transactions within the bank. This includes transactions related to deposits, withdrawals, and any other financial activities carried out by customers. 4. ATM Operations: • The bank has deployed Automated Teller Machines (ATMs) at various locations. Each ATM is uniquely identified. Customers can interact with these ATMs using debit cards to perform transactions, including cash withdrawals and balance inquiries.