MODULE 5
MODULE 5
UNIT-V
Components
• You use components to model the physical things that may reside on a node, such as
executables, libraries, tables, files, and documents.
• In the UML, all these physical things are modeled as components. A component is a
physical thing that conforms to and realizes a set of interfaces
• This canonical notation permits you to visualize a component apart from any
operating system or programming language.
• Using stereotypes, one of the UML's extensibility mechanisms, you can tailor this
notation to represent specific kinds of components.
Fig: Components
Names
• Every component must have a name that distinguishes it from other components.
• A component is typically drawn showing only its name, as in below figure. Just as
with classes, you may draw components adorned with tagged values or with
additional compartments to expose their details, as you see in the figure.
Similarities
• Components are like classes
• Both have names
• Both may realize a set of interfaces
• Both may participate in dependency, generalization, and association relationships
• Both may be nested
• Both may have instances
• Both may be participants in interactions.
As below figure shows, the relationship between a component and the classes it
implements can be shown explicitly by using a dependency relationship. Most of the
time, you'll never need to visualize these relationships graphically. Rather, you will keep
them as a part of the component's specification.
Fig: Components and Classes
• All the most common component-based operating system facilities (such as COM+,
CORBA, and Enterprise Java Beans) use interfaces as the glue that binds components
together.
• You then provide components that realize the interfaces, along with other
components that access the services through their interfaces.
• This mechanism permits you to deploy a system whose services are somewhat
location-independent and, as discussed in the next section, replaceable.
• As below figure indicates, you can show the relationship between a component and
its interfaces in one of two ways.
• The first (and most common) style renders the interface in its elided, iconic form.
The component that realizes the interface is connected to the interface using an elided
realization relationship.
• The second style renders the interface in its expanded form, perhaps revealing its
operations.
• The component that realizes the interface is connected to the interface using a full
realization relationship. In both cases, the component that accesses the services of the
other component through the interface is connected to the interface using a
dependency relationship.
• A component may conform to many import interfaces. Also, a component may both
import and export interfaces.
• The fact that this interface lies between the two components breaks the direct
dependency between the components.
• A component that uses a given interface will function properly no matter what
component realizes that interface. Of course, a component can be used in a context if
and only if all its import interfaces are provided by the export interfaces of other
components.
Kinds of Components
Three kinds of components may be distinguished.
Organizing Components
• You can organize components by grouping them in packages in the same manner
in which you organize classes.
• You can also organize components by specifying dependency, generalization,
association (including aggregation), and realization relationships among them.
Standard Elements
• Identify the partitioning of your physical system. Consider the impact of technical,
configuration management, and reuse issues.
• Model any executables and libraries as components, using the appropriate standard
elements. If your implementation introduces new kinds of components, introduce a
new appropriate stereotype.
• If it's important for you to manage the seams in your system, model the significant
interfaces that some components use and others realize.
• Identify the ancillary components that are part of the physical implementation of your
system.
• For example, below figure builds on the previous figure and shows the tables, files,
and documents that are part of the deployed system surrounding the executable
animator.exe. This figure includes one document (animator.hlp), one simple file
(animator.ini), and one database table (shapes.tbl), all of which use the UML's
standard elements for documents, files, and tables, respectively.
Fig: Modeling Tables, Files, and Documents
Modeling an API
To model an API
• Identify the programmatic seams in your system and model each seam as an
interface, collecting the attributes and operations that form this edge.
• Expose only those properties of the interface that are important to visualize in the
given context; otherwise, hide these properties, keeping them in the interface's
specification for reference, as necessary.
• Model the realization of each API only insofar as it is important to show the
configuration of a specific implementation.
• Figure exposes the APIs of the executable in the previous two figures. You'll see four
interfaces that form the API of the executable: IApplication, IModels, IRendering,
and IScripts.
• Depending on the constraints imposed by your development tools, model the files
used to store the details of all your logical elements, along with their compilation
dependencies.
• If it's important for you to bolt these models to your configuration management and
version control tools, you'll want to include tagged values, such as version, author,
and check in/check out information, for each file that's under configuration
management.
• As far as possible, let your development tools manage the relationships among these
files, and use the UML only to visualize and document these relationships.
• For example, below figure shows some source code files that are used to build the
library render.dll from the previous examples. This figure includes four header files
(render.h, rengine.h, poly.h, and colortab.h) that represent the source code for the
specification of certain classes. There is also one implementation file (render.cpp)
that represents the implementation of one of these headers.
Deployment
• 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.
• You use nodes to model the topology of the hardware on which your system
executes.
• This canonical notation permits you to visualize a node apart from any specific
hardware. Using stereotypes one of the UML's extensibility mechanisms.
• You can (and often will) tailor this notation to represent specific kinds of processors
and devices.
Figure: Nodes
Names
• Every node must have a name that distinguishes it from other nodes.
• A path name is the node name prefixed by the name of the package in which that
node lives.
• A node is typically drawn showing only its name, as in below figure. Just as with
classes, you may draw nodes adorned with tagged values or with additional
compartments to expose their details.
Similarities
• In many ways, nodes are a lot like components:
• Both have names;
• Both may participate in dependency, generalization, and association relationships
• Both may be nested;
• Both may have instances;
• Both may be participants in interactions.
• Components are things that participate in the execution of a system; nodes are
things that execute components.
• Components represent the physical packaging of otherwise logical elements;
Codes represent the physical deployment of components.
• This first difference is the most important. Simply put, nodes execute
components; components are things that are executed by nodes.
• As below figure shows, the relationship between a node and the components it
deploys can be shown explicitly by using a dependency relationship. Most of the
time, you won't need to visualize these relationships graphically but will keep
them as a part of the node's specification.
Organizing Nodes
• You can organize nodes by grouping them in packages in the same manner in which
you can organize classes and components.
• You can also organize nodes by specifying dependency, generalization, and
association (including aggregation) relationships among them.
Connections
• The most common kind of relationship you'll use among nodes is an association.
• In this context, an association represents a physical connection among nodes, such as
an Ethernet connection, a serial line, or a shared bus,
• As below figure shows. You can even use associations to model indirect connections,
such as a satellite link between distant processors.
Fig: Connections
• Because nodes are class-like, you have the full power of associations at your
disposal.
• This means that you can include roles, multiplicity, and constraints.
• As in the previous figure, you should stereotype these associations if you want to
model new kinds of connections for example, to distinguish between a 10-T Ethernet
connection and an RS-232 serial connection.
• Consider duplicate locations for components. It's not uncommon for the same kind of
component (such as specific executables and libraries) to reside on multiple nodes
simultaneously.
• Below figure takes the earlier diagrams and specifies the executable components that
reside on each node. This diagram is a bit different from the previous ones in that it is
an object diagram, visualizing specific instances of each node. In this case, the RAID
farm and kiosk instances are both anonymous and the other two instances are named
(c for the console and s for the server). Each processor in this figure is rendered with
an additional compartment showing the component it deploys. The server object is
also rendered with its attributes (processorSpeed and memory) and their values
visible.
Component Diagrams
• Component diagrams are one of the two kinds of diagrams found in modeling the
physical aspects of object-oriented systems.
• You use component diagrams to model the static implementation view of a system.
• This involves modeling the physical things that reside on a node, such as executables,
libraries, tables, files, and documents.
• Component diagrams are not only important for visualizing, specifying, and
documenting component-based systems, but also for constructing executable systems
through forward and reverse engineering.
• With the UML, you use component diagrams to visualize the static aspect of these
physical components and their relationships and to specify their details for
construction, as shown in figure
Common Properties
• A component diagram is just a special kind of diagram and shares the same common
properties as do all other diagrams a name and graphical contents that are a
projection into a model. What distinguishes a component diagram from all other
kinds of diagrams is its particular content.
Contents
Common Uses
• You use component diagrams to model the static implementation view of a system.
• This view primarily supports the configuration management of a system's parts, made
up of components that can be assembled in various ways to produce a running
system.
• When you model the static implementation view of a system, you'll typically use
component diagrams in one of four ways.
• Either by forward or reverse engineering, identify the set of source code files of
interest and model them as components stereotyped as files.
• For larger systems, use packages to show groups of source code files.
• Consider exposing a tagged value indicating such information as the version number
of the source code file, its author, and the date it was last changed. Use tools to
manage the value of this tag.
• Model the compilation dependencies among these files using dependencies. Again,
use tools to help generate and manage these dependencies.
• For example, below figure shows five source code files. signal.h is a header file.
Three of its versions are shown, tracing from new versions back to their older
ancestors. Each variant of this source code file is rendered with a tagged value
exposing its version number.
• Identify the set of components you'd like to model. Typically, this will involve some
or all the components that live on one node, or the distribution of these sets of
components across all the nodes in the system.
• Consider the stereotype of each component in this set. For most systems, you'll find a
small number of different kinds of components (such as executables, libraries, tables,
files, and documents). You can use the UML's extensibility mechanisms to provide
visual cues for these stereotypes.
• For each component in this set, consider its relationship to its neighbors. Most often,
this will involve interfaces that are exported (realized) by certain components and
then imported (used) by others. If you want to expose the seams in your system,
model these interfaces explicitly. If you want your model at a higher level of
abstraction, elide these relationships by showing only dependencies among the
components.
• For example, below figure models part of the executable release for an autonomous
robot. This figure focuses on the deployment components associated with the robot's
driving and calculation functions. You'll find one component (driver.dll) that exports
an interface (IDrive) that is, in turn, imported by another component (path.dll).
driver.dll exports one other interface (ISelfTest) that is probably used by other
components in the system, although they are not shown here. There's one other
component shown in this diagram (collision.dll), and it, too, exports a set of
interfaces, although these details are elided: path.dll is shown with a dependency
directly to collision.dll.
• Identify the classes in your model that represent your logical database schema.
• Select a strategy for mapping these classes to tables. You will also want to consider
the physical distribution of your databases. Your mapping strategy will be affected
by the location in which you want your data to live on your deployed system.
• Where possible, use tools to help you transform your logical design into a physical
design.
• Below figure shows a set of database tables drawn from an information system for a
school. You will find one database (school.db, rendered as a component stereotyped
as database) that's composed of five tables: student, class, instructor, department, and
course (rendered as a component stereotyped as table, one of the UML's standard
elements). In the corresponding logical database schema, there was no inheritance, so
mapping to this physical database design is straightforward.
Fig: Modeling a Physical Database
• Consider the physical distribution of the components that may migrate from node to
node.
• You can specify the location of a component instance by marking it with a location
tagged value, which you can then render in a component diagram (although,
technically speaking, a diagram that contains only instances is an object diagram).
• If you want to model the actions that cause a component to migrate, create a
corresponding interaction diagram that contains component instances.
• You can illustrate a change of location by drawing the same instance more than once,
but with different values for its location tagged value.
• For example, below figure models the replication of the database from the previous
figure. We show two instances of the component school.db. Both instances are
anonymous, and both have a different value for their location tagged value. There's
also a note, which explicitly specifies which instance replicates the other.
• For each component, identify the classes or collaborations that the component
implements.
• Choose the target for each component. Your choice is basically between source code
(a form that can be manipulated by development tools) or a binary library or
executable (a form that can be dropped into a running system).
Reverse engineering (the creation of a model from code) a component diagram is not a
perfect process because there is always a loss of information.
• Choose the target you want to reverse engineer. Source code can be reverse
engineered to components and then classes. Binary libraries can be reverse
engineered to uncover their interfaces. Executables can be reverse engineered the
least.
• Using a tool, point to the code you'd like to reverse engineer. Use your tool to
generate a new model or to modify an existing one that was previously forward
engineered.
• Using your tool, create a component diagram by querying the model. For example,
you might start with one or more components, then expand the diagram by following
relationships or neighboring components. Expose or hide the details of the contents
of this component diagram as necessary to communicate your intent.
• For example, below figure provides a component diagram that represents the reverse
engineering of the ActiveX component vbrun.dll. As the figure shows, the
component realizes 11 interfaces. Given this diagram, you can begin to understand
the semantics of the component by next exploring the details of its interfaces.
• Deployment diagrams are one of the two kinds of diagrams used in modeling the
physical aspects of an object-oriented system.
• A deployment diagram shows the configuration of run time processing nodes and the
components that live on them.
• You use deployment diagrams to model the static deployment view of a system.
• For the most part, this involves modeling the topology of the hardware on which your
system executes.
• Deployment diagrams are essentially class diagrams that focus on a system's nodes.
• Deployment diagrams are not only important for visualizing, specifying, and
documenting embedded, client/server, and distributed systems, but also for managing
executable systems through forward and reverse engineering.
• With the UML, you use deployment diagrams to visualize the static aspect of these
physical nodes and their relationships and to specify their details for construction, as
in below figure.
A deployment diagram is just a special kind of diagram and shares the same common
properties as all other diagrams a name and graphical contents that are a projection into a
model. What distinguishes a deployment diagram from all other kinds of diagrams is its
particular content.
Contents
• Nodes
• Dependency and association relationships
• Like all other diagrams, deployment diagrams may contain notes and
constraints.
• Deployment diagrams may also contain components, each of which must
live on some node.
• Deployment diagrams may also contain packages or subsystems,
Common Uses
When you model the static deployment view of a system, you'll typically use deployment
diagrams in one of three ways.
• Identify the devices and nodes that are unique to your system.
• Provide visual cues, especially for unusual devices, by using the UML's extensibility
mechanisms to define system-specific stereotypes with appropriate icons. At the very
least, you'll want to distinguish processors (which contain software components) and
devices (which, at that level of abstraction, don't directly contain software).
• Model the relationships among these processors and devices in a deployment
diagram. Similarly, specify the relationship between the components in your system's
implementation view and the nodes in your system's deployment view.
• As necessary, expand on any intelligent devices by modeling their structure with a
more detailed deployment diagram.
• For example, below figure shows the hardware for a simple autonomous robot. You'll
find one node (Pentium motherboard) stereotyped as a processor.
• Identify the nodes that represent your system's client and server processors.
• Highlight those devices that are germane to the behavior of your system. For
example, you'll want to model special devices, such as credit card readers, badge
readers, and display devices other than monitors, because their placement in the
system's hardware topology are likely to be architecturally significant.
• Provide visual cues for these processors and devices via stereotyping.
• Model the topology of these nodes in a deployment diagram. Similarly, specify the
relationship between the components in your system's implementation view and the
nodes in your system's deployment view.
• For example, below figure shows the topology of a human resources system, which
follows a classical client/server architecture. This figure illustrates the client/server
split explicitly by using the packages named client and server. The client package
contains two nodes (console and kiosk), both of which are stereotyped and are
visually distinguishable. The server package contains two kinds of nodes (caching
server and server), and both of these have been adorned with some of the components
that reside on each. Note also that caching server and server are marked with explicit
multiplicities, specifying how many instances of each are expected in a particular
deployed configuration. For example, this diagram indicates that there may be two or
more caching servers in any deployed instance of the system.
• Identify the system's devices and processors as for simpler client/server systems.
• If you need to reason about the performance of the system's network or the impact of
changes to the network, be sure to model these communication devices to the level of
detail sufficient to make these assessments.
• Pay close attention to logical groupings of nodes, which you can specify by using
packages.
• Model these devices and processors using deployment diagrams. Where possible, use
tools that discover the topology of your system by walking your system's network.
• If you need to focus on the dynamics of your system, introduce use case diagrams to
specify the kinds of behavior you are interested in, and expand on these use cases
with interaction diagrams.
• Below figure shows the topology of a fully distributed system. This particular
deployment diagram is also an object diagram, for it contains only instances. You can
see three consoles (anonymous instances of the stereotyped node console), which are
linked to the Internet (clearly a singleton node). In turn, there are three instances of
regional servers, which serve as front ends of country servers, only one of which is
shown. As the note indicates, country servers are connected to one another, but their
relationships are not shown in this diagram.
• There's only a modest amount of forward engineering (the creation of code from
models) that you can do with deployment diagrams.
• For example, after specifying the physical distribution of components across the
nodes in a deployment diagram, it is possible to use tools that then push these
components out to the real world. For system administrators, using the UML in this
way helps you visualize what can be a very complicated task.
Reverse engineering (the creation of models from code) from the real world back to
deployment diagrams is of tremendous value, especially for fully distributed systems that
are under constant change.
• You'll want to supply a set of stereotyped nodes that speak the language of your
system's network administrators, in order to tailor the UML to their domain. The
advantage of using the UML is that it offers a standard language that addresses
not only their needs, but the needs of your project's software developers, as well.
• Choose the target that you want to reverse engineer. In some cases, you'll want to
sweep across your entire network; in others, you can limit your search.
• Choose also the fidelity of your reverse engineering. In some cases, it's sufficient to
reverse engineer just to the level of all the system's processors; in others, you'll want
to reverse engineer the system's networking peripherals, as well.
• Use a tool that walks across your system, discovering its hardware topology. Record
that topology in a deployment model.
• Along the way, you can use similar tools to discover the components that live on
each node, which you can also record in a deployment model. You'll want to use an
intelligent search, for even a basic personal computer can contain gigabytes of
components, many of which may not be relevant to your system.
• Using your modeling tools, create a deployment diagram by querying the model.
• For example, you might start with visualizing the basic client/server topology, then
expand on the diagram by populating certain nodes with components of interest that
live on them. Expose or hide the details of the contents of this deployment diagram as
necessary to communicate your intent.
UNIT - VI
Case Study: The Unified Library application, ATM application.
UNIT - VI
Introduction
Unified Library Application System emphasizes on the online reservation,
issue and return of books. This system globalizes the present library system. Using this
application the member can reserve any book from anywhere in the world. Still in
nascent stages, this application soon revolutionizes present library system.
Textual Analysis
(a) Actors
i. Librarian
ii. Borrower
iii. Catalog
iv. Master Librarian
(b) Verbs
i. Borrower:
1. Logs into the system
2. Browses/searches for books or magazines
3. Makes/removes reservation
4. Views results and reports from the unified library application system
ii. Librarian:
1. Manages and validates members
2. View reports from the system
3. Issues books
4. Calculates dues
5. Takes books
6. Places orders to the master librarian
7. Maintains list of books and magazine
iii. Master Librarian
1. Maintains other librarians
USECASE DIAGRAM:
Use case diagram is created to visualize the interaction of our system with the
outside world. The components of use case diagram are:
Use Case: Scenarios of the system
Actor: Someone or something who is interacting with the system
Relationship: Semantic link between use case and actor.
SEQUENCE DIAGRAM:
Sequence diagram shows the step to step what mush happen to accomplish a
piece of functionality provided by the system. The components are:
a) Actor
b) Object
c) Messages
d) Lifeline
e) Focus of Control
COLLABORATION DIAGRAM:
Collaboration diagram displays object interactions organized around objects and their
links to one another. The components are:
a) Actor
b) Object
c) Link
CLASS DIAGRAM:
Class diagram shows structure of the software system. The class diagram shows a
set of classes, interfaces and their relationships. The components are:
a) Class
b) Relationship:
The forms of relationship are:
1. Association
2. Aggregation
3. Generalization
4. Composition
5. Dependency
STATE CHART DIAGRAM:
State chart diagram show a life cycle of a single class. The state is a condition
where the object may be in. The components are:
a) Start state
b) End state
c) State
d) Transition
Member: Librarian:
Library Administrator:
ATM application
Introduction:
ATM system needs enhancement to record card information electronically is
automatically displays the details in the card. The ATM will communicate with the bank
computer over an appropriate communication link. The ATM will serve one customer at
a time. A customer will be required to insert an ATM card and enter a PIN number both
of which will be sent to bank for valuation as a part of each transaction. The customer
will then be able to perform one or more transactions. The card will be retained in the
machine until the customer indicates that he/she desires no further transactions, at which
point it will be returned.
Objective:
The main objective of the ATM system is to facilitate the user with easy
transaction of money at a faster rate. The ATM application will run automatically and
there will be no need of any manual interventions. Some built in functions are provided
which performs the depository with-drawl functions.
Scope:
The scope of the project of the ATM system is to understand the working of the
system and also to provide more security to the user as it facilitates with easy transaction.
Problem Statement :
The operations on the function of the ATM are as follows:
1. The card has to be inserted in the place of the provided.
2. As the system accepts the card it displays the name and other details of the user.
3. It asks for the password, which is exclusively assigned for the particular card.
4. If the code is correct then the system gets activated with details.
+sselecting cash
+mode of payment
+Enter Amount
ATM Database
user
Withdraw sequence diagram :-
5: selecting cash( )
sequence
diagram
6: selecting cheque( )
sequence
diagram
5: selecting cash
6: selecting cheque
ATM
user
2: updating database
ATM database
logged on
invalid login
relogin transition
withdrawl
logout updation
transaction completed
stop
Component Diagram: -
Login local
Controller bank
Login user
account
info and
Perform Transaction
Transaction Manager
Deployment Diagram:-
Activity diagram:-