Flowchart and UML
Flowchart and UML
A flowchart is a diagram that represents the flow of an algorithm using symbols to depict
steps, decisions, inputs, and outputs. It visually outlines the sequence of operations required
What is UML?
Unified Modeling Language (UML) is a standardized way to visualize, specify, and document the
design of a system using diagrams. It is widely used in software engineering to model complex
systems by representing their structure and behavior.
Categories of UML Diagrams:
UML diagrams are categorized into two main types:
1. Structural Diagrams: Describe the static aspects of a system.
2. Behavioral Diagrams: Describe the dynamic aspects of a system.
1. Structural Diagrams:
These diagrams show the physical and conceptual structure of a system.
Class Diagram
Represents the classes in a system, their attributes, methods, and relationships
(inheritance, association, aggregation, composition).
Example: Modeling entities in an application such as User, Order, Product.
Object Diagram
Represents instances of classes (objects) at a specific moment. It shows real-world
examples of relationships.
Component Diagram
Represents the physical components (e.g., modules, libraries) used in a system and
how they interact.
Deployment Diagram
Shows the physical deployment of artifacts (software) on hardware nodes (servers,
devices).
2. Behavioral Diagrams:
These diagrams focus on how the system behaves over time.
Use Case Diagram
Describes the interactions between actors (users or external systems) and the system.
Example: In an online shopping system, actors might be Customer and Admin, interacting
with use cases like Place Order and Manage Inventory.
Sequence Diagram
Models the sequence of messages exchanged between objects to accomplish a specific
task.
Example: A user logging in involves a sequence of messages between User Interface,
Authentication Service, and Database.
Activity Diagram
Represents the flow of control or data in a process. It’s similar to a flowchart but more
detailed in representing concurrent processes.
State Diagram
Describes the states an object can be in and how it transitions from one state to another
based on events.
Example: Modeling the lifecycle of an Order in an e-commerce system: New → Processing
→ Shipped → Delivered.
1. Entities
Entities represent real-world objects or concepts that have distinct and independent
existence. In ERD, entities are typically represented as rectangles.
Types of Entities:
Strong Entity: An entity that can exist independently in the database.
o Example: Student, Course
Weak Entity: An entity that cannot exist without a related strong entity. It usually has
a partial key and depends on a strong entity for its identification.
o Example: Dependent (depends on Employee)
Notation: Entities are shown as rectangles with the entity name written inside.
2. Attributes
Attributes are properties or characteristics of an entity. They provide more information about
the entity.
Types of Attributes:
Simple Attribute: Cannot be divided further.
o Example: Name, Age
Composite Attribute: Can be divided into smaller sub-parts.
o Example: Full Name can be divided into First Name and Last Name.
Derived Attribute: Can be derived from other attributes.
o Example: Age can be derived from the attribute Date of Birth.
Multivalued Attribute: Can have multiple values for a single entity.
o Example: Phone Numbers of an employee.
Key Attribute: Uniquely identifies an entity instance. It is underlined in the ERD.
o Example: Student ID, Employee ID
Notation: Attributes are represented as ovals connected to their respective entity rectangles.
3. Relationships
Relationships define how entities are associated with each other. They are represented by
diamonds in ERDs.
Types of Relationships:
1. One-to-One (1:1): An entity in set A is related to at most one entity in set B, and vice
versa.
o Example: A Person has one Passport.
2. One-to-Many (1:N): An entity in set A can be related to many entities in set B, but an
entity in set B is related to at most one entity in set A.
o Example: A Professor teaches multiple Courses.
3. Many-to-Many (M:N): Entities in set A can be related to multiple entities in set B and
vice versa.
o Example: Students enroll in multiple Courses, and each Course has many Students
enrolled.
Notation: Relationships are shown as diamonds with lines connecting to the related entities.
The name of the relationship is written inside the diamond.
4. Cardinality
Cardinality specifies the number of instances of one entity that can be associated with
instances of another entity.
Types of Cardinality:
One-to-One (1:1): Each entity in set A is related to one and only one entity in set B.
One-to-Many (1:N): Each entity in set A can be related to zero or more entities in set B.
Many-to-Many (M:N): Entities in set A can be related to multiple entities in set B and
vice versa.
Notation Styles for Cardinality:
1. Crow’s Foot Notation:
o Single line for one, crow’s foot for many.
2. Min-Max Notation:
o Specifies the minimum and maximum number of instances involved in the
relationship.