Introduction to UML Dr. Rajivkumar S. Mente Assistant Professor, Department of Computer Science, Solapur University, Solapur rajivmente@rediffmail.com
Introduction to UML UML is a language used for 1. Visualizing : UML is a bunch of graphical symbols Each symbol is a well-defined semantics One developer can write a model in the UML and another developer or tool can interpret that model
Continued.. UML is a language used for 2. Specifying : Means building models that are precise, unambiguous and complete Deal with the specification of analysis, design and implementations decisions
Continued.. UML is a language used for 3. Constructing : Possible to generate code from a UML model into programming language The reverse is also possible 4. Documenting the artifacts of software system Means that the UML deals with the documentation of a system s architecture and all of its details
Where can the UML be used? It has been used effectively for software intensive domains such as 1. Enterprise information systems 2. Banking and financial services 3. Telecommunications 4. Transportation 5. Defense / aerospace 6. Medical electronics 7. Distributed web-based services
Conceptual Model of the UML Requires three elements 1. The basic building blocks 2. The rules 3. Common mechanisms
The basic building blocks Three kinds of building blocks 1. Things 2. Relationships 3. Diagrams
Structural Things in UML Nouns Mostly static parts Represents elements either conceptual or physical
Structural Things in UML Seven kinds of structural things 1. Class 2. Interface 3. Collaboration 4. Use case 5. Active class 6. Component 7. node
A Class Description of a set of objects window origin size open() close() move() display()
An Interface Class Collection of operations that specify a service of a class Ispass A Collaboration Defines an interaction and provide some cooperative behavior Chain of Responsibility
A use Case Set of sequence of actions that a system performs Place order An active class A class whose objects own one or more processes EventManager eventid suspend () flush()
A Component Physical and replaceable part of the system orderform.java A node Physical elements that exists at run time server
Behavioral Things in UML Dynamic parts of the UML model Two kinds of behavioral things are 1. An interaction behavior 2. A state machine
Interaction behavior Consists of a set of messages exchanged among a set of objects. State Machine Specifies the sequences of states an object goes through during its lifetime. Waiting
Grouping Things in UML Organizational parts of UML models Package is one kind of grouping things Package is used for organizing elements into groups Structural things, behavioral things and other things may be placed in a package A package is a conceptual thing i.e. it exists only at development time.
A package is graphically rendered as a tabbed folder including its name and contents Business rules
Annotational Things in UML Comments applied to describe, illuminate and remark about any element in a model. Graphically a note is rendered as a rectangle with dog-eared corner together with a textual or graphical comment Return copy of self
Relationships in UML Four types of relationships in the UML 1. Dependency 2. Association 3. Generalization 4. Realization
Continued..Relationships in UML Dependency : A semantic relationship between two things Change to one thing may affect the semantics of the other thing Graphically a dependency is shown as dashed line possibly directed and with label
Continued..Relationships in UML Association : Describes a set of links connected among objects Graphically shown as solid line possibly with label and with multiplicity and role names
Continued..Relationships in UML Generalization : Is a specialization / generalization relationship Objects of the specialized element ( the child) are substitutable for the generalized element (the parent) Graphically shown as solid line with a hollow arrow head pointing to the parent
Diagrams in the UML A diagram is the graphical representation of a set of elements rendered as a connected graph of vertices (things) and arcs (relationships) The same element may appear inall diagrams UML includes nine kinds of diagrams 1. Class diagram : Shows a set of classes, interfaces and collaborations and their relationships
Continued..Diagrams in the UML 2. An object diagram : Shows a set of objects and their relationships. 3. A use case diagram : Shows a set of use cases and actors (a special kind of class) and their relationships. 4. Sequence diagram : Is an interaction diagram that highlight the time ordering of messages. 5. Collaboration diagram : Is an interaction diagram that emphasizes the structural organization of the objects that send and receive messages.
Continued..Diagrams in the UML 6. Statechart diagram : Shows a state machine consisting of states, transitions, events and activities. 7. An activity diagram : Is a special kind of statechart diagram that shows the flow from activity to activity within a system 8. Component diagram : Shows the organizations and dependencies among a set of components. 9. Deployment diagram : Shows the configuration of run-time processing nodes and the components that live on them
Common Mechanisms in the UML Four common mechanisms 1. Specifications 2. Adornments 3. Common divisions 4. Extensibility mechanisms
Continued. Common Mechanisms in the UML Specifications : Behind every part of graphical notation there is a specification. This provides a textual statement of the syntax and semantics of that building block.
Continued. Common Mechanisms in the UML Adornments : Variety of adornments can be added to every symbol. e.g. figure shows a class adorned to indicate that it is an abstract class with two public, one protected and one private operation Transaction + execute() + rollback() # priority() - timestamp()
Continued. Common Mechanisms in the UML Common Divisions : There is the division of class and object In UML you can model class as well as objects. e.g. Customer Jan : Customer name address Phone : Customer Elyse Fig. : class objects
Continued. Common Mechanisms in the UML (Common Divisions) Common Divisions : There is separation of interface and implementation Both interfaces and their implementations can be modeled. IsUnknown Spellingwizard.dll IsSpelling Here spellingwizard.dll implements two interfaces IsUnknown and IsSpelling
Continued. Common Mechanisms in the UML Extensibility Mechanisms: UML is open ended Therefore possible to extend the language in controlled ways The extensibility mechanisms include 1.Stereotypes 2.Tagged values 3.Constraints
Continued. Common Mechanisms in the UML (Extensibility Mechanisms) Stereotypes : Allows to create new kinds of building blocks by extending the vocabulary. e.g. the exception class overflow in C++ is shown as << exception >> overflow Tagged Values : Extends the properties of a UML building block allowing to create new information in that element s specification
Continued. Common Mechanisms in the UML (Extensibility Mechanisms) Tagged Values : Extends the properties of a UML building block allowing to create new information in that element s specification EventQueue {version = 1.2 author = xyz} add() remove() flush()
Continued. Common Mechanisms in the UML (Extensibility Mechanisms) Constraints: Allows to extend the semantics of a UML building block by adding new rules or modify existing ones. e.g. EventQueue add() remove() flush() ordered Here {ordered} constraint on operation add specifies that all additions are done in order.