Unit 1
Unit 1
Unit 1
UNIT-I
[Introduction to UML]
G.Vijay kumar
Page 1
What is UML?
The Unified Modeling Language (UML) is a graphical language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system. The UML gives us 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. The UML is applicable to anyone involved in the production, deployment, and maintenance of software.
level design.
OMT-2 was most useful for analysis and data-intensive information systems.
The behavioral component of many object-oriented methods, including the Booch (OOSE) method and OMT, was the language of statecharts. In mid 1990s, Grady Booch (Rational Software Corporation), Ivar Jacobson (Objectory), and James Rumbaugh (General Electric) began to adopt ideas from each other's methods, which collectively were becoming recognized as the leading object-oriented methods worldwide.
The UML effort started officially in October 1994, when Rumbaugh joined Booch at Rational for the
G.Vijay kumar Page 2
unification of the Booch (OOSE) and OMT methods. The version 0.8 draft of the Unified Method (as it was then called) was released in October 1995. In june 1996 UML version 0.9 documents was released when Jacobson joined Rational and the scope of the UML project was expanded to incorporate OOSE. UML 1.0 was released with the collaboration of Digital Equipment Corporation, Hewlett-Packard, I-Logix, Intellicorp, IBM, ICON Computing, MCI System house, Microsoft, Oracle, Rational, Texas Instruments, and Unisys. UML 1.0, a modeling language that was well-defined, expressive, powerful, and applicable to a wide spectrum of problem domains. In January 1997 UML 1.0 was offered for standardization to the Object Management Group (OMG), in response to their request for proposal for a standard modeling language
Versions of UML
UML 0.8 in 1995 UML 0.9 in 1996 UML 1.0 in 1996 UML 1.1 in 1997 UML 1.2 in 1999 UML 1.3 in 2000 UML 1.4 in 2001 UML 1.5 in 2003 UML 2.0 in 2005 UML 2.1.1 in 2007 UML 2.1.2 in 2007
In other words the model provides the blueprint of the system. A good model includes those elements that have broad effect and omits(removes) those minor elements that are not relevant to the given level of abstraction. A successful software organization is one that consistently deploys quality software that meets the needs of its users. An organization that can develop such software in a timely and predictable fashion, with an efficient and effective use of resources, both human and material, is one that has a sustainable business. The primary product of a development team is not beautiful documents, world-class meetings, great A good software is the one that satisfies the evolving needs of its users and the business. Everything Unfortunately, many software organizations confuse "secondary" with "irrelevant." To deploy software that satisfies its intended purpose, we have to meet and engage users in a To develop software rapidly, efficiently, and effectively, with a minimum of software scrap and 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 We build models to manage risk.
else is secondary.
disciplined fashion, to expose the real requirements of our system. rework, we have to have the right people, the right tools, and the right focus.
If we want to build a dog house, we can pretty much start with a pile of lumber, some nails, and a few In a few hours, with little prior planning, well complete a dog house no one else's help. If we want to build a house for our family, we can start with a pile of lumber, some nails, and a few Then we need some detailed planning before starting lay the foundation. At the very least, we'll want to make some sketches of how we want the house to look. Unsuccessful software projects fail in their own unique ways, but all successful projects are alike in One common thread that contributes to a successful of software project is the use of modeling. Modeling is a proven and well-accepted engineering technique.
many ways. There are many elements that contribute to a successful software organization;
We build models so that we can better understand the system we are developing.
OOAD [Object Oriented Analysis and Design] 3. Models give us a template that guides us in constructing a system. 4. Models document the decisions we have made.
Modeling is not just for big systems. Even the software equivalent of a dog house can benefit from some modeling. However, it's definitely true that the larger and more complex the system, the more important modeling becomes, for one very simple reason:
We build models of complex systems because we cannot comprehend such a system entirety. PRINCIPLES OF MODELING
There are four basic principles of modeling. First, The choice of what models to create has a profound influence on how a problem is attacked and how a solution is shaped
1.
The first principle of UML refers to the selection of best model. The right models will brilliantly illuminate the most wicked development problems The selection of wrong models will mislead us, causing to focus on irrelevant issues. Every model may be expressed at different levels of precision.
2. 3.
Second,
1.
The second principle of UML consider the primary focus on the appropriate style. The best kind of model are those that helps us to select our degree of detail depending up on who is
2. Third,
The third principle of UML ensure the potentiality of the model. It's best to have models that have a clear connection to reality, and where that connection is weak so that
2. Fourth,
we came to know how these models are different from real world.
No single model is sufficient. Every nontrivial system is best approached through a small set of nearly independent models
1. 2. The fourth principle of UML gives the importance of modeling in UML. For example If we are constructing a building, there is no single set of blueprints that reveal all its
Page 6
G.Vijay kumar
details. 3. plans. At the very least, we'll need floor plans, elevations, electrical plans, heating plans, and plumbing
OBJECT-ORIENTED MODELING
Civil engineers build many kinds of models. Most commonly models are 1. Structural model 2. Dynamic model
The structural models that help people visualize and specify parts of systems and the way those parts relate to one another. The Dynamic models help us to study the behavior of a structure. Each kind of model is organized differently, and each has its own focus. In software, there are several ways to approach a model. The two most common ways are An algorithmic perspective 2. Object-oriented perspective.
1.
Algorithmic 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 In this system as requirements change (and they will) and the system grows (and it will), systems built
into smaller ones. 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. 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, state, and behavior.
Page 7
G.Vijay kumar
Object-oriented development provides the conceptual foundation for assembling systems out of
components using technology such as Java Beans or COM+. 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.
G.Vijay kumar
Page 8
Building Blocks of the UML The vocabulary of the UML encompasses three kinds of building blocks: 1. Things 2. Relationships 3. Diagrams Things are the abstractions that are first-class citizens in a model. Relationships tie things together Diagrams group interesting collections of things. THINGS in the UML There are four kinds of things in the UML: 1. Structural things 2. Behavioral things 3. Grouping things 4. Annotational things Structural Things
Structural things are the nouns of UML models. Structural things are the mostly static parts of a model, representing elements that are either There are seven kinds of structural things, they are 1. 2. 3. 4. 5. 6. 7. Classes Interfaces Collaboration Usecase Active class Component Node
conceptual or physical.
G.Vijay kumar
Page 9
Classes:
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, as in Figure .
Interface
An interface is a collection of operations that specify a service of a class or component. An interface 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. An interface defines a set of operation specifications but never a set of operation implementations. Graphically, an interface is rendered as a Circle together with its name as shown in Figure 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.
Collaboration
Collaborations have structural, as well as behavioral, dimensions. A given class might participate in several collaborations. Graphically, a collaboration is rendered as an Ellipse With Dashed Lines, usually including only its name, as in Figure
Use Case
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. A use case is realized by collaboration. Graphically, a use case is rendered as an Ellipse With Solid Lines, usually including only its name, as in Figure
Active Class
An active class is a class whose objects own one or more processes or threads and therefore can initiate control activity.
Page 10
G.Vijay kumar
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, i.e Rectangle With Heavy Lines, including its name, attributes, and operations, as in Figure
Component
A component is a physical and replaceable part of a system that conforms to and provides the realization of a set of interfaces. In a system, we'll encounter different kinds of deployment components, such as COM+ components or Java Beans, as well as components that are artifacts of the development process, such as source code files.
A component typically represents the physical packaging of otherwise logical elements, such as classes, interfaces, and collaborations. Graphically, a component is rendered as a RECTANGLE WITH TABS, usually including only its name, as in Figure
Node
A node is a physical element that exists at run time and represents a computational resource. 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, as in Figure These seven elementsclasses, interfaces, collaborations, use cases, active classes, components, and nodesare the basic structural things that we may include in a UML model.
BEHAVIORAL THINGS
Behavioral things are the dynamic parts of UML models. G.Vijay kumar Page 11
OOAD [Object Oriented Analysis and Design] Behavioral things are the verbs of a model, representing behavior over time and space. In all, there are two primary kinds of behavioral things, they are
An interaction is a behavior that comprises(contains) a set of messages exchanged among a set of objects within a particular context to accomplish a specific purpose. The behavior of a society of objects or of an individual operation may be specified with an interaction. An interaction involves a number of other elements, including messages, action sequences (the behavior invoked by a message), and links (the connection between objects). Graphically, a message is rendered as a Directed Line, including the name of its operation, as in Figure
State Machine
A state machine is a behavior that specifies the sequences of states an object or an interaction goes during its lifetime in response to events, together with its responses to those events.
The behavior of an individual class or a collaboration of classes may be specified with a state machine. 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 sub states, if any, as in Figure Interactions and state machinesare the basic behavioral things that we may include in a UML
model. Semantically, these elements are usually connected to various structural elements, primarily classes, collaborations, and objects Grouping Things
Grouping things are the organizational parts of UML models.
OOAD [Object Oriented Analysis and Design] In all, there is one primary kind of grouping thing, namely, packages.
Packages A package is a general-purpose mechanism for organizing elements into groups. Packages are the basic grouping things with which you may organize a UML model Structural things, behavioral things, and even other grouping things may be placed in a package. Unlike components (which exist at run time), a package is purely conceptual (meaning that it exists only at development time). Graphically, a package is rendered as a tabbed folder, usually including only its name and, sometimes, its contents, as in Figure 2-10. ANNOTATIONAL THINGS
Annotational thingsare the explanatory parts of UML models. These are the comments we may apply to describe, illuminate, and remark about any element in
a model. There is one primary kind of annotational thing, called a note. Note
A note is simply a symbol for rendering constraints and 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, as in Figure
Dependency
A dependency is a semantic relationship between two things in which a change to one thing (the independent thing) may affect the semantics of the other thing (the dependent thing). Graphically, a dependency is rendered as a dashed line, possibly directed, and occasionally including a label, as in Figure
Association
An association is a structural relationship that describes a set of links, a link being a connection among
objects. Aggregation is a special kind of association, representing a structural relationship between a whole and its parts.
Graphically, an association is rendered as a solid line, possibly directed, occasionally including a label,
and often containing other adornments, such as multiplicity and role names, as in Figure
Generalization
A generalization is a specialization/generalization relationship in which objects of the specialized element (the child) are substitutable for objects of the generalized element (the parent). In this way, 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, as in Figure
Realization
A Realization is a semantic relationship between classifiers, where in one classifier specifies a contract that another classifier guarantees to carry out. we'll encounter realization relationships in two places: between interfaces and the classes or components that realize them, and between use cases and the collaborations that realize them. Graphically, a realization relationship is rendered as a cross between a generalization and a dependency relationship, as in Figure
G.Vijay kumar
Page 14
A diagram is the graphical presentation of a set of elements, most often rendered as a connected graph of vertices (things) and arcs (relationships). We draw diagrams to visualize a system from different perspectives, so a diagram is a projection into a system. The same element may appear in all diagrams, only a few diagrams (the most common case), or in no diagrams at all (a very rare case). The UML includes nine diagrams: 1. 2. 3. 4. 5. 6. 7. 8. 9. Class diagram Object diagram Use case diagram Sequence diagram Collaboration diagram State chart 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 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.
Page 15
Object Diagram
G.Vijay kumar
Object 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. Use case diagrams are especially important in organizing and modeling the behaviors of a system A sequence diagram is an interaction diagram that emphasizes the time-ordering of messages. This is a kind of interaction diagrams An interaction diagram 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 Sequence diagrams are isomorphic, meaning that we can take one and transform it into the other. A collaboration diagram is an interaction diagram that emphasizes the structural organization of the objects that send and receive messages. Collaboration diagrams are isomorphic, meaning that we can take one and transform it into the other.
Sequence Diagram
Collaboration Diagram
A statechart diagram shows a state machine, consisting of states, transitions, events, and activities. Statechart diagrams address the dynamic view of a system. Statechart diagrams are especially important in modeling the behavior of an interface, class, or collaboration and emphasize the event-ordered behavior of an object, which is especially useful in modeling reactive systems
Activity Diagram
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. activity diagram are especially important in modeling the function of a system and emphasize the flow of control among objects
Component Diagram
G.Vijay kumar Page 16
A component diagram shows the organizations and dependencies among a set of components. Component diagrams address the static implementation view of a system. component diagram are related to class diagrams in that a component typically maps to one or more classes, interfaces, or collaborations
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. deployment diagram are related to component diagrams in that a node typically encloses one or more components
Like any language, the UML has a number of rules that specify what a well-formed model should look like. A well-formed model is one that is semantically self-consistent and in harmony with all its related models. The UML has semantic rules for Names Scope Visibility Integrity Execution What we can call things, relationships, and diagrams The context that gives specific meaning to a name How those names can be seen and used by others How things properly and consistently relate to one another What it means to run or simulate a dynamic model
Models built during the development of a software-intensive system tend to evolve (grow, progress , develop ) and may be viewed by many stakeholders in different ways and at different times.
For this reason, it is common for the development team to not only build models that are wellformed, but also to build models that are Elided Incomplete Certain elements are hidden to simplify the view Certain elements may be missing The integrity of the model is not guaranteed
Inconsistent
G.Vijay kumar
Page 17
They are
The UML is more than just a graphical language. Not only is each and every part of its graphical notation there 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 (including their full signatures), and behaviors that the class embodies; We use the UML's graphical notation to visualize a system; and 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. The class notation also exposes the most important aspects of a class, namely its name, attributes, and operations. 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. For example, Figure 2-16 shows a class, adorned to indicate that it is an abstract class with two public, one protected, and one private operation.
G.Vijay kumar
Page 18
Every element in the UML's notation starts with a basic symbol, to which can be added a variety of adornments specific to that symbol.
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, as shown in figure 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).
Graphically, the UML distinguishes an object by using the same symbol as its class and then simply underlying the object's name
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, w can model both interfaces and their implementations, as shown in Figure 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 you to extend the language in controlled ways. The UML's extensibility mechanisms include
G.Vijay kumar Page 19
A stereotype extends the vocabulary of the UML, allowing us to create new kinds of building blocks that are derived from existing ones but that are specific to our problem.
For example, if you are working in a programming language, such as Java or C+ +, we will often want to model exceptions.
In these languages, exceptions are just classes, although they are treated in very special ways. we can make exceptions first class citizens in our models meaning that they are treated like basic building blocks by marking them with an appropriate stereotype, as for the class Overflow in Figure
Tagged Value
A tagged value extends the properties of a UML building block, allowing us to create new information in that element's specification. For example, if we are working on a shrink-wrapped product that undergoes many releases over time, we often want to track the version and author of certain critical abstractions. Version and author are not primitive UML concepts. They can be added to any building block, such as a class, by introducing new tagged values to that building block. In Figure 2-19, author explicitly. for example, the class EventQueue is extended by marking its version and
G.Vijay kumar
Page 20
Constraint
A constraint extends the semantics of a UML building block, allowing us to add new rules or modify existing ones. For example, we might want to constrain the EventQueue class so that all additions are done in order. As Figure shows, we can add a constraint that explicitly marks these for the operation add. project's needs.
Collectively, these three extensibility mechanisms allow us to shape and grow the UML to our Extensibility mechanisms also let the UML adapt to new software technology, such as the likely emergence of more powerful distributed programming languages. we can add new building blocks, modify the specification of existing ones, and even change their semantics.
G.Vijay kumar
Page 21
SOFTWARE ARCHITECTURE
Visualizing, specifying, constructing, and documenting a software-intensive system demands that the system be viewed from a number of perspectives. Different stakeholders end users, analysts, developers, system integrators, testers, technical writers, and project managers each bring different agendas to a project, and each looks that system in different ways at different times over the project's life. Architecture is the set of significant decisions about The organization of a software system 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 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. The use case view doesn't really specify the organization of a software system. The use case view exists to specify the forces that shape the system's architecture. With the UML, the static aspects of use case view are captured in use case diagrams; The dynamic aspects of use case view are captured in interaction diagrams, statechart 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. The design 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 design 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.
Process View:
The process view of a system encompasses the threads and processes that form the system's concurrency and synchronization mechanisms. Process 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.
Implementation View
The implementation view of a system encompasses the components and files that are used to assemble and release the physical system. The implementation 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, state chart diagrams, and activity diagrams.
Deployment View
The deployment view of a system encompasses the nodes that form the system's hardware topology on which the system executes. Deployment 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, state chart diagrams, and activity diagrams.
G.Vijay kumar
Page 23
An iterative process is one that involves managing a stream of executable releases. An iterative process 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 well defined set of objectives are met, artifacts are completed, and decisions are made whether to move into the next phase. The following Figure shows, there are four phases in the software development life cycle: Inception Elaboration construction Transition. In the diagram, workflows are plotted against these phases, showing their varying degrees of focus over
1. 2. 3. 4.
time 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 base-lined.
G.Vijay kumar Page 24
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 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. Here also, 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 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.
G.Vijay kumar
Page 25