Ooad U2
Ooad U2
UNIT II
Introduction to UML: Importance of modeling, principles of modeling, object oriented
modeling, conceptual model of the UML, Architecture, and Software Development Life Cycle.
Basic Structural Modeling: Classes, Relationships, common Mechanisms, and diagrams. Case
Study: Control System: Traffic Management.
Importance of modelling
"Modeling is a central part of all the activities that lead up to the deployment of
good software. We build models to communicate the desired structure and
behavior of our system. We build models to visualize and control the system's
architecture. We build models to better understand the system we are building,
often exposing opportunities for simplification and reuse. And we build models to
manage risk."
The UML gives you a standard way to write a system's blueprints, covering
conceptual things, such as business processes and system functions, as well as
concrete things, such as classes written in a specific programming language,
database schemas, and reusable software components.
Importance of modeling
Aims of modeling
We build models so that we can better understand the system we are developing.
Principles of Modeling
1. The choice of what models to create has a profound influence on how a problem
is attacked and how a solution is shaped.
In software, there are several ways to approach a model. The two most common
ways are
1. Algorithmic perspective
2. Object-oriented perspective
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 the system grows, systems built with an algorithmic
focus turn out to be very hard to maintain.
Object-Oriented Perspective
In this approach, the main building block of all software systems is the object
or class.
An Overview of UML
Visualizing Specifying
Constructing Documenting
Visualizing The UML is more than just a bunch of graphical symbols. Rather,
behind each symbol in the UML notation is a well-defined semantics. In this
manner, one developer can write a model in the UML, and another developer, or
even another tool, can interpret that model unambiguously
Specifying means building models that are precise, unambiguous, and complete.
Constructing the UML is not a visual programming language, but its models can
be directly connected to a variety of programming languages
o Requirements
o Architecture
o Design
o Source code
o Project plans
o Tests
o Prototypes
o Releases
Rules
Basic building blocks of the UML: Vocabulary of the UML can be defined
1. Things
2. Relationships
3. Diagrams
Structural things
Behavioral things
Grouping things
Annotational 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.
Class
Collaboration
It defines an interaction and is a society of roles and other elements that work
together to provide some cooperative behavior that's bigger than the sum of all
the elements.
Active class
It 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.
Component
Node
They are the dynamic parts of UML models. These are the verbs of a model,
representing behavior over time and space.
Interaction
Behavioral Things
They are the dynamic parts of UML models. These are the verbs of a model,
representing behavior over time and space.
Grouping Things
1. These are the organizational parts of UML models. These are the boxes into
which a model can be decomposed
Package
Annotational things
These are the explanatory parts of UML models. These are the comments you
may apply to describe about any element in a model.
Note
Dependency
Association
Generalization
Class diagram
Object diagram
Sequence diagram
Collaboration diagram
Activity diagram
Component diagram
Deployment diagram
Class diagram
A class diagram shows a set of classes, interfaces, and collaborations and their
relationships.
Class diagrams that include active classes address the static process view of a
system.
Object diagram
A use case diagram shows a set of use cases and actors and their relationships
Use case diagrams address the static use case view of a system.
Interaction Diagrams
Sequence diagrams and collaboration diagrams are isomorphic, meaning that you
can take one and transform it into the other.
Statechart diagram
An activity diagram is a special kind of a state chart 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.
Component diagram
Deployment diagram
1. Elided Certain elements are hidden to simplify the view 2. Incomplete Certain
elements may be missing 3. Inconsistent The integrity of the model is not
guaranteed
Specification
They provides a textual statement of the syntax and semantics of that building
block.
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
Common Divisions
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, you can model both interfaces and their implementations,
as shown in Figure 2-18.
Extensibility Mechanisms
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 you 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. Examples for these are
Architecture
A system's architecture is perhaps the most important artifact that can be
used to manage these different viewpoints and so control the iterative and
incremental development of a system throughout its life cycle.
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 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.
Design View
This view primarily supports the functional requirements of the system, meaning
the services that the system should provide to its end users.
Process View
The process view of a system encompasses the threads and processes that form
the system's concurrency and synchronization mechanisms.
Deployment View
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.
Each of these five views can stand alone so that different stakeholders can
focus on the issues of the system's architecture that most concern them.
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.
The UML permits you to express every one of these five views and their
interactions.
However, to get the most benefit from the UML, you should consider a process
that is
It 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-centric
An iterative process
An incremental process
A phase is the span of time between two major milestones of the process, when
a well-defined set of objectives are met, artifacts are completed, and decisions
are made whether to move into the next phase.
As below figure shows, there are four phases in the software development life
cycle: inception, elaboration, construction, and transition. In the diagram,
workflows are plotted against these phases, showing their varying degrees of
focus over time.
It 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 phase:
It 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. A system's requirements may range from
general vision statements to precise evaluation criteria, each specifying
particular functional or nonfunctional behavior and each providing a basis for
testing.
Construction phase: It 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. The system's requirements and especially
its evaluation criteria are constantly reexamined against the business needs of
the project, and resources are allocated as appropriate to actively attack risks
to the project.
Transition phase:
It is the fourth phase of the process. When the software is turned into the
hands of the user community.
One element that distinguishes this process and that cuts across all four phases
is an iteration.
This means that the software development life cycle can be characterized as
involving a continuous stream of executable releases of the system's
architecture. It is this emphasis on architecture as an important artifact that
drives the UML to focus on modeling the different views of a system's
architecture.
Attributes
An attribute is a named property of a class that describes a range of values
that instances of the property may hold.
A class may have any number of attributes or no attributes at all.
An attribute represents some property of thing you are modeling that is shared
by all objects of that class
You can further specify an attribute by stating its class and possibly a default
initial value.
Operations
An operation is the implementation of a service that can be requested from any
object of the class to affect behavior.
A class may have any number of operations or no operations at all
Graphically, operations are listed in a compartment just below the class
attributes
You can specify an operation by stating its signature, covering the name, type,
and default value of all parameters and a return type.
Responsibilities
A Responsibility is a contract or an obligation of a class
When you model classes, a good starting point is to specify the responsibilities
of the things in your vocabulary.
A class may have any number of responsibilities, although, in practice, every
well-structured class has at least one responsibility and at most just a handful.
Graphically, responsibilities can be drawn in a separate compartment at the
bottom of the class icon
You'll use classes most commonly to model abstractions that are drawn from the
problem you are trying to solve or from the technology you are using to implement
a solution to that problem.
They represent the things that are important to users and to implementers
To model the vocabulary of a system
Identify those things that users or implementers use to describe the problem
or solution.
Use CRC cards and use case-based analysis to help find these abstractions.
For each abstraction, identify a set of responsibilities.
Provide the attributes and operations that are needed to carry out these
responsibilities for each class.
Figure shows a set of classes drawn from a retail system, including Customer,
Order, and Product. This figure includes a few other related abstractions drawn
from the vocabulary of the problem, such as Shipment (used to track orders),
Invoice (used to bill orders), and Warehouse (where products are located prior
to shipment). There is also one solution-related abstraction, Transaction, which
applies to orders and shipments.
For example, figure shows a set of classes drawn from Smalltalk, showing the
distribution of responsibilities among Model, View, and Controller classes. Notice
how all these classes work together such that no one class does too much or too
little.
Figure shows, these things can be modeled in the UML as types or enumerations,
which are rendered just like classes but are explicitly marked via stereotypes.
Things like integers (represented by the class Int) are modeled as types, and you
can explicitly indicate the range of values these things can take on by using a
Relationships
In the UML, the ways that things can connect to one another, either logically
or physically, are modeled as relationships.
Graphically, a relationship is rendered as a path, with different kinds of lines
used to distinguish the kinds of relationships
In object-oriented modeling, there are three kinds of relationships that are
most important:
Dependencies
Generalizations
Associations
Dependencies
Dependencies are using relationships. For example, pipes depend on the water
heater to heat the water they carry..
Generalizations
Generalizations connect generalized classes to more-specialized ones in what is
known as subclass/superclass or child/parent relationships.
For example, a bay window is a kind of window with large, fixed panes; a patio
window is a kind of window with panes that open side to side.
Fig: Relationships