SAD fisr ass

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 26

Texas College of Management and IT

System Analysis and Deign


Explore, Learn and Excel

Assignment 1

Submitted By: Submitted To:


Name: Jamuna Ghimire Department Of IT
LCID: :LC00017001932
Program: BIT
Sections: D
Date:7/6/2024
Short questions:

1. What is UML and why is it important in software development?

=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:

 Standardized Visual Language: UML provides a common way to visualize system


architecture.
 Improves Communication: Helps different stakeholders understand and discuss system
design.
 Blueprint for Implementation: Serves as a guide for developers to build the system.
 Facilitates Documentation: Provides clear and consistent documentation of system design.
 Enhances Planning and Analysis: Assists in planning, analyzing, and managing software
projects.
 Supports Complex Systems: Useful for modeling large and complex systems systematically.

2. Describe the different types of UML diagrams and their purposes.

=UML is divided in two main categories: structured and behavior diagram:

Structural Diagrams

1. Class Diagram: Represents system structure; classes, attributes, operations, relationships.


2. Object Diagram: Shows object instances and their relationships at a specific time.
3. Component Diagram: Illustrates software components and their dependencies.
4. Deployment Diagram: Displays hardware configurations and software deployment.
5. Package Diagram: Groups related classes and elements into packages.
6. Composite Structure Diagram: Shows internal structure of a class and its collaborations.
7. Profile Diagram: Customizes UML with stereotypes, tagged values, and constraints.
Behavioral 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.

3. Explain the components of a Use Case Diagram.

= Components of a Use Case Diagram:

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:

 Association: Links actors to use cases, depicted as solid lines.

 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.

4. How does a Class Diagram represent the static structure of a system?

= Class diagram represent the static structure of a system:

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..).

5. What are the main elements of a Sequence Diagram?

= the main elements of a sequence diagram are:

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.

7. Interaction Occurrences: It represents message sequence repetitions. It shown as loops or


iterations.

8. Optional Elements: its Combined Fragments shows alternative or concurrent sequences.


Interaction Uses: Refer to existing diagrams. Notes and Comments: Provide additional information.
6. Describe the purpose of an Activity Diagram and when it is typically used.

= 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

1. Given a scenario, create a Use Case Diagram to represent the functional


requirements.

Scenario: Develop a Use Case Diagram for an online bookstore.

Online Bookstore

/ \

Admin customer
Manage
Browse
Inventor
books

\ /

Search

books

View book details

/ \

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

3. Explain the differences between a Sequence Diagram and a Collaboration


Diagram. When would you use one over the other?
= Sequence Diagram:

1. Focus: Sequence diagrams emphasize the time sequence of messages and


interactions between objects.
2. Visualization: They show how objects interact in a particular sequence, using
vertical lines (lifelines) to represent the time flow and horizontal arrows to
represent messages exchanged.

3. Time Order: The primary focus is on the chronological order of messages,


illustrating the sequence in which interactions occur.

4. Detail Level: Sequence diagrams can provide detailed information about the
timing of events and the order in which operations are performed.

Collaboration Diagram (also known as Communication Diagram):

1. Focus: Collaboration diagrams emphasize the structural organization of objects


that send and receive messages.

2. Visualization: They show objects and their relationships, with numbered


messages indicating the order of interactions.

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 |
|_________________________|

+----------+ Insert Card +--------------+


| Idle | ---------------> | Card |
| | | Inserted |
+-----------+ +--------------+
| (Correct PIN ) |
+--------------+ +--------------+
| Verify | | Verify |
| PIN | | PIN |
+--------------+ +--------------+
| Withdrawal Request
+--------------+
| Select |
| Account |
+--------------+
|
v Withdrawal
+--------------+ Withdrawal
| Enter |<---------------------+
| Amount | Confirmed
+--------------+
|
+--------------+
| Dispense |
| Cash |
+--------------+
5. Develop an Activity Diagram for the process of ordering food in a restaurant
using an online app.

= 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:

1. Start: User opens the restaurant app.

2. Login/Signup: User logs in or signs up if not already authenticated.

3. Browse Menu: User browses through the menu items.

4. Select Items: User selects the desired food items.

5. Add to Cart: Selected items are added to the cart.

6. Modify Order: User can modify the order (quantity, options, etc.).

7. Proceed to Checkout: User proceeds to checkout to finalize the order.

8. Payment: User makes payment using preferred payment method (credit card,
online payment, etc.).

9. Confirm Order: User confirms the order.

10.Prepare Order: Restaurant receives the order and prepares the food.

11. Delivery/Pickup: Food is either delivered to the specified address or made


ready for pickup.

12.End: Process ends once the food is delivered/picked up successfully.

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.

= Object diagrams in UML complement class diagrams by providing a concrete


representation of instances and their relationships at a specific point in time. While
class diagrams focus on the static structure of classes, their attributes, methods, and
associations, object diagrams show actual instances of these classes and how they
interact. This dynamic view helps in understanding real-world scenarios and
behaviors that emerge from the class definitions.

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.

= Analyzing and critiquing an existing class diagram involves several key:

 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.

8. Create a detailed Sequence Diagram for a login process including


authentication and authorization steps.

= 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.

User -> App: 1. Request Login


App -> Authentication Server: 2. Send Login Credentials
Authentication Server -> Database: 3. Validate Credentials
Database --> Authentication Server: 4. User Data Request
Authentication Server --> App: 5. User Data Response
App: 6. Verify Credentials and Authorize
App --> User: 7. Login Successful/Failed

9. How can UML diagrams be used to facilitate communication between


different stakeholders in a software development project?

=UML (Unified Modeling Language) diagrams serve as a powerful communication


tool between different stakeholders in a software development project by providing
visual representations of various aspects of the system under development. Here’s
how UML diagrams facilitate communication:
 Visual Representation: UML diagrams use standardized symbols and notations
to visually represent different aspects of the software system, such as structure,
behavior, interactions, and relationships. This visual representation is easier to
grasp than textual descriptions alone, making it accessible to stakeholders with
varying technical backgrounds.
 Common Language: UML provides a common language that bridges the gap
between technical and non-technical stakeholders. It allows developers,
designers, project managers, and business analysts to communicate effectively
using a shared vocabulary and notation. This common understanding helps in
aligning everyone's perspectives and expectations regarding the system.
 Clarity and Precision: UML diagrams offer clarity and precision in depicting
complex system architectures, designs, and workflows. For instance, class
diagrams illustrate the structure of classes and their relationships, sequence
diagrams depict the flow of interactions between objects or components, and
use case diagrams outline system functionalities from the user's perspective.
Such clarity helps stakeholders to quickly grasp the system’s design and
functionality.
 Facilitating Design Discussions: UML diagrams serve as focal points during
design discussions and reviews. They enable stakeholders to discuss and
validate design decisions, identify potential issues or improvements early in the
development process, and ensure that everyone is aligned with the overall
project goals and requirements.
 Documentation and Planning: UML diagrams act as living documentation that
evolves with the project. They capture and communicate design decisions,
requirements, and constraints, serving as a reference for future development
phases, system maintenance, and updates. This documentation aspect helps
stakeholders to stay informed about the system’s evolution over time.
 Tool for Requirements Elicitation: Use case diagrams and activity diagrams in
UML are particularly useful for eliciting and refining system requirements.
They depict user interactions and system behaviors, helping stakeholders to
validate requirements and ensure that the system meets user needs effectively.
 Integration with Development Processes: UML diagrams integrate well with
various software development methodologies such as Agile, Waterfall, and
DevOps. They can be used iteratively to capture evolving requirements, design
solutions incrementally, and support continuous improvement and feedback
loops across different stages of development.

Case Study

Case Study 1:

Hospital Management System

 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.

 Design a Sequence Diagram for scheduling an appointment.

= 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

Sequence Diagram for scheduling an appointment


Case Study 2:

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.

Use Case Diagram for E-commerce Platform

Actors:

 Customer

 System

Use Cases:
 Browse Products

 Add to Cart

 Checkout

Diagram:

Customer

|---------------------------------------------

| |

Browse Products Add to Cart Checkout

| | |

System ------------- System ----------- System

Explanation:

1. Customer: The actor who interacts with the system to perform various actions.

2. System: The E-commerce platform that provides functionalities to the customer.

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

Product class diagram


----------------------------------
| Product |
----------------------------------
| - productID: int |
| - name: string |
| - description: string |
| - price: float |
| - categoryID: int |
| - stockQuantity: int |
----------------------------------
|+ getDetails(): string |
|+ updateStock(quantity: int): void|
|+ addReview(review: Review): void |
---------------------------------

Review Class Diagram


----------------------------------
| Category |
----------------------------------
| - categoryID: int |
| - name: string |
| - description: string |
----------------------------------
| + getProducts(): List<Product> |

Review Class Diagram


----------------------------------
| Review |
----------------------------------
| - reviewID: int |
| - productID: int |
| - rating: float |
| - comment: string |
| - reviewerName: string |
| - reviewDate: date |
----------------------------------
| + getReviewDetails(): string |
----------------------------------
Activity Diagram for Order Fulfillment Process

Activities:

 Place Order

 Verify Payment

 Update Inventory

 Generate Invoice

 Pack Order
 Ship Order

 Deliver Order

 Confirm Delivery

Diagram:

Start

Place Order

Verify Payment

/ \

Payment Successful? No -------------------> End

Yes

Update Inventory

Generate Invoice

Pack Order

Ship Order

Deliver Order
|

Confirm Delivery

End

Explanation:

1. Start: The starting point of the process.

2. Place Order: The customer places an order on the E-commerce platform.

3. Verify Payment: The system verifies the payment details.

o If the payment is unsuccessful, the process ends.

o If the payment is successful, the process continues.

4. Update Inventory: The system updates the inventory to reflect the items sold.

5. Generate Invoice: The system generates an invoice for the order.

6. Pack Order: The order is packed for shipping.

7. Ship Order: The packed order is shipped to the customer.

8. Deliver Order: The order is delivered to the customer's address.

9. Confirm Delivery: The delivery is confirmed by the customer or the delivery system.

10. End: The process ends after delivery confirmation.

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

|--------------------------------------------------

| | |

Create Account Transfer Money Check Balance

| | |

System System System

Explanation:

1. Customer: The actor who interacts with the banking system to perform various actions.

2. System: The banking system that provides functionalities to the customer.

3. Use Cases:

o Create Account: The customer can create a new bank account.


o Transfer Money: The customer can transfer money to another account.

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.

Sequence Diagram for Money Transfer Process

Participants:

 Customer

 Banking App

 Validation Service

 Account Service

 Transaction Logger

Diagram:

You might also like