UML Notes Unit 1
UML Notes Unit 1
Principles of Modeling:
There are four basic principles common to designing any kind of system. They are:
1. The choice of what models to create has a profound influence on how a problem is attacked
and how a solution is shaped.
2. The right models will brilliantly illuminate the most wicked development problems, offering
insight that you simply could not gain otherwise; the wrong models will mislead you, causing
you to focus on irrelevant issues.
3. Every model may be expressed at different levels of precision.
4. The best models are connected to reality.
5. No single model is sufficient. Every nontrivial system is best approached through a small set
of nearly independent models.
To understand the architecture of a system, we need several complementary and interlocking
views: a use case view (exposing the requirements of the system), a design view (capturing the
vocabulary of the problem space and the solution space), a process view (modeling the distribution
of the system's processes and threads), an implementation view (addressing the physical realization
of the system), and a deployment view (focusing on system engineering issues). Each of these views
may have structural, as well as behavioral, aspects. Together, these views represent the blueprints of
software.
Object-Oriented Modeling:
In software, there are several ways to approach a model. The two most common ways are
from an algorithmic perspective and from an object-oriented perspective.
The traditional view of software development takes an algorithmic perspective. In this
approach, the main building block of all software is the procedure or function. This view leads
developers to focus on issues of control and the decomposition of larger algorithms into smaller
ones. As requirements change (and they will) and the system grows (and it will), systems built with
an algorithmic focus turn out to be very hard to maintain.
The contemporary view of software development takes an object-oriented perspective. In
this approach, the main building block of all software systems is the object or class. Simply put, an
object is a thing, generally drawn from the vocabulary of the problem space or the solution space; a
class is a description of a set of common objects. Every object has identity (you can name it or
otherwise distinguish it from other objects), state (there's generally some data associated with it), and
behavior (you can do things to the object, and it can do things to other objects, as well). Object-
oriented development provides the conceptual foundation for assembling systems out of components
using technology such as Java Beans or COM+.
A number of consequences flow from the choice of viewing the world in an object-oriented
fashion: What's the structure of a good object-oriented architecture? What artifacts should the project
create? Who should create them? How should they be measured? Visualizing, specifying,
constructing, and documenting object-oriented systems is exactly the purpose of the Unified
Modeling Language.
I. Structural Things:
Structural things are the nouns of UML models. These are the mostly static parts of a
model, representing elements that are either conceptual or physical. In all, there are seven kinds of
structural things.
A class is a description of a set of objects that share the same attributes, operations,
relationships, and semantics. A class implements one or more interfaces. Graphically, a class is
rendered as a rectangle, usually including its name, attributes, and operations.
A use case is a description of set of sequence of actions that a system performs that yields an
observable result of value to a particular actor. A use case is used to structure the behavioral things in
a model. Graphically, a use case is rendered as an ellipse with solid lines, usually including only its
name.
The remaining three things active classes, components, and nodes• are all class-like, meaning
they also describe a set of objects that share the same attributes, operations, relationships, and
semantics. However, these three are different enough and are necessary for modeling certain aspects
of an object-oriented system.
An active class is a class whose objects own one or more processes or threads and therefore
can initiate control activity. An active class is just like a class except that its objects represent
elements whose behavior is concurrent with other elements. Graphically, an active class is rendered
just like a class, but with heavy lines, usually including its name, attributes, and operations.
The remaining two elements component, and nodes are also different. They represent
physical things, whereas the previous five things represent conceptual or logical things.
A component is a physical and replaceable part of a system that conforms to and provides
the realization of a set of interfaces. Graphically, a component is rendered as a rectangle with tabs,
usually including only its name.
A node is a physical element that exists at run time and represents a computational resource,
generally having at least some memory and, often, processing capability. A set of components may
reside on a node and may also migrate from node to node. Graphically, a node is rendered as a
cube, usually including only its name.
A state machine is a behavior that specifies the sequences of states an object or an interaction goes
through during its lifetime in response to events, together with its responses to those events. A state
machine involves a number of other elements, including states, transitions (the flow from state to
state), events (things that trigger a transition), and activities (the response to a transition).
Graphically, a state is rendered as a rounded rectangle, usually including its name and its
substates, if any.
A class diagram shows a set of classes, interfaces, and collaborations and their relationships.
These diagrams are the most common diagram found in modeling object-oriented systems. Class
diagrams address the static design view of a system. Class diagrams that include active classes
address the static process view of a system.
An object diagram shows a set of objects and their relationships. Object diagrams represent
static snapshots of instances of the things found in class diagrams. These diagrams address the static
design view or static process view of a system as do class diagrams, but from the perspective of real
or prototypical cases.
A use case diagram shows a set of use cases and actors (a special kind of class) and their
relationships. Use case diagrams address the static use case view of a system. These diagrams are
especially important in organizing and modeling the behaviors of a system.
Both sequence diagrams and collaboration diagrams are kinds of interaction diagrams.
An interaction diagram shows an interaction, consisting of a set of objects and their relationships,
including the messages that may be dispatched among them. Interaction diagrams address the
dynamic view of a system. A sequence diagram is an interaction diagram that emphasizes the time-
ordering of messages; a collaboration diagram is an interaction diagram that emphasizes the
structural organization of the objects that send and receive messages. Sequence diagrams and
collaboration diagrams are isomorphic, meaning that we can take one and transform it into the other.
An activity diagram is a special kind of a statechart diagram that shows the flow from
activity to activity within a system. Activity diagrams address the dynamic view of a system. They
are especially important in modeling the function of a system and emphasize the flow of control
among objects.
A deployment diagram shows the configuration of run-time processing nodes and the
components that live on them. Deployment diagrams address the static deployment view of an
architecture.
Specifications:
The UML is more than just a graphical language. We use the UML's graphical notation to
visualize a system; you use the UML's specification to state the system's details. The UML's
specifications provide a semantic backplane that contains all the parts of all the models of a system,
each part related to one another in a consistent fashion.
Adornments:
Most elements in the UML have a unique and direct graphical notation that provides a visual
representation of the most important aspects of the element. A class's specification may include other
details, such as whether it is abstract or the visibility of its attributes and operations. Many of these
details can be rendered as graphical or textual adornments to the class's basic rectangular notation.
Common Divisions:
In modeling object-oriented systems, the world often gets divided in at least a couple of
ways.
First, there is the division of class and object. A class is an abstraction; an object is one
concrete manifestation of that abstraction. In the UML, we can model classes as well as objects.
In this figure, there is one class, named Customer, together with three objects: Jan (which is marked
explicitly as being a Customer object), :Customer (an anonymous Customer object), and Elyse
(which in its specification is marked as being a kind of Customer object, although it's not shown
explicitly here).
Second, there is the separation of interface and implementation. An interface declares a
contract, and an implementation represents one concrete realization of that contract, responsible for
faithfully carrying out the interface's complete semantics. In the UML, we can model both
interfaces and their implementations.
In this figure, there is one component named spellingwizard.dll that implements two interfaces,
IUnknown and ISpelling.
Extensibility Mechanisms
The UML provides a standard language for writing software blueprints, but it is not possible
for one closed language to ever be sufficient to express all possible nuances of all models across all
domains across all time. For this reason, the UML is opened-ended, making it possible for us to
extend the language in controlled ways. The UML's extensibility mechanisms include Stereotypes,
Tagged values, Constraints
A stereotype extends the vocabulary of the UML, allowing you to create new kinds of
building blocks that are derived from existing ones but that are specific to your problem.
A tagged value extends the properties of a UML building block, allowing us to create new
information in that element's specification.
A constraint extends the semantics of a UML building block, allowing you to add new rules
or modify existing ones.
Architecture:
Architecture is the set of significant decisions about
1. The organization of a software system
2. The selection of the structural elements and their interfaces by which the system is
composed
3. Their behavior, as specified in the collaborations among those elements
4. The composition of these structural and behavioral elements into progressively
larger Subsystems
5. The architectural style that guides this organization: the static and dynamic elements
and their interfaces, their collaborations, and their composition.
Software architecture is not only concerned with structure and behavior, but also with usage,
functionality, performance, resilience, reuse, comprehensibility, economic and technology
constraints and trade-offs, and aesthetic concerns. The architecture of a software-intensive system
can best be described by five interlocking views. Each view is a projection into the organization and
structure of the system, focused on a particular aspect of that system.
The use case view of a system encompasses the use cases that describe the behavior of the
system as seen by its end users, analysts, and testers. With the UML, the static aspects of this view
are captured in use case diagrams; the dynamic aspects of this view are captured in interaction
diagrams, state chart diagrams, and activity diagrams.
The design view of a system encompasses the classes, interfaces, and collaborations that
form the vocabulary of the problem and its solution. This view primarily supports the functional
requirements of the system, meaning the services that the system should provide to its end users.
With the UML, the static aspects of this view are captured in class diagrams and object diagrams; the
dynamic aspects of this view are captured in interaction diagrams, statechart
diagrams, and activity diagrams.
The process view of a system encompasses the threads and processes that form the system's
concurrency and synchronization mechanisms. This view primarily addresses the performance,
scalability, and throughput of the system. With the UML, the static and dynamic aspects of this view
are captured in the same kinds of diagrams as for the design view, but with a focus on the
active classes that represent these threads and processes.
The implementation view of a system encompasses the components and files that are used to
assemble and release the physical system. This view primarily addresses the configuration
management of the system's releases, made up of somewhat independent components and files that
can be assembled in various ways to produce a running system. With the UML, the static aspects of
this view are captured in component diagrams; the dynamic aspects of this view are
captured in interaction diagrams, statechart diagrams, and activity diagrams.
The deployment view of a system encompasses the nodes that form the system's hardware
topology on which the system executes. This view primarily addresses the distribution, delivery, and
installation of the parts that make up the physical system. With the UML, the static aspects of this
view are captured in deployment diagrams; the dynamic aspects of this view are captured in
interaction diagrams, statechart diagrams, and activity diagrams.
These five views also interact with one another nodes in the deployment view hold
components in the implementation view that, in turn, represent the physical realization of classes,
interfaces, collaborations, and active classes from
the design and process views.
Software Development Life Cycle:
The UML is largely process-independent, meaning that it is not tied to any particular
software development life cycle. However, to get the most benefit from the UML, we should
consider a process that is Use case driven, Architecture-centric, Iterative and incremental.
Use case driven means that use cases are used as a primary artifact for establishing the
desired behavior of the system, for verifying and validating the system's architecture, for testing, and
for communicating among the stakeholders of the project.
Architecture-centric means that a system's architecture is used as a primary artifact for
conceptualizing, constructing, managing, and evolving the system under development.
An iterative process is one that involves managing a stream of executable releases. An is one
that involves the continuous integration of the system's architecture to produce these releases, with
each new release embodying incremental improvements over the other. Together, an iterative and
incremental process is risk-driven, meaning that each new release is focused on
attacking and reducing the most significant risks to the success of the project.
This use case driven, architecture-centric, and iterative/incremental process can be broken
into phases. A phase is the span of time between two major milestones of the process, when a
welldefined set of objectives are met, artifacts are completed, and decisions are made whether to
move into the next phase. There are four phases in the software development life cycle: inception,
elaboration, construction, and transition.
Inception is the first phase of the process, when the seed idea for the development is brought
up to the point of being at least internally sufficiently well-founded to warrant entering into the
elaboration phase.
Elaboration is the second phase of the process, when the product vision and its architecture
are defined. In this phase, the system's requirements are articulated, prioritized, and baselined.
Construction is the third phase of the process, when the software is brought from an
executable architectural baseline to being ready to be transitioned to the user community.
Transition is the fourth phase of the process, when the software is turned into the hands of
the user community.