SDA Lab
SDA Lab
SDA Lab
SCIENCES
Component Diagram:
While other UML diagrams, which describe the functionality of a system, componentdiagrams are used
to model the components that help make those functionalities.
Component diagrams: are used to visualize the organization of system components and the dependency
relationships between them. They provide a high-level view of the components within a system. The
components can be a software component such as a database or user interface; or a hardware component
such as a circuit, microchip or device; or a business unit such as supplier, payroll or shipping.
Component diagrams.
Are used in Component-Based-Development to describe systems with Service-Oriented
Architecture
Show the structure of the code itself
Can be used to focus on the relationship between components while hidingspecification
detail
Help communicate and explain the functions of the system being built to
stakeholders
Deployment diagrams are parts of the Physical view. This view is concerned with the physical
elements of your system, such as executable software files and the hardware they run on.
Deployment diagrams bring the software into real world by showing how software gets assigned
to hardware and how the pieces communicate.
Component
Example:
Class work:
The iTunes setup can be downloaded from the iTunes website, and also it can be installed on the
home computer. Once the installation and the registration are done, iTunes application can easily
interconnect with the Apple iTunes store. Users can purchase and download music, video,TV
serials, etc. and cache it in the media library.
Devices like Apple iPod Touch and Apple iPhone can update its own media library from the
computer with iTunes with the help of USB or simply by downloading media directly from the
Apple iTunes store using wireless protocols, for example;Wi-Fi, 3G, or EDGE.
Task 1:
Three entity classes are used in a collaboration – CarSharer, Journey and Address. Each of these
classes will be implemented by a (.java) source file. These classes are used across a number of use
cases and are grouped together into a CarSharing component as Java (.class) files. here we are just
dealing with the source files. There are two other classes MCSUserInterface and MCSControl.
Each of these will be implemented by a (.java) file. The MCSControl component has a dependency
on the CarSharing component and on the MCSUserInterface component
Draw a component diagram showing the source code dependencies. The .class files are grouped
together into two Java archive (.jar) files. The MCSControl.class component will need to read a
configuration file (MCS.ini) and display a help file (MCS.hlp) when required. The MCSControl
(.class) file also has dependencies on the MCSUserInterface (.java) file and the CarSharing (.jar)
components.
Task 2:
Draw a deployment diagram given that the nodes are three client PCs, a server and a printer. The
communications protocol between the clients and server is TCP/IP; and between the server and
the printer is a standard parallel printer protocol. The user interface and the control objects will
run on the clients.
Task 3:
Create a component diagram:
An online examination system is a computer-based test system that may be used to conduct
computer-based tests online. This test system doesn't use as many resources and doesn't need
question papers or answer scripts. It also doesn't need to schedule exam rooms, coordinate
invigilators, or do other things. This online examination system gives the examination procedure
more flexibility and security. Once all of the questions have been submitted, the system can shuffle
and assign questions to students in different orders. This reduces the possibility of cheating. The
purpose of the online examination approach is to evaluate students' knowledge of the subject. In
comparison to traditional pen-and-paper testing, this method minimizes logistical problems and
disadvantages. Students are not required to gather in the classroom for the exam.
Task 4:
Need to be uploaded
Assa NATIONAL UNIVERSITY OF COMPUTER AND
EMERGING SCIENCES
SL-2002 – Software Design & Architecture Lab
Lab Instructor: Syeda Rubab Manzar
“[email protected]”
Lab 11
Outline
• State chart or state machine diagram
• Exercise
A state is denoted by a round-cornered rectangle with the name of the state written inside it.
Choice Pseudo-State Example
Define Entry/Exit
Junction Pseudo-State
History States
Concurrent Regions
Example:
1. There is a control button available for the user of the oven. If the oven is idle with the door is closed and
you push the button, the oven will start cooking (that is, energize the power-tube for one minute).
2. Also while cooking, another button is pushed, it will cause the oven to cook for extended time.
3. Pushing the button when the door is open has no effect (because it is disabled).
4. Whenever the oven is cooking or the door is open the light in the oven will be on.
5. Opening the door stops the cooking.
6. Closing the door turns off the light. This is the normal idle state, prior to cooking when the user has placed
food in the oven.
7. If the oven times-out the light and the power-tube are turned off and then a beeper emits a sound to
indicate that the cooking is finished.
Solution:
NATIONAL UNIVERSITY OF COMPUTER AND EMERGING
SCIENCES
SE-220 – Software Design & Architecture Lab
LAB Instructors: Noureen Fatima
Lab 07
Outline
• To Understand Interaction Diagrams
• Sequence Diagram
• System Sequence Diagram
• Collaboration Diagram
• Exercise
Interaction Diagrams
The purpose of interaction diagrams is to visualize the interactive behaviour of the system.
Visualizing the interaction is a difficult task. Hence, the solution is to use different types of models
to capture the different aspects of the interaction.
Sequence and collaboration diagrams are used to capture the dynamic nature but from a different
angle.
The purpose of interaction diagram is −
• To capture the dynamic behaviour of a system.
• To describe the message flow in the system.
• To describe the structural organization of the objects.
• To describe the interaction among objects.
Interaction Diagram Example - Access Control System
• The Interaction Establish Access occurs first with argument “Illegal PIN" followed by
an interaction with the message Card Out which is shown in an inline Interaction.
• Then there is an alternative as we find a decision node with an Interaction Constraint
on one of the branches.
• Along that control flow we find another inline Interaction and an Interaction Use in the
sequence.
Example 01
The example shows a person who found ring bell for calling inside the room, being a person
he request to open the door. Door is digital they required face recondition
Sequence Diagram
• Sequence diagrams model the dynamic aspects of a software system.
• The emphasis is on the “sequence” of messages rather than relationship between objects.
• A sequence diagram maps the flow of logic or flow of control within a usage scenario into a visual
diagram enabling the software architect to both document and validate the logic during the analysis
and design stages.
• Sequence diagrams provide more detail and show the message exchanged among a set of
objects over time.
• Sequence diagrams are good for showing the behavior sequences of a diagram, shows only the
sequence of messages not their exact timing. It shows when and how long object is active/idle.
Purpose
• The main purpose of this diagram is to represent how different business objects interact.
• A sequence diagram shows object interactions arranged in time sequence.
• It depicts the objects and classes involved in the scenario and the sequence of messages
exchanged between the objects needed to carry out the functionality of the scenario.
• It is during the design period that developers and architects utilize the diagram to showcase
the system’s object interactions, thereby putting out a more fleshed out overall system design.
Self-Message
A self-messages can represent a recursive call of an operation, or one method calling
another method belonging to the same object. It is shown as creating a nested focus
of control in the lifeline’s execution occurrence.
Synchronous Calls
Synchronous messages only request operations, not signals. The message type is synchCall.
Synchronous messages wait for a response from the operation before resuming their behavior.
Synchronous messages are displayed as an arrow with a filled arrowhead.
Asynchronous Calls
Asynchronous messages of the type (MessageSort) asynchCall, connect to an operation and trigger
its execution. With asynchronous messages, the system does not wait for a response from the
recipient, but continues its processes without interruption. Operation parameters and message
attributes must match.
Lost and Found Messages
Lost messages are those that are either sent but do not arrive at the intended recipient, or which go to
a recipient not shown on the current diagram. Found messages are those that arrive from an
unknown sender, or from a sender not shown on the current diagram. They are denoted going to or
coming from an endpoint element
Overview
System sequence diagrams are visual summaries of the individual use cases.
All systems are treated as a black box; the diagram places emphasis on events
that cross the system boundary from actors to systems. A system sequence
diagram should be done for the main success scenario of the use case, and
frequent or complex alternative scenarios.
Communication diagram is a kind of UML diagram that is designed for illustrating the
dynamic view of the system. It emphasizes the structural organization of the objects' send and
receive messages.In this example of the notation for a communication diagram, objects (actors
in use cases) are represented by rectangles. In the example (generic communication diagram):
• The objects are Object1, Object2, Object..., ObjectN-1 ..., and ObjectN.
• Messages passed between objects are represented by labeled arrows that start with the
sending object (actor) and end with the receiving object.
• The sample messages passed between objects are labeled 1: message1, 2: message2, 3:
message3, etc., where the numerical prefix to the message name indicates its order in
the sequence.
• Object1 first sends Object2 the message message1, Object2 in turn sends ObjectN-1 the
message message2, and so on.
Library management systems also involve maintaining the database for entering new books and
recording books that have been borrowed with their respective due dates.
NATIONAL UNIVERSITY OF COMPUTER AND EMERGING
Assa SCIENCES
SE-2002 – Software Design & Architecture Lab
LAB Instructors: Noureen Fatima “Noureen.Fatima @nu.edu.pk”
Lab 05
Outline
• To Understand Analysis Classes
• Control, Boundary, and Entity
• Robustness Analysis ECB Pattern
• Exercise
Analysis Class Stereotypes: Analysis classes represent an early conceptual model for ‘things
in the system which have responsibilities and behavior’. They eventually evolve into classes and
subsystems in the Design Model. The purpose of the Find Classes from Use-Case Behavior step
is to identify a candidate set of model elements (analysis classes) that will be capable of performing
the behavior described in the use case. Analysis classes may be stereotyped as one of the following:
Boundary classes
Control Classes
Entity classes
They are based on the model-view-controller concept, where the entity is the model, the control
is the controller, and the boundary is the view.
The Role of an Entity Class: The main responsibilities of entity classes are to store
and manage information in the system.
Entity Class always as environment independent.
Example: Register for Courses (Create Schedule)
Entity
Control Class
Boundary Class
A boundary class intermediates between the interface and something outside the system.
Boundary classes insulate the system from changes in the surroundings.
(for example, changes in interfaces to other systems and changes in user requirements),
keeping these changes from affecting the rest of the system.
The Role of a Boundary Class: A boundary class is used to model interaction between the
system's surroundings and it’s inner workings.
1) Create a papyrus class diagram as discussed in the previous lab. To include the stereotypes of
the ECB pattern, click on the right click on the class in the class diagram and go to
Profiles Update profile option
2) Suppose you want to create a class of entity stereotype. Under the update stereotype window,
type “entity” in qualified name and enter “ECB” in profile. When you do this, the entity will
automatically appear in the stereotype and qualified name will automatically change to
"ECB::entity".
Finally, click on + sign beside properties heading and change the name to “name” and value to
“entity” and click on ‘Ok’ as shown in the image below:
Example 01
User Id AppUC11
Use Case Name Apply for scholarship
Actor Applicant
Description Search for international Scholarship
Trigger The applicant want to search for foreign fully funded scholarship
Precondition Applicant start a web browsing
Postcondition Searched result meet with desirable criteria
Normal Flow 1. Applicant visit international scholarship websites
2. Applicant click on “apply scholarship” button
3. Listed scholarship page displayed from system
4. Applicant select fully funded scholarship and click apply button
5. System ask for all the academic and personal details
6. After system confirm his/her criteria and will give confirmation email.
Alternative There is no alternative way to apply for international scholarship
flows
Exception In step no 06, may system will not dent confirmation email to the applicant due
to any missing data.
Include None
Issue None
Robustness Diagram
1. Visit https://online.visual-paradigm.com/
2. Click on "Start Your Free Trial" within the edition table
3. Enter your email address in the Sign up page and click Sign up to create an online
workspace
4. Confirm the confirmation email we sent
5. Done! You can start creating your own drawing with the online drawing tool. Enjoy!
NATIONAL UNIVERSITY OF COMPUTER AND EMERGING
SCIENCES
SE-220 – Software Design & Architecture Lab
LAB Instructors: Noureen Fatima
Class diagrams:
In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of
static structure diagram that gives an overview of a system by showing the system's classes,
their attributes, operations (or methods), and the relationships among objects -- they display what
interacts but not what happens when they do interact.
Class Notation:
UML class notation is a rectangle divided into three parts: class name, attributes, and operations.
1. Class Name
The name of the class appears in the first partition.
2. Class Attributes
Attributes are shown in the second partition.
The return type of a method is shown after the colon at the end of the
method signature.
The return type of method parameters is shown after the colon following
the parameter name.
There are many animals in the zoo but you would model only one class called Animal, to represent
entire collection of animals.
Class name
Attributes
Operations
The class notation is a 3-piece rectangle with the class name, attributes, and operations. Attributes and
operations can be labeled according to access and scope. Here is a new, expanded Animal class
Public
Private
List of arguments
Return
Class scope
(static)
Symbol Access
+ public
- private
# protected
~ default
There are following key relationships between classes in a UML class diagram:
1. Association
2. Generalization/ Inheritance
3. Realization/ Implementation
4. Dependency
5. Aggregation
6. Composition
1. Association:
There is an association between two classes if an instance of one class must know about the other
in order to perform its work.
Example:
Student.class Course.class
sda.setCourseName("SDA");
urdu.setCourseName("SDA");
student.setCourse(sda);
student.setCourse(urdu);
Course savedCourse = student.getCourse();
Course savedCourse = student.getCourse();
Multiplicities Meaning
2. Generalization/ Inheritance
}
public class CheckingAccount extends public class SavingAccount extends
BankAccount { BankAccount {
implementing class.
Example: Figure interface might specify method for area. The Rectangle and Circles classes need to
Rectangle.java
return null;
}
}
4. Dependency
The figure below shows an example of dependency. The relationship is displayed as a dashed line
with an open arrow
Example: Customer is dependent on Account as its makingDeposit using the class variable Account.
class Account{
class Customer{
acc.deposit();
5. Aggregation
Example:
The Society class has an instance variable of type Student. As we have a variable of type
Student in the Society class, it can use Society reference which is ad in this case, to invoke
methods of the Student class.
Student.java
public Society(int year, String name, int id, int roll_no, int CNIC)
{ this.year = year;
this.name = name;
this.student= new Student(id, roll_no, CNIC);
}
}
Composition
A special type of aggregation where parts are destroyed when the whole is destroyed.
Objects of Class2 live and die with Class1.
Class2 cannot stand by itself.
Job.java
package com.journaldev.composition;
public class Job {
private String role;
private long salary;
private int id;
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public long getSalary() {
return salary;
}
public void setSalary(long salary) {
this.salary = salary;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
Person.java
package com.journaldev.composition;
public class Person {
//composition has-a relationship
private Job job;
public Person(){
this.job=new Job();
job.setSalary(1000L);
}
public long getSalary() {
return job.getSalary();
}
}
Class Task
Draw a class diagram of a campus library management
system. Attributes of library include name, phone number.
Library contains books and journals that can be added or
removed form the library.
Each book and journal has an id, name, author name and
publisher.
Library member can issue and return the book.
Library member can be student or staff. Students can issue 4
books at a time and staff can have 8 books.
Journals are available for staff only.