Deployment Diagram
Deployment Diagram
In the context of the Unified Modeling Language (UML), a deployment diagram falls under
the structural diagramming family because it describes an aspect of the system itself. In this
case, the deployment diagram describes the physical deployment of information generated by
the software program on hardware components. The information that the software generates
is called an artifact. This shouldn't be confused with the use of the term in other modeling
approaches like BPMN.
Deployment diagrams are made up of several UML shapes. The three-dimensional boxes,
known as nodes, represent the basic software or hardware elements, or nodes, in the system.
Lines from node to node indicate relationships, and the smaller shapes contained within the
boxes represent the software artifacts that are deployed.
Deployment diagrams have several valuable applications. You can use them to:
A variety of shapes make up deployment diagrams. This list offers an overview of the basic
elements you may encounter, and you can see most of these items illustrated in the image
below.
Artifact: A product developed by the software, symbolized by a rectangle with the name
and the word “artifact” enclosed by double arrows.
Association: A line that indicates a message or other type of communication between
nodes.
Component: A rectangle with two tabs that indicates a software element.
Dependency: A dashed line that ends in an arrow, which indicates that one node or
component is dependent on another.
Interface: A circle that indicates a contractual relationship. Those objects that realize the
interface must complete some sort of obligation.
Node: A hardware or software object, shown by a three-dimensional box.
Node as container: A node that contains another node inside of it—such as in the example
below, where the nodes contain components.
Stereotype: A device contained within the node, presented at the top of the node, with the
name bracketed by double arrows.
There are two types of nodes in a deployment diagram: device nodes and execution
environment nodes. Device nodes are computing resources with processing capabilities and
the ability to execute programs. Some examples of device nodes include PCs, laptops, and
mobile phones.
An execution environment node, or EEN, is any computer system that resides within a device
node. It could be an operating system, a JVM, or another servlet container.
Database
Databases represent any data stored by the deployed system. In some instances, you'll see a
database represented as just another node, but sometimes you will see this shape as a
database.
Other shapes
Communication path: A straight line that represents communication between two device
nodes.
Artifacts: A box with the header ">" and then the name of the file.
Package: A file-shaped box that groups together all the device nodes to encapsulate the
entire deployment.
Component: An entity required to execute a stereotype function. Take a look at this guide
for UML component notation.
Design Patterns
2. Structural
These design patterns are about organizing different classes and objects to form larger
structures and provide new functionality. Structural design patterns are Adapter, Bridge,
Composite, Decorator, Facade, Flyweight, Private Class Data, and Proxy.
Use Case Of Structural Design Pattern-
1) When 2 interfaces are not compatible with each other and want to establish a relationship
between them through an adapter it’s called an adapter design pattern. The adapter pattern
converts the interface of a class into another interface or class that the client expects, i.e
adapter lets classes work together that could not otherwise because of incompatibility. so in
these types of incompatible scenarios, we can go for the adapter pattern.
3. Behavioral
Behavioral patterns are about identifying common communication patterns between objects
and realizing these patterns. Behavioral patterns are Chain of responsibility, Command,
Interpreter, Iterator, Mediator, Memento, Null Object, Observer, State, Strategy, Template
method, Visitor
Use Case of Behavioral Design Pattern-
1) The template pattern defines the skeleton of an algorithm in an operation deferring some
steps to sub-classes. The template method lets subclasses redefine certain steps of an
algorithm without changing the algorithm structure. For example, in your project, you want
the behavior of the module to be able to extend, such that we can make the module behave
in new and different ways as the requirements of the application change, or to meet the
needs of new applications. However, no one is allowed to make source code changes to it,
i.e you can add but can’t modify the structure in those scenarios a developer can approach
template design patterns.
1. Precision: The primary advantage of pattern designing is that it allows for precise and
accurate measurements and calculations, resulting in a well-fitted garment.
2. Efficiency: Creating a pattern saves time and effort in the production process. Once the
pattern is created, it can be used to make multiple garments, reducing the time and
resources needed to create each one.
Creativity: Pattern designing allows for creative expression and experimentation,
enabling designers to explore different styles, shapes, and techniques.
3. Consistency: A pattern ensures consistency in the production process, resulting in a
uniformity of the finished product, which is essential for large-scale manufacturing.
4. Replicability: Patterns can be replicated and used for different sizes, styles, and fabrics,
making them a valuable asset for designers and manufacturers.
Observer Pattern
Let us first consider the following scenario to understand observer pattern.
Scenario:
Suppose we are building a cricket app that notifies viewers about the information such as
current score, run rate etc. Suppose we have made two display elements
CurrentScoreDisplay and AverageScoreDisplay. CricketData has all the data (runs, bowls
etc.) and whenever data changes the display elements are notified with new data and they
display the latest data accordingly.
Here Observer and Subject are interfaces(can be any abstract super type not necessarily
java interface).
All observers who need the data need to implement observer interface.
notify() method in observer interface defines the action to be taken when the subject
provides it data.
The subject maintains an observerCollection which is simply the list of currently
registered(subscribed) observers.
registerObserver(observer) and unregisterObserver(observer) are methods to add and
remove observers respectively.
notifyObservers() is called when the data is changed and the observers need to be
supplied with new data.
Advantages:
Provides a loosely coupled design between objects that interact. Loosely coupled objects
are flexible with changing requirements. Here loose coupling means that the interacting
objects should have less information about each other.
Observer pattern provides this loose coupling as:
Subject only knows that observer implement Observer interface.Nothing more.
There is no need to modify Subject to add or remove observers.
We can reuse subject and observer classes independently of each other.
When to use this pattern?
You should consider using this pattern in your application when multiple objects are
dependent on the state of one object as it provides a neat and well tested design for the
same.