Professional Documents
Culture Documents
SAD fisr ass
SAD fisr ass
SAD fisr ass
Assignment 1
=UML stands for Unified Modeling Languag . It is a standardized visual language used to represent
and design the structure and behavior of software systems.some of the importance in software
development are:
Structural Diagrams
1. Use Case Diagram: Captures functional requirements; actors and system interactions.
2. Sequence Diagram: Shows sequence of messages between objects over time.
3. Collaboration Diagram (Communication Diagram): Emphasizes object interactions and
relationships.
4. State Diagram: Represents states of an object and transitions between them.
5. Activity Diagram: Illustrates control flow and activities in a process.
6. Timing Diagram: Depicts state changes over time.
7. Interaction Overview Diagram: Combines activity and sequence diagrams for complex
interactions.
8. Communication Diagram: Visualizes object interactions and organization.
1. Actors: Actors are entities that interact with the system, such as users, other systems, or devices.
They are depicted as stick figures in the diagram.
2. Use Cases: It uses cases represent the functionalities or services provided by the system to the
actors. They are depicted as ovals in the diagram.
3. System Boundary: The system boundary defines the scope of the system being modeled. It is
depicted as a rectangle that encapsulates all the use cases.
4. Relationships:
Include: Indicates that a use case contains behavior from another use case, depicted as a
dashed line with an arrow pointing towards the included use case.
Extend: Shows that a use case extends the behavior of another use case, depicted as a dashed
line with an arrow pointing towards the extended use case.
Generalization: Indicates an actor or use case inherits the role of another actor or use case,
depicted as a solid line with a hollow arrow pointing towards the parent.
5. Use Case Descriptions:Use case descriptions provide detailed textual information about the use
case's functionality, goals, preconditions, postconditions, and flows of events. These are documented
separately from the diagram.
1. Classes: Classes are the fundamental building blocks of a class diagram. They represent
objects in the system and define their properties and behaviors. Each class is depicted as a
rectangle divided into three sections: the top section contains the class name, the middle
section lists the attributes, and the bottom section lists the methods (operations).
2. Attributes: Attributes are characteristics or properties of a class. They are listed in the
middle section of the class rectangle and represent the data stored in the objects of the class.
3. Methods (Operations): Methods define the behaviors or functions of a class. They are listed
in the bottom section of the class rectangle and represent the operations that can be
performed on or by the objects of the class.
4. Relationships:
Associations: Represent connections between classes, indicating how objects of one class
interact with objects of another. Associations are depicted as lines connecting classes,
optionally labeled with role names and multiplicity (e.g., one-to-many).
Generalizations (Inheritance): Show hierarchical relationships where a subclass inherits
attributes and methods from a superclass. Generalizations are depicted as a solid line with
a hollow arrow pointing towards the superclass.
Aggregations: Represent whole-part relationships where one class is a part of another.
Aggregations are depicted as a line with a hollow diamond at the end connected to the
whole class.
Compositions: A stronger form of aggregation indicating that the part cannot exist
without the whole. Compositions are depicted as a line with a filled diamond at the end
connected to the whole class.
5. Interfaces: Interfaces define a contract of methods that implementing classes must fulfill.
They are depicted as rectangles with the label «interface» and connected to implementing classes
using a dashed line with a hollow arrow.
6. Visibility: Visibility markers (+ for public, - for private, # for protected) indicate the
accessibility of attributes and methods within the system.
7. Multiplicity: Multiplicity defines the number of instances of one class related to a single
instance of another class in an association. It is shown at the ends of association lines (e.g., 1, 0..,
1..).
1.Objects (Lifelines):It represents instances of classes or components and shown as vertical lines
labeled with object names.
2. Messages: Communication between objects (method calls, signals).Types are Synchronous (waits
for response), asynchronous (continues without waiting), return (response to synchronous).Arrows
between lifelines, labeled with message names and parameters.
3. Activation Boxes (Activation Frames):it represents periods of object activity and represented by
boxes around messages on lifelines.
4. Focus of Control: Its is indicates which object is executing an operation and is represented by
vertical dotted lines or arrows.
6. Constraints: Conditions or constraints under which messages are sent or operations are
executed. It representation by annotations or notes attached to messages or lifelines, specifying
conditions or requirements.
= An Activity Diagram serves the purpose of visually representing the workflow or procedural
flow of activities within a system, process, or use case. It is typically used during the analysis
and design phases of software development to provide a clear and structured depiction of how
tasks and actions unfold within a process. By using activity diagrams, teams can visualize
processes, specify workflows by defining the sequence of activities, their dependencies, and
decision points. This modeling technique helps stakeholders understand the logic and structure of
complex systems or business processes, facilitating better communication and alignment among
project members. Activity diagrams are invaluable in software engineering for designing system
behavior, in business analysis for documenting and improving operational workflows, and in
system design for mapping out interactions between components or subsystems. Their versatility
makes them a fundamental tool for both technical and non-technical stakeholders to grasp and
refine process flows efficiently.
Long Questions
Online Bookstore
/ \
Admin customer
Manage
Browse
Inventor
books
\ /
Search
books
/ \
Remove from
Add to cart
cart
2. Create a Class Diagram for a library management system, including classes
for Book, Member, and Loan.
library management
=
system
/ \
title
author
Member id
ISBN
Name
genre
contact info
quantity
availableCopies
\ /
Loan
Loan id
Due date
Return date
4. Detail Level: Sequence diagrams can provide detailed information about the
timing of events and the order in which operations are performed.
3. Time Order: While they also show the order of messages, the primary focus is on
the roles of objects and their connections rather than the exact timing.
4. Detail Level: Collaboration diagrams can be less detailed in terms of timing but
more detailed in illustrating the relationships and interactions among objects.
Sequence diagrams are ideal when detailing the precise order and timing of
interactions, especially for complex scenarios and debugging. They help visualize the
flow of messages and the step-by-step execution of use cases. Conversely,
collaboration diagrams are best for understanding structural relationships and object
roles within the system. They are useful for designing system architecture and
providing a high-level overview of interactions, focusing on how objects are
interconnected rather than the exact sequence of events. Choose sequence diagrams
for timing and order, and collaboration diagrams for structure and relationships.
4. Design a State Diagram for an ATM system focusing on the states and
transitions for a typical withdrawal operation.
_________________________
| ATM Withdrawal |
| Operation |
|_________________________|
= Creating an Activity Diagram for ordering food in a restaurant using an online app
involves visualizing the steps involved in the process. Here's a simplified outline:
6. Modify Order: User can modify the order (quantity, options, etc.).
8. Payment: User makes payment using preferred payment method (credit card,
online payment, etc.).
10.Prepare Order: Restaurant receives the order and prepares the food.
Start --> Login/Signup --> Browse Menu --> Select Items --> Add to Cart -->
Modify Order --> Proceed to Checkout --> Payment --> Confirm Order -->
Prepare Order --> Delivery/Pickup --> End
6. How do Object Diagrams complement Class Diagrams in UML? Provide an
example.
For example, consider a class diagram that defines a Car class with attributes like
model, color, and engine, and methods like start() and stop(). An object diagram could
illustrate specific instances of Car objects, such as:
+-----------------------------+
| Car |
+-----------------------------+
| model = "Toyota “ |
| color = "Blue" |
| engine = "1.8L" |
+-----------------------------+
+-----------------------------+
| Car |
+-----------------------------+
| model = "Honda Civic" |
| color = "Red" |
| engine = "2.0L" |
+-----------------------------+
7. Analyze and critique an existing Class Diagram, identifying any potential
design issues or improvements.
Responsibilities and Cohesion: Ensure each class has a clear and singular
responsibility, following the Single Responsibility Principle (SRP) to avoid
classes that do too much.
Relationships and Dependencies: Simplify and clarify class relationships to
reduce complexity and improve maintainability, focusing on essential
interactions without unnecessary dependencies.
Attribute and Method Clarity: Use clear and consistent naming conventions for
attributes and methods, ensuring they align closely with the class's
responsibilities and are easily understandable.
Inheritance and Generalization: Evaluate the use of inheritance carefully,
ensuring it follows the Liskov Substitution Principle (LSP) and doesn't overly
constrain the class hierarchy.
Consistency and Documentation: Maintain consistency in UML notation,
layout, and documentation to facilitate understanding and collaboration
among stakeholders and developers.
By addressing these areas, a Class Diagram can be improved to enhance clarity,
maintainability, and alignment with design principles, ultimately supporting more
effective software development and management.
= Explanation :
User initiates login: The user requests to log in through the application.
App sends credentials: The application sends the user's login credentials (username and
password) to the authentication server.
Authentication server validates credentials: The authentication server verifies the
credentials against stored data (like hashed passwords in a database).
Authentication server requests user data: Upon successful validation, the authentication
server requests additional user data (e.g., roles, permissions) from the database.
Authentication server sends user data: The authentication server retrieves the necessary
user data from the database and sends it back to the application.
App verifies credentials and authorizes: The application verifies the received credentials
and checks if the user is authorized based on the retrieved data.
App sends login response: The application sends a response to the user indicating whether
the login was successful or failed.
This sequence diagram outlines the interactions and steps involved in a typical login process,
including authentication and authorization checks between the user, application,
authentication server, and database.
Case Study
Case Study 1:
Develop Use Case Diagrams for different user roles (e.g., Doctor, Patient,
Administrator).
Create Class Diagrams for entities like Patient, Doctor, Appointment, and
Medical Record.
= Let's break down the requirements for the Hospital Management System case study:
Case diagram:
1.Doctor
Doctor
View patient information
Update medical records
Prescribe medication
View schedule
2 .Patient
Patient
Schedule appointment
View medical history
Check test results
Pay bills
3. Administer
Administer
Manage user accounts
Generate reports
Manage hospital resources
Use Case Diagrams for Different User Roles
Patient Class diagram
Patient
patientID: int
name: string
dateOfBirth: date
|contactInfo: string
viewMedicalHistory(): void
scheduleAppointment(): void
Doctor
doctor
- doctorID: int
- name: string
- specialization: string
- contactInfo: string
viewSchedule(): void
updateMedicalRecord(): void
Appointment
Appointment
- appointmentID: int
- date: date
- time: time
- doctorID: int
- patientID: int
scheduleAppointment(): void
| cancelAppointment(): void
Medical Record Class Diagram
Medical record
- recordID: int
- patientID: int
- doctorID: int
- diagnosis: string
- prescriptions: string
addPrescription(): void
updateDiagnosis(): void
E-commerce Platform
Draw a Use Case Diagram for the main functionalities like browsing products, adding to
cart, and checkout.
Develop a Class Diagram for the product catalog, including Product, Category, and
Review classes.
Create an Activity Diagram for the order fulfillment process from order placement to
delivery.
Actors:
Customer
System
Use Cases:
Browse Products
Add to Cart
Checkout
Diagram:
Customer
|---------------------------------------------
| |
| | |
Explanation:
1. Customer: The actor who interacts with the system to perform various actions.
3. Use Cases:
o Browse Products: The customer can browse through a list of products available on
the platform.
o Add to Cart: The customer can add selected products to their shopping cart.
o Checkout: The customer can proceed to purchase the items in their cart.
Class Diagram
Activities:
Place Order
Verify Payment
Update Inventory
Generate Invoice
Pack Order
Ship Order
Deliver Order
Confirm Delivery
Diagram:
Start
Place Order
Verify Payment
/ \
Yes
Update Inventory
Generate Invoice
Pack Order
Ship Order
Deliver Order
|
Confirm Delivery
End
Explanation:
4. Update Inventory: The system updates the inventory to reflect the items sold.
9. Confirm Delivery: The delivery is confirmed by the customer or the delivery system.
Case Study 3:
Banking System
Develop a Use Case Diagram for customer interactions like account creation, money
transfer, and balance inquiry.
Create a Sequence Diagram for the money transfer process including validation and
transaction logging.
Design a State Diagram for an account showing states such as Active, Overdrawn, and
Closed.
= Use Case Diagram for Banking System
Actors:
Customer
System
Use Cases:
Create Account
Transfer Money
Check Balance
Diagram:
Customer
|--------------------------------------------------
| | |
| | |
Explanation:
1. Customer: The actor who interacts with the banking system to perform various actions.
3. Use Cases:
o Check Balance: The customer can check the balance of their account.
This representation outlines the primary interactions between the customer and the system for
account creation, money transfer, and balance inquiry.
State Diagram for an account showing states such as Active, Overdrawn, and Closed.
Participants:
Customer
Banking App
Validation Service
Account Service
Transaction Logger
Diagram: