Sam CH-7
Sam CH-7
Simple Association:
• A structural link between two
peer classes.
• There is an association between
Class1 and Class2
• A solid line connecting two
classes
…Class Relationships
Aggregation:
• A special type of association. It represents a
"part of" relationship.
• Class2 is part of Class1.
• Many instances (denoted by the *) of Class2
can be associated with Class1.
• Objects of Class1 and Class2 have separate
lifetimes.
• The aggregate is the parent class, the
components are the children classes
• A solid line with an unfilled diamond at the
association end connected to the class of
composite
…Class Relationships
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.
• A solid line with a filled diamond at the
association connected to the class of
composite
…Class Relationships
Dependency:
• Exists between two classes if the
changes to the definition of one
may cause changes to the other
(but not the other way around).
• Class1 depends on Class2
• A dashed line with an open arrow
Visibility of Class attributes and Operations
• In object-oriented design, there is a notation of visibility for
attributes and operations.
• UML identifies four types of
visibility: public, protected, private, and package.
• The basic concepts are similar for class diagrams and object diagrams.
• Object diagrams also represent the static view of a system but this static view is a snapshot of the system at a
particular moment.
• Object diagrams are used to render a set of objects and their relationships as an instance.
• It means the object diagram is more close to the actual system behavior.
….Cont’d
Contents
Structural Diagram
ØDeployment Diagram
ØComponent Diagram
ØPackage Diagram (Reading Assignment)
UML Deployment Diagram
What is Deployment Diagram?
• Deployment Diagram is a type of diagram that specifies the physical
hardware on which the software system will execute.
• It also determines how the software is deployed on the underlying
hardware. It maps software pieces of a system to the device that are
going to execute it.
• The deployment diagram maps the software architecture created in
design to the physical system architecture that executes it.
• In distributed systems, it models the distribution of the software across
the physical nodes.
• In general, deployment diagram visualizes the topological view of an
entire system.
….What is Deployment Diagram?
• A deployment diagram plays a critical role during the administrative
process, and it must satisfy the following parameters,
• High performance
• Maintainability
• Scalability
• Portability
• Easily understandable
• Nodes and artifacts are the essential elements of deployment.
• Before actually drawing the deployment diagram, all nodes and the
relationship between every node of the system must be identified.
….cont’d
•We must know the architecture of a system:-
• Is it a web application?
• Cloud application?
• Desktop application?
• Or a mobile application? All these things are critical and
plays a vital role during the development of a deployment
diagram.
•If all the nodes, relations, and artifacts are known, then
it becomes easy to develop a deployment diagram.
Deployment Diagram Notations
Node
• In order to draw a deployment diagram, we need to first
become familiar with deployment diagram notations and
deployment diagram elements.
• A node, represented as a cube, is a physical entity that executes
one or more components, subsystems or executables.
…….Cont’d
• Node is computational resource upon which artifacts are
deployed for execution.
• A node may vary in its size depending upon the size of the
project.
• Node is an essential UML element that describes the execution
of code and the communication between various entities of a
system.
• An association between nodes represents a communication
path from which information is exchanged in any direction.
Deployment Diagram Notations
Artifact
• Represents the specification of a concrete real-world entity related to
software development.
• We can use the artifact to describe a framework which is used during
the software development process or an executable file.
• Artifacts are deployed on the nodes. <<Artefacts>>
• The most common artifacts are as follows,
• Source files , Executable files ,
• Database tables ,Scripts, DLL files,
• User manuals or documentation,
• Output files
…….Cont’d
•Generally, There are two types of nodes in a deployment
diagram: device nodes and execution environment
nodes.
• Device nodes are physical computing resources with
processing memory and services to execute software, such
as typical computers or mobile phones.
• An execution environment node, or EEN, is a software
computing resource that runs within an outer node and
which itself provides a service to host and execute other
executable software elements. It could be an operating
system, a JVM, or another servlet container.
…….Cont’d
Communication Association
• This is represented by a solid line between two nodes. It
shows the path of communication between nodes.
…Example of a Deployment diagram
• Following is a sample deployment diagram to provide an idea of the deployment
view of order management system. Here, we have shown nodes as Monitor
,Modem, Caching server, and Servers.
• The application is assumed to be a web-based application, which is deployed in a
clustered environment using server 1, server 2, and server 3. The user connects to
the application using the Internet. The control flows from the caching server to
the clustered environment.
Example-2 Deployment diagram
• This example shows a basic deployment diagram
which consists of a web server, a database server,
and the machine where the user views the website.
Example-3
• UML 2 deployment diagram for the university information system.
Deployment Diagram for Hotel Management System
Summary
• The deployment diagram maps the software architecture created in
design to the physical system architecture that executes it.
• It maps software pieces of a system to the hardware that are going to
execute it.
• Deployment diagram visualizes the topological view of an entire
system.
• Nodes and artifacts are the essential elements of deployment.
• Node and artifacts of a system participate in the final execution of a
system.
UML Component Diagram
Component diagrams
• The term "component" refers to a module of classes that represent
independent systems or subsystems with the ability to interface with
the rest of the 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.
• Help communicate and explain the functions of the system being built
to stakeholders
• Helps in identifying the components that make up the system and
show the relationship between components.
• Component diagram is replaceable and executable peace of a system
whose implementation detail is hidden.
…..Component diagrams
• Component diagram shows the structural relationship between the
components of a system.
• Components are considered autonomous, encapsulated units within a
system or sub-system that provides one or mode interfaces.
• Components can be interchanged and reused and they interacts via
interface
• Helps to divides systems into components and show their
relationships.
Component Diagram Symbols
• Important to see the common component diagram notations that are
used to draw a component diagram.
• A high-level, abstracted view of a component in UML 2 can be
modeled as:
• A rectangle with the component's name
• A rectangle with the component icon
• A rectangle with the stereotype text and/or icon
….Component Diagram Symbols
Provided Interface and the Required Interface
• Although we can show more detail about the relationship between two
components using the ball-and-socket notation (provided interface and
required interface), we can just as well use a dependency arrow to show the
relationship between two components.
….Component Diagram
• Component Diagram Example - Using Interface (Order
System)
Cont’d
Modeling Source Code
• Either by forward or reverse engineering, identify the set of source
code files of interest and model them as components stereotyped as
files.
• Component Example - Java Source Code
….Cont’d
Modeling a Physical Database
• Identify the classes in your model that represent logical database
schema.
• To visualize, specify, construct, and document our mapping, create a
component diagram that contains components stereotyped as tables.
….Cont’d
Subsystems
• The subsystem notation element inherits all the same rules as the component
notation element. The only difference is that a subsystem notation element has the
keyword of subsystem instead of component.
Example :- Component Diagram for Online Shopping System
Exercise -1
Question 1:
• A company consists of departments. Departments are located in one
or more offices. One office acts as a headquarter. Each department
has a manager who is recruited from the set of employees.
Task:
• Draw a class diagram which consists of all the classes in your
system their attributes and operations, relationships between the
classes, multiplicity specifications, and other model elements that
you find appropriate
Possible Solution
Exercise -2
• Pair programming is an agile software development technique in which two
programmers work together at one work station. One types in code while the
other reviews each line of code as it is typed in. The person typing is called the
driver. The person reviewing the code is called the observer. The two
programmers switch roles frequently (possibly every 30 minutes or less).
• Suppose that you are asked to build a system that allows Remote Pair
Programming. That is, the system should allow the driver and the
observer to be in remote locations, but both can view a single desktop
in real-time. The driver should be able to edit code and the observer
should be able to “point” to objects on the driver’s desktop. In addition,
there should be a video chat facility to allow the programmers to
communicate. The system should allow the programmers to easily
swap roles and record rationale in the form of video chats. In addition,
the driver should be able to issue the system to backup old work. Draw
a use case diagram for the given system.
Possible solution
End