0% found this document useful (0 votes)
29 views17 pages

Software Engineering ER Diagram

tmkc

Uploaded by

glumslay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views17 pages

Software Engineering ER Diagram

tmkc

Uploaded by

glumslay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

In Software Engineering, an ER Diagram (Entity-Relationship Diagram) visually

represents the data model of a system. It shows:

 Entities (rectangles): Objects like User, Product.


 Attributes (ellipses): Characteristics of entities, e.g., Name, Email.
 Relationships (diamonds): Links between entities, e.g., Orders, Enrolled In.

ER diagrams help in database design, making it easier to understand data structures


and relationships.
In Software Engineering, a Behavioral View Diagram captures the dynamic
aspects of a system. It focuses on how the system behaves over time, particularly how
the objects and components interact with each other. The main types of behavioral
diagrams in UML (Unified Modeling Language) include:

 Use Case Diagrams: Show the interactions between users (actors) and the system.
 Sequence Diagrams: Represent the order of interactions between objects.
 Activity Diagrams: Illustrate the flow of control or data within the system.
 State Chart Diagrams: Show the states of an object and transitions based on events.

A State Chart Diagram (or State Machine Diagram) depicts the states of an object
and how it changes states based on events or conditions. It is useful for modeling the
lifecycle of an object in response to external events.

Key Components:

 States (rectangles/rounded boxes): Represent different conditions of an object (e.g., Idle,


Processing, Completed).
 Transitions (arrows): Indicate a change from one state to another triggered by an event.
 Initial State: Shown as a filled black circle, representing where the state machine starts.
 Final State: Shown as a circle with a dot inside, indicating the end of the state machine.

Activity diagram is at the last page..


Object
diagram

A Structural View Diagram focuses on the static structure of a system, showing


components, classes, objects, and their relationships. It highlights how the system is
organized rather than its behavior.

Object Diagram

An Object Diagram is a snapshot of the system at a specific moment, showing


instances of classes (objects) and their relationships. It helps visualize the state of
objects and their interactions at that time.

For example, a diagram might show objects like user1:User, order1:Order, with
relationships between them, such as user1 placing order1.
Class
diagram

Structural View Diagram

A Structural View Diagram in software design shows the static structure of a


system. It focuses on components, classes, objects, and their relationships, helping
to understand how the system is organized.

Class Diagram

A Class Diagram is a type of structural diagram that represents the classes, their
attributes, methods, and the relationships between them. It shows how objects of
these classes will interact within the system.

For example, a Person class might have attributes like name and age, with methods
like getName() and setAge().
Timeline
chart

A Timeline Chart is a graphical representation that shows events or activities in


chronological order along a time axis. It is used to display how things progress over
time, helping to visualize sequences of events, milestones, or tasks.

Key Features:

 Time Axis: The horizontal axis typically represents time, showing a scale from left to right
(e.g., hours, days, years).
 Events/Activities: Represented as points, bars, or markers along the time axis, showing when
each event occurs.
 Milestones/Markers: Key events or significant points in time (e.g., project deadlines, product
launches).
Gantt
chart

A Gantt Chart is a type of bar chart used for project management. It visually
represents the schedule of a project, showing tasks, their durations, and dependencies
over time.

Key Features:

 Tasks/Activities: Listed on the vertical axis.


 Time Period: Shown on the horizontal axis (e.g., days, weeks, months).
 Bars: Represent the duration of each task, with the start and end dates indicated.
 Dependencies: Arrows or lines may show relationships between tasks (e.g., Task B depends
on Task A).

Use Cases:

 Project Planning: To track progress and organize tasks.


 Scheduling: Helps allocate resources and manage time effectively.
 Team Collaboration: Allows team members to see the project timeline and task statuses.

A Gantt chart is essential for managing complex projects, ensuring tasks are
completed on schedule.
A DFD (Data Flow Diagram) is a graphical representation used to model the flow of
data within a system. It shows how data moves between processes, data stores, and
external entities.

DFD Levels:

1.

Level 0 (Context Diagram):

2.
1. The highest-level view of the system.
2. Shows the entire system as a single process with external entities (e.g., users,
systems) interacting with it.
3. Purpose: To provide a high-level overview of the system's boundaries.
3.

Level 1:

4.

1. Breaks down the system into major sub-processes.


2. Shows data flow between the main process and its sub-processes, data stores, and
external entities.
3. Purpose: To give a more detailed view of the system's functioning.

5.

Level 2:

6.

1. Further decomposes the sub-processes from Level 1.


2. Focuses on specific tasks, showing how data is processed at a finer level of detail.
3. Purpose: To provide an in-depth view of individual processes and their interactions.

Each level of DFD provides a more detailed understanding of the system, from a
broad overview to intricate details.

Level-0 and level-2 diagrams are below..


UML (Unified Modeling Language) is a standardized visual language used to model
the design and structure of software systems. It helps in representing various aspects
of a system, such as its structure, behavior, and interactions. UML is widely used for
object-oriented software development and consists of 13 diagrams categorized into
Structural and Behavioral diagrams.

Use Case Diagram

A Use Case Diagram is a behavioral diagram in UML that represents the


functional requirements of a system. It shows the interactions between actors (users
or other systems) and the use cases (specific functionalities) within the system.

Key Components:

 Actors: External entities that interact with the system (e.g., users, other systems).
 Use Cases: Specific functions or actions that the system performs (e.g., Login, Register).
 System Boundary: Defines the scope of the system, showing which use cases are part of it.
 Relationships:
o Association: Links actors to use cases, showing interaction.
o Include: Represents mandatory steps that are always performed as part of a use
case.
o Extend: Represents optional, conditional actions that can extend the functionality of
a use case.
Behavioral View Diagram

A Behavioral View Diagram in software design represents the dynamic aspects of a


system, focusing on how the system behaves over time. It illustrates interactions,
state changes, and workflows between system components. Examples include use
case diagrams, sequence diagrams, and activity diagrams.

Sequence Diagram

A Sequence Diagram is a behavioral diagram in UML that shows the order of


interactions between objects or components in a system. It represents how objects
communicate through messages over time.

Key Elements:

 Objects: Represented by vertical lifelines.


 Messages: Horizontal arrows showing communication between objects.
 Activation bars: Indicate when an object is active and processing a message.
Behavioral View Diagram

A Behavioral View Diagram in software design shows the dynamic behavior of a


system, focusing on how system components interact and change states over time. It
includes diagrams like use case diagrams, sequence diagrams, and activity
diagrams.

Activity Diagram

An Activity Diagram is a behavioral diagram that represents the flow of control or


data within a system. It shows the sequence of activities and decisions, often used for
modeling business processes or workflows.

Key Elements:

 Activities: Represent actions or tasks (rectangles).


 Transitions: Arrows that show the flow between activities.
 Decisions: Diamonds that represent decision points or branches in the flow.
 Start/End: Circles indicating the beginning and end of the process.
Collaboration
diagram

A Behavioral View Diagram in software engineering captures the dynamic


behavior of a system, focusing on how the system’s components interact over time. It
includes diagrams like use case diagrams, sequence diagrams, collaboration
diagrams, and activity diagrams that highlight interactions, state changes, and
workflows.

Collaboration Diagram

A Collaboration Diagram (also known as a Communication Diagram) is a


behavioral diagram in UML that shows the interaction between objects in a system
based on messages. It focuses on the structural organization of the objects and the
sequence of messages exchanged.

Key Elements:

 Objects: Represented by labeled circles or rectangles.


 Messages: Arrows showing the communication between objects, often numbered to show
the order of interactions.
 Links: Connections between objects that indicate their relationships.
Junit test

1. Set Up JUnit:

If you're using Maven, add the JUnit dependency in the pom.xml:


2. Sample Class for Hospital Management System:

Suppose you have a simple Patient class for managing patient details:

public class Patient {

private String name;

private int age;

private String disease;

public Patient(String name, int age, String disease) {

this.name = name;

this.age = age;

this.disease = disease;

public String getName() {

return name;

public int getAge() {

return age;

public String getDisease() {

return disease;

}
public String checkEligibilityForSurgery() {

if (age > 60) {

return "Not Eligible for Surgery";

return "Eligible for Surgery";

3. Write JUnit Tests for the Patient Class:

Create a PatientTest class to test the behavior of the Patient class methods using
JUnit.

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

public class PatientTest {

@Test

public void testPatientDetails() {

// Create a patient object

Patient patient = new Patient("John Doe", 45, "Fever");

// Check the name

assertEquals("John Doe", patient.getName());

// Check the age

assertEquals(45, patient.getAge());
// Check the disease

assertEquals("Fever", patient.getDisease());

@Test

public void testEligibilityForSurgery() {

// Test with a patient under 60

Patient patient1 = new Patient("Jane Smith", 50, "Appendicitis");

assertEquals("Eligible for Surgery", patient1.checkEligibilityForSurgery());

// Test with a patient over 60

Patient patient2 = new Patient("Mark Johnson", 65, "Knee Pain");

assertEquals("Not Eligible for Surgery", patient2.checkEligibilityForSurgery());

4. Running the Tests:

If you are using Maven, you can run the tests with:

mvn test

You might also like