Ooad Unit 2 r20 Ooad Unit 2 Material
Ooad Unit 2 r20 Ooad Unit 2 Material
UNIT-2
Introduction to UML: Importance of modeling, principles of modeling, object
oriented modeling, conceptual model of the UML, Architecture, Software
Development Life Cycle. Structural Modeling: Classes, Relationships, common
Mechanisms, and diagrams. Case Study: Control System: Traffic Management.
1.1.Introduction to UML:
UML is a standard language for specifying,
visualizing, constructing, and documenting the
artifacts of software systems.
UML was created by the Object Management
Group (OMG) and UML 1.0 specification draft
was proposed to the OMG in January 1997.
OMG is continuously making efforts to create a
truly industry standard.
UML stands for Unified Modelling Language.
UML is different from the other common programming languages such as
C++, Java, COBOL, etc.
UML is a pictorial language used to make software blueprints.
UML can be described as a general purpose visual modeling language to
visualize, specify, construct, and document software system.
Although UML is generally used to model software systems, it is not
limited within this boundary. It is also used to model non-software systems
as well. For example, the process flow in a manufacturing unit, etc.
The UML is process independent.
UML is not a programming language, it is rather a visual language.
UML diagrams are not only made for developers but also for business
users, common people, and anybody interested to understand the system.
🖝 It helps in designing and characterizing, especially those software systems
that incorporate the concept of Object orientation. It describes the working
of both the software and hardware systems.
🖝 The UML was developed in 1994-95 by Grady Booch, Ivar Jacobson, and
James Rumbaugh at the Rational Software. In 1997, it got adopted as a
standard by the Object Management Group (OMG).
The UML is a language for
Visualizing
Specifying
Constructing
Documenting
The artifacts of a software-intensive system.
1
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
1.3.principles of modelling:
UML is basically a modeling language; hence its principles will also be related to
modeling concepts. Here are few basic principal of UML.
First: "The choice of what models to create has a profound influence on how a
problem is attacked and how a solution is shaped"
In other words , choose your models well. The right models will brilliantly illuminate the
most wicked development problems. The wrong models will mislead you, causing you to
focus on irrelevant issues.
Second: " Every model may be expressed at different levels of precision ".
Best approach to a given problem results in a best model. If the problem is complex
mechanized level of approach & if the problem is simple decent approach is followed.
The model built should have strong resemblance with the system.
Fourth: " No single model is sufficient. Every nontrivial system is best approached
through a small set of nearly independent models."
• If you constructing a building, there is no single set of blueprints that reveal all its details.
At the very least, you will need floor plans, elevations , electical plans, heating plans, and
plumbing plans.
In this approach, the main building blocks of all software is the procedure or function .This
view leads developers to focus on issues of control and decomposition of larger
algorithms into smaller ones.
2.Object-Oriented perspective:
In this approach, the main building blocks of all software is the object or class. Simply
put, an object is a thing. A class is a description of a set of common objects. Every object has
identity, state and behavior.
For example, consider a simple a three-tier -architecture for a billing system, involving a user
interface ,middleware, and a data base. In the user interface, you will find concrete objects, such
as buttons, menus, and dialog boxes. In the database, you will find concrete objects ,such as
tables. In the middle layer ,you will find objects such as transitions and business rules.
4
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
These things are the basic object-oriented building blocks of the UML. You use
them to write well-formed models.
5
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
1. Structural Things
Structural things are the nouns of UML models. These are mostly static
parts of a model, representing elements that are either conceptual or physical.
Collectively, the structural things are called classifiers.
There are 7 kinds of Structural things:
1. Class
2. Interface
3. Collaboration
4. Use case
5. Active class
6. Component
7. Node
1.Class:-
• 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.
2.Interface:
• An interface is a collection of operations that
specify a service of a class or component. An
interface therefore describes the externally visible
behavior of that element.
• An interface might represent the complete behavior
of a class or component or only a part of that
behavior.
• Interface is represented by a circle as shown
in the following figure. It has a name which is generally written below the
circle.
3.Collaboration:
• A collaboration 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.
• Collaborations have structural, as well as
behavioral, dimensions. A given class or object
might participate in several collaborations.
• Graphically, a collaboration is rendered as
6
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
7.Node:
2. Behavioral Things
They are the verbs that encompass the dynamic parts of a model. It depicts
the behavior of a system.
There are two types of behavioral things
1. Interaction
2. State machine.
1.Interaction − Interaction is defined as a behavior that consists of a group of
7
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
2.State machine − State machine is useful when the state of an object in its life cycle is
important. It defines the sequence of states an object goes through in response to events.
Events are external factors responsible for state change.
Graphically, a state is rendered as a rounded rectangle, usually including its
name and its substates
8
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
0..1
Employer
3. Generalization :Third, a generalization is a specialization/generalization
relationship in which the specialized element (the child) builds on the specification of
the generalized element (the parent). The child shares the structure and the behavior of
the parent. Graphically, a generalization relationship is rendered as a solid line with a
hollow arrowhead pointing to the parent
Generalization
places: between interfaces and the classes or components that realize them,
and between use cases and the collaborations that realize them.
1.5.1.2 Diagrams in the UML:
2. Object diagram:
• 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.
3. Use case diagram:
• 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.
4. Sequence diagram:
• Both sequence diagrams and Collaboration diagrams are kinds of
interaction diagrams.
• An interaction diagram shows an interaction, consisting of a set of objects
or roles, including the messages that may be dispatched among them.
10
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
8.Component diagram:
• A component diagram is shows an encapsulated class and its interfaces,
ports, and internal structure consisting of nested components and
connectors.
• Component diagrams address the static design implementation view of a
system. They are important for building large systems from smaller parts.
9.Deployment diagram:
• 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.
A node typically hosts one or more artifacts.
11
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
2. Adornments
3. Common Divisions
4. Extensibility mechanisms
12
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
1. Specifications:-
The UML is more than just a graphical language. Rather, behind every part
of graphical notation there is a specification that provides a textual
statement of the syntax and semantics of that building block.
For example, behind a class icon is a specification that provides the full set
of attributes, operations and behaviors.
You use the UML’s graphical notation to visualize a system; you use the UML’s
specification to state the system details.
2. 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.
• For example, the notation for a class is intentionally designed to be easy to
draw, because classes are the most common element found in modeling
object-oriented systems.
• The class notation also exposes the most important aspects of a class,
namely its name, attributes, and operations.
13
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
4. 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.
The UML's extensibility mechanisms include:
Stereotypes
Tagged values
Constraints
1.Stereotypes: Extend the vocabulary of the UML by creating new model elements
derived from existing ones but that have specific properties suitable for your
domain/problem.
14
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
• The selection of the structural elements and their interfaces by which the
system is composed
• Their behavior, as specified in the collaborations among those elements
• The composition of these structural and behavioral elements into
progressively larger subsystems
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.
UML plays an important role in defining different perspectives of a
system. These perspectives are:
• Usecase View
15
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
• Design View
• Process View
• Implementation View
• Deployment View
The center is the Use Case view which connects all these four.
A Use case: represents the functionality of the system, it Specify the shape
of the system's architecture .So the other perspectives are connected with
use case.
Design of a system consists of classes, interfaces and collaboration. UML
provides class diagram, object diagram to support this.
• This view primarily supports the functional requirements of the
system, meaning the services that the system should provide to its
end users.
Implementation defines the components assembled together to make a
complete physical system. UML component diagram is used to support
implementation perspective
• This view primarily addresses the configuration management of the
system's releases
Process defines the flow of the system. So the same elements as used in
Design are also used to support this perspective.
• This view primarily addresses the performance, scalability, and
throughput of the system.
Deployment represents the physical nodes of the system that forms the
hardware. UML deployment diagram is used to support this perspective.
• This view primarily addresses the distribution, delivery, and
installation of the parts that make up the physical system.
16
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
• 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, testing, 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 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 four phases. A phase is the span of time between two
major milestones of the process.
• 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 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. Rarely does the software development process
end here, for even during this phase, the system is continuously improved, bugs
are eradicated and features that didn’t make an earlier release are added.
17
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Deployment diagrams
Component diagram
Class diagram is the most widely used structural diagram.
1. Classes:
Terms and Concepts:
A class is a description of a set of objects that share the same attributes,
operations, relationships, and semantics. Graphically, a class is rendered
18
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
as a rectangle.
Names
• Every class must have a name that distinguishes it from other classes.
• A name is a textual string. That name alone is known as a simple name; a
qualified name is the class name prefixed by the name of the package in
which that class lives. A class may be drawn showing only its name.
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 the thing you are modeling that is
shared by all objects of that class.
Operations
• An operation is the implementation of a service that can be requested
from any object of the class to affect behavior.
• an operation is an abstraction of something you can do to an object
that is shared by all objects of that class.
• A class may have any number of operations or no operations at all.
Name
Window
Origin
Attributes
Size
class
Open( )
Close( ) Operation
Move( )
Display( )
19
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Responsibilities
A responsibility is a contract or an obligation of a class. When you create a
class, you are making a statement that all objects of that class have the same
kind of state and the same kind of behavior.
2.Relationships
Terms and Concepts
• A relationship is a connection among things.
• In object-oriented modeling, the three most important relationships are
dependencies, generalizations, and associations.
• Graphically, a relationship is rendered as a path, with different
kinds of lines used to distinguish the kinds of relationships.
Dependencies:
A dependency is a relationship that states that one thing (for
example, class Window) uses the information and services of another
thing (for example, class Event), but not necessarily the reverse.
Graphically, a dependency is rendered as a dashed directed line,
directed to the thing being depended on.
Choose dependencies when you want to show one thing using another.
Generalizations:
20
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Associations:
• An association is a structural relationship that specifies that objects
of one thing are connected to objects of another.
• Given an association connecting two classes, you can relate objects
of one class to objects of the other class.
• An association that connects exactly two classes is called a
binary association..
• Beyond this basic form, there are four adornments that apply to associations.
Name:
An association can have a name, and you use that name to describe the nature
of the relationship. So that there is no ambiguity about its meaning, you can
give a direction to the name by providing a direction triangle that points in the
direction you intend to read the name.
Role:
• When a class participates in an
association, it has a specific role that
it plays in that relationship; a role is
just the face the class at the far end
of the association presents to the
class at the near end of the
association.
• You can explicitly name the role a
21
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Multiplicity:
• An association represents a structural relationship among objects.
• In many modeling situations, it's important for you to state how
many objects may be connected across an instance of an
association.
• This "how many" is called the multiplicity of an association's role.
• It represents a range of integers specifying the possible size of
the set of related objects.
The number of objects must be in the given range. You can show a
multiplicity of exactly one (1), zero or one (0..1), many (0..*), or one or more
(1..*). You can give an integer range (such as 2..5). You can even state an
exact number (for example, 3, which is equivalent to 3..3).
Aggregation:
Composition:-
22
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
3. Common Mechanisms:
Terms and Concepts:
A note is a graphical symbol for rendering constraints or comments
attached to an element or a collection of elements. Graphically, a note
is rendered as a rectangle with a dog-eared corner, together with a
textual or graphical comment.
23
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
24
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Other Adornments:
Adornments are textual or graphical items that are added to an element's
basic notation and are used to visualize details from the element's
specification
4.Diagrams:
You'll often use five additional diagrams to view the dynamic parts of a
system:
1. Use case diagram
2. Sequence diagram
3. Collaboration diagram
4. State diagram
5. Activity diagram
Structural Diagrams:
• The UML's structural diagrams exist to visualize, specify, construct,
and document the static aspects of a system.
• The UML's structural diagrams are roughly organized around the
major groups of things you'll find when modeling a system.
EXAMPLE
CLASS DIAGRAM:
29
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
30
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Primary scenario:
• A. The Train Traffic Management System (TTMS) presents the dispatcher with
a list of options.
• B. The dispatcher chooses to develop a new train plan.
• C. The TTMS presents the template for a train plan to the dispatcher.
• D. The dispatcher completes the train plan template, providing information
about locomotive ID(s), train engineer(s), and waypoints with times.
• E. The dispatcher submits the completed train plan to the TTMS.
• F. The TTMS assigns a unique ID to the train plan and stores it. The
• TTMS makes the train plan accessible for inquiry and modification.
31
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
32
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
• Primary scenario:
• A. The Train Traffic Management System (TTMS) presents the train engineer
with a list of options.
• B. The train engineer chooses to monitor the onboard train systems.
• C. The TTMS presents the train engineer with the overview status information
for the train systems.
• D. The train engineer reviews the overview system status information.
• E. This use case ends.
• Alternate scenarios:
• Condition triggering an alternate scenario:
• Condition 1: Request detailed monitoring of a system.
• E1. The train engineer chooses to perform detailed monitoring of a system that
has a yellow condition.
• E2. The TTMS presents the train engineer with the detailed system status
information for the selected system.
• E3. The train engineer reviews the detailed system status information. E4. The
primary scenario is resumed at step B..
• Extension point—Potential Failure:
• Condition 2: Request a failure prediction analysis for a system.
• E3-1. The train engineer requests a failure prediction analysis for a system.
• E3-2. The TTMS performs a failure prediction analysis for the selected system.
• E3-3. The TTMS presents the train engineer with the failure prediction analysis
for the system.
• E3-4. The train engineer reviews the failure prediction analysis.
• E3-5. The train engineer requests that the TTMS alert the maintainer of the
system that might fail.
• E3-6. The TTMS alerts the maintainer of that system.
• E3-7. The maintainer requests the failure prediction analysis for review.
• E3-8. The TTMS presents the maintainer with the failure prediction analysis.
E3-9. The maintainer reviews the analysis and determines that the yellow
condition is not severe enough to warrant immediate action.
• E3-10. The maintainer requests that the TTMS inform the train engineer of this
determination.
• E3-11. The TTMS provides the train engineer with the determination of the
maintainer.
• E3-12. The train engineer chooses to perform detailed monitoring of the
selected system.
• E3-13. The alternate scenario is resumed at step E3.
2.ELOBRATION:
• To developing the overall architecture framework for the Train Traffic
Management System.
• begin by analyzing the required system functionality that leads us into the
definition of the TTMS architecture.
33
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
34
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
35
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
2. Interaction Overview Diagram Another way to depict the Monitor Train Systems use
case—with its primary and alternate scenarios—is by using an interaction overview
diagram, as shown in Figure 9–4
3. True to its name, this diagram shows a higher-level overview of the complete Monitor
Train Systems use case functionality.
4. This interaction overview diagram shows a flow among interaction occurrences, indicated
by the three frames annotated with ref in their upper-left corners.
5. In place of the reference to interaction diagrams, we could show the actual interactions to
provide the details for each of the scenarios: Perform Overview System Status
Monitoring, Perform Detailed System Status Monitoring, and Perform Failure
Prediction Analysis.
36
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
•
4.From Systems Engineering to Hardware and Software Engineering
37
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
4.Post Transition
1. Message Passing
The class diagram in Figure 9–8 captures our design decisions regarding some of the most
important messages in the Train Traffic Management System.
Note that all messages are ultimately instances of a generalized abstract class named Message,
which encompasses the behavior common to all messages.
Three lower-level classes represent the major categories of messages, namely, Train
Status Message, Train Plan Message, and Way side Device Message.
Each of these classes is further specialized. Indeed, final design might include dozens of such
specialized classes, at which time the existence of these intermediate classes becomes even
more important; without them, we would end up with many unrelated—and therefore difficult
to maintain—components representing each distinct specialized class.
Once satisfied with this class structure, begin to design the message-passing mechanism
itself. Here we have two competing goals for the mechanism:
It must provide for the reliable delivery of messages and yet do so at a high enough level of
abstraction so that clients need not worry about how message delivery takes place.
Figure 9–9 provides a scenario that captures our design of the message-passing mechanism. As
this diagram indicates, to send a message, a client first creates a new message m and then
broadcasts it to its node’s message manager, whose responsibility is to queue the message for
eventual transmission.
39
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Notice that our design uses four objects that are active (have their own thread of control), as
indicated by the extra vertical lines within the object notation: Client, message Mgr : Queue,
message Mgr' :Queue, and Receiver.
Notice also that the message manager receives the message to be broadcast as a parameter and
then uses the services of a Transporter object to reduce the message to its canonical form and
broadcast it across the network
40
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
As the diagram in Figure 9–10 indicates, the Train Plan class has a Unique Id, whose purpose
is to provide a number for uniquely identifying each Train Plan instance. Because of the
complexity of the information here, classes in this diagram that might otherwise be
considered an attribute of a class are really stand-alone classes. For example, the
UniqueID class is not merely an identification number; it contains various attributes and
operations necessary to meet stringent national and international regulations. Another
example is that crews have restrictions placed on their work—they may work only at
certain locations or must adhere to speed restrictions in certain locations at particular times.
shown in Figure 9–11. The primary version of each train plan resides in a centralized
database at a dispatch center, with zero or more mirror-image copies scattered about the
network. Whenever some client requests a copy of a particular train plan (via the
operation get(), invoked with a value of Unique Id as an argument), the primary version
is cloned and delivered to the client as a parameter, and the network location of the copy is
recorded in the database
41
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
3.Displaying Information
Figure 9–12 illustrates this design, showing that the implementation of all
displayable objects shares common class utilities.
These utilities in turn build on lower-level Windows interfaces, which are hidden from all of the
higher-level classes. Pragmatically, interfaces such as the Windows API cannot easily be
expressed in a single class.
Therefore, diagram is a bit of a simplification: It is more likely that our implementation will
require a set of peer class utilities for the Windows API as well as for the train display
utilities.
The principal advantage of this approach is that it limits the impact of any lower level changes
resulting from hardware/software trade-offs.
For example, if we find that we need to replace our display hardware with more or less powerful
devices, we need only reimplement the routines in the Train Display Utility class.
Without this collection of routines, low-level changes would require us to modify the
implementation of every displayable object.
42
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
43
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
The software design for very large systems must often commence before the target
hardware is completed. Software design frequently takes far longer than hardware design,
and in any case, trade-offs must be made against each along the way.
This implies that hardware dependencies in the software must be isolated to the greatest
extent possible, so that software design can proceed in the absence of a stable target
environment.
The component diagram shown in Figure 9–13 represents our design decisions regarding the
top-level system architecture of the Train Traffic Management System.
layered architecture that encompasses the functions of the four subproblems we identified
earlier, namely, networking, database, the human/ machine interface, and real-time device
control.
7.Subsystem Specification
• focus on the outside view of any of these subsystems, find that it has all the characteristics of
an object. It has a unique, albeit static, identity; it embodies a significant amount of state; and
it exhibits very complex behavior. Subsystems serve as the repositories of other subsystems
and eventually classes; thus, they are best characterized by the resources they export through
their provided interfaces, such as the Network Services provided by the Network Facilities
subsystem shown in Figure 9–13.
• The component diagram in Figure 9–13 is merely a starting point for the specification of
the TTMS subsystem architecture. These top-level subsystems must be further decomposed
through multiple architectural levels of nested subsystems. Looking at the Network
Facilities subsystem, decompose it into two other subsystems, a private Radio
44
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Communication subsystem and a public Messages subsystem. The private subsystem hides
the details of software control of the physical radio devices.
The subsystem named Databases builds on the resources of the subsystem Network
Facilities and implements the train plan mechanism we created earlier.
name these nested subsystems Train Plan Database and Track Database, respectively.
We also expect to have one private subsystem, Database Manager, whose purpose is to
provide all the services common to the two domain-specific databases.
In the Devices subsystem, we choose to group the software related to all wayside devices
into one subsystem and the software associated with all onboard locomotive actuators and
sensors into another. These two subsystems are available to clients of the Devices
subsystem, and both are built on the resources of the Train Plan Database and Messages
subsystems.
Finally, choose to decompose the top level User Applications subsystem into several
smaller ones, including the subsystems Engineer Applications and Dispatcher
Applications, to reflect the different roles of the two main users of the Train Traffic
Management System.
The subsystem Engineer Applications includes resources that provide all the train-
engineer/machine interaction specified in the requirements, including the functionality of
the locomotive analysis and reporting system and the energy management system.
Include the subsystem Dispatcher Applications to encompass the software that provides
the functionality of all dispatcher/machine interactions.
Both Engineer Applications and Dispatcher Applications share common private resources,
as provided from the subsystem Displays.
For example, consider the subsystem Train Plan Database. It builds on three other
subsystems (Messages, Train Database, and Track Database) and has several important
clients, namely, the four subsystems, Wayside Devices, Locomotive Devices, Engineer
Applications, and Dispatcher Applications. The Train Plan Database embodies a relatively
straightforward state, specifically, the state of all train plan.
4. POST TRANSITION
For the Train Traffic Management System, we can envision a significant addition to our
requirements, namely, payroll processing. Specifically, suppose that our analysis shows
that train company payroll is currently being supported by a piece of hardware that is no
longer being manufactured and that we are at great risk of losing our payroll processing
capability because a single serious hardware failure would put our accounting system out
of action forever.
Our solution would be to add a new subsystem between the subsystems Train Plan
Database and Dispatcher Applications because the knowledge base embodied by this
expert system parallels the contents of the Train Plan Database; furthermore, the
subsystem Dispatcher Applications is the sole client of this expert system. We would need
to invent some new mechanisms to establish the manner in which advice is presented to
the ultimate user. For example, we might use a blackboard architecture.
45
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
UNIT III: Class & Object Diagrams: Terms, concepts, modeling techniques for Class
& Object Diagrams.
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.
1. Modeling Nonsoftware Things
47
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
As 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 we can explicitly
indicate the range of values these things can take on by using a constraint. Similarly,
enumeration types, such as Boolean and Status, can be modeled as enumerations, with
their individual values provided as attributes.
48
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
For example, Figure shows a set of objects drawn from the implementation of an
autonomous robot. This figure focuses on some of the objects involved in the
mechanism used by the robot to calculate a model of the world in which it moves. There
are many more objects involved in a running system, but this diagram focuses on only
those abstractions that are directly involved in creating this world view.
As this figure indicates, one object represents the robot itself (r, an instance of Robot),
and r is currently in the state marked moving. This object has a link to w, an instance of
World, which represents an abstraction of the robot's world model. This object has a
link to a multi object that consists of instances of Element, which represent entities that
the robot has identified but not yet assigned in its world view. These elements are
marked as part of the robot's global state.
At this moment in time, w is linked to two instances of Area. One of them (a2) is shown
with its own links to three Wall and one Door object. Each of these walls is marked
with its current width, and each is shown linked to its neighboring walls. As this object
diagram suggests, the robot has recognized this enclosed area, which has walls on three
sides and a door on the fourth.
49
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
Reverse engineering (the creation of a model from code) an object diagram is a very
different thing. In fact, while you are debugging your system, this is something that you
or your tools will do all the time. For example, if you are chasing down a dangling link,
you'll want to literally or mentally draw an object diagram of the affected objects to see
where, at a given moment in time, an object's state or its relationship to other objects is
broken.
To reverse engineer an object diagram,
• Chose the target you want to reverse engineer. Typically, you'll set your
context inside an operation or relative to an instance of one particular class.
• Using a tool or simply walking through a scenario, stop execution at a certain
moment in time.
• Identify the set of interesting objects that collaborate in that context and
render them in an object diagram.
• As necessary to understand their semantics, expose these object's states.
• As necessary to understand their semantics, identify the links that exist
among these objects.
If your diagram ends up overly complicated, prune it by eliminating objects that are not
germane to the questions about the scenario you need answered. If your diagram is too
simplistic, expand the neighbors of certain interesting objects and expose each object's state
more deeply.
• Object Diagram
50
Downloaded by Ganesh Pavan Kumar Battula ([email protected])
lOMoARcPSD|41687779
51
Downloaded by Ganesh Pavan Kumar Battula ([email protected])