c++ training datascope lawrence d’antonio lecture 11 uml

Post on 21-Dec-2015

223 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

C++ TrainingC++ TrainingDatascopeDatascope

Lawrence D’AntonioLawrence D’AntonioLecture 11Lecture 11

UMLUML

What is UML?What is UML?

UML is a language for UML is a language for visualizingvisualizing. It allows . It allows the designer to express the model for a the designer to express the model for a system in graphical language.system in graphical language.

UML is a language for UML is a language for specifyingspecifying. It . It specifies all analysis, design and specifies all analysis, design and implementation decisions in constructing a implementation decisions in constructing a system.system.

What is UML? 2What is UML? 2

UML is a language for UML is a language for constructingconstructing. It . It should be possible to map from a model in should be possible to map from a model in UML into an implementation language.UML into an implementation language.

UML is a language for UML is a language for documentingdocumenting. It . It documents artifacts such as requirements, documents artifacts such as requirements, architecture, design, source code, architecture, design, source code, prototypes, and testing.prototypes, and testing.

UML Building BlocksUML Building Blocks

There are three kinds of building blocks in There are three kinds of building blocks in UML.UML.

ThingsThings RelationshipsRelationships DiagramsDiagrams

UML ThingsUML Things

Structural thingsStructural things Behavioral thingsBehavioral things Grouping thingsGrouping things Annotational thingsAnnotational things

UML StructuresUML Structures

StructuresStructures. Different types of UML structures . Different types of UML structures are:are:

Classes.Classes. A class has attributes, operations, A class has attributes, operations, and relationships.and relationships.

Window ClassWindow Class

+open()+close()+move()+display()

-origin-size

Window

UML Structures 2UML Structures 2

Interfaces.Interfaces. A collection of operations that A collection of operations that specify a service of a class or component.specify a service of a class or component.

Window InterfaceWindow Interface

IWindow

+open()+close()+move()+display()

«interface»IWindow

Window

UML Structures 3UML Structures 3

Collaboration Diagram.Collaboration Diagram. Defines an Defines an interaction and a collection of roles and interaction and a collection of roles and other elements that work together to other elements that work together to provide some cooperative behavior.provide some cooperative behavior.

Collaboration DiagramCollaboration Diagram

ElementElement SymbolSymbol

Object:Object: The objects interacting with each The objects interacting with each other in the system. Depicted by a rectangle other in the system. Depicted by a rectangle with the name of the object in it, preceded with the name of the object in it, preceded by a colon and underlined.by a colon and underlined.

Relation/Association:Relation/Association: A link connecting A link connecting the associated objects. Qualifiers can be the associated objects. Qualifiers can be placed on either end of the association to placed on either end of the association to depict cardinality.depict cardinality.

Messages:Messages: An arrow pointing from the An arrow pointing from the commencing object to the destination object commencing object to the destination object shows the interaction between the objects. shows the interaction between the objects. The number represents the order/sequence The number represents the order/sequence of this interaction.of this interaction.

Course Management ExampleCourse Management Example

An organization that offers a variety of An organization that offers a variety of courses needs to create a courseware courses needs to create a courseware management system.management system.

Each course is made up of a set of topics. Each course is made up of a set of topics. Tutors in the organization are assigned Tutors in the organization are assigned

courses to teach according to the area that courses to teach according to the area that they specialize in and their availability. they specialize in and their availability.

Example 2Example 2

The organization publishes and maintains The organization publishes and maintains a calendar of the different courses and the a calendar of the different courses and the assigned tutors every year. assigned tutors every year.

There is a group of course administrators There is a group of course administrators in the organization who manage the in the organization who manage the courses including course content, assign courses including course content, assign courses to tutors, and define the course courses to tutors, and define the course schedule. schedule.

Example 3Example 3

System objects:System objects: Course AdministratorCourse Administrator CourseCourse TopicTopic TutorTutor UserUser

Example 4Example 4

Manage Course Information ScenarioManage Course Information Scenario A user who is a course administrator A user who is a course administrator

invokes the manage course functionality. invokes the manage course functionality. The manage course functionality of the The manage course functionality of the

course administrator invokes either the course administrator invokes either the course creation or course modification course creation or course modification functionality of a course. functionality of a course.

Example 5Example 5

After the course is either created or After the course is either created or modified, the manage topic functionality of modified, the manage topic functionality of the course administrator calls the topic the course administrator calls the topic creation or modification functionality of a creation or modification functionality of a topic. topic.

Finally, the user invokes the assign tutor to Finally, the user invokes the assign tutor to course functionality of the course course functionality of the course administrator to assign a tutor to the administrator to assign a tutor to the selected course. selected course.

Example 6Example 6

Another exampleAnother example

UML Structures 4UML Structures 4

Use Case.Use Case. This is a description of sequences of This is a description of sequences of actions that a system performs relevant to actions that a system performs relevant to particular actors who interact with the system.particular actors who interact with the system.

The Use case diagram is used to identify the The Use case diagram is used to identify the primary elements and processes that form the primary elements and processes that form the system. The primary elements are termed as system. The primary elements are termed as "actors" and the processes are called "use "actors" and the processes are called "use cases." The Use case diagram shows which cases." The Use case diagram shows which actors interact with each use case. actors interact with each use case.

Elements of Use CasesElements of Use Cases

Actors:Actors: An actor portrays any entity (or An actor portrays any entity (or entities) that performs certain roles in a entities) that performs certain roles in a given system. An instance of an actor given system. An instance of an actor represents an individual interacting with represents an individual interacting with the system in a specific way. For example, the system in a specific way. For example, in a banking system there may be actors in a banking system there may be actors named Loan Officer and Customer. Actors named Loan Officer and Customer. Actors are active participants in the system.are active participants in the system.

Use Case:Use Case: A use case in a use case diagram is a description of a set of sequences of actions, including variants, that a system performs to yield an observable result of value to an actor. Graphically, a use case is represented as an ellipse. For example, in an ATM ValidateUser may be one use case.

Courseware exampleCourseware example

Who are the actors in the courseware Who are the actors in the courseware management system?management system?

Course AdministratorCourse Administrator TutorTutor StudentStudent

Example 2Example 2

What are the use cases for the courseware What are the use cases for the courseware management system?management system?

View coursesView courses Manage course informationManage course information Manage topics for a courseManage topics for a course View course calendarView course calendar View tutorsView tutors Manage tutor informationManage tutor information Assign courses to tutorsAssign courses to tutors

Example 3Example 3

Another exampleAnother example

UML Structures 5UML Structures 5

Active Class.Active Class. These is a class whose objects These is a class whose objects own one or more processes or threads and own one or more processes or threads and therefore can initiate control activity.therefore can initiate control activity.

+suspend()+flush()

Event Manager

UML Structures 6UML Structures 6

Component.Component. This is a modular part of the This is a modular part of the system design that hides its system design that hides its implementation behind a set of external implementation behind a set of external interfaces.interfaces.

An interface that a component realizes is An interface that a component realizes is called a called a provided interfaceprovided interface. .

An interface that a component uses is An interface that a component uses is called a called a required interfacerequired interface..

Simple exampleSimple example

Example 2Example 2

In this example there are three In this example there are three components: Order System, Inventory components: Order System, Inventory System, Customer Repository.System, Customer Repository.

The Order System requires an interface The Order System requires an interface for customer lookup. This interface is for customer lookup. This interface is provided by the Customer Repository.provided by the Customer Repository.

Courseware exampleCourseware example

We may wish to group together classes We may wish to group together classes such as CourseAdministrator, Course, such as CourseAdministrator, Course, Topic, and Student in a Model layer.Topic, and Student in a Model layer.

We will need to provide a consistent We will need to provide a consistent interface to enable other classes and interface to enable other classes and components to interact with them and components to interact with them and utilize their services. utilize their services.

Example 2Example 2

UML Structures 7UML Structures 7

Node.Node. This is a physical element that This is a physical element that exists at run time and represents a exists at run time and represents a computational resource (usually having computational resource (usually having memory and processing capability).memory and processing capability).

UML Structures 8UML Structures 8

Deployment Diagram.Deployment Diagram. A deployment A deployment diagram shows a set of nodes and their diagram shows a set of nodes and their relationships. They illustrate the static view relationships. They illustrate the static view of an architecture. Deployment diagrams of an architecture. Deployment diagrams are related to component diagrams in that are related to component diagrams in that a node typically encloses one or more a node typically encloses one or more components.components.

ExampleExample

Example 2Example 2

UML BehaviorsUML Behaviors

UML behaviors are the verbs of a model. UML behaviors are the verbs of a model. There are three primary types of behaviors There are three primary types of behaviors in UML: interactions, state machines, and in UML: interactions, state machines, and actions. actions.

UML Behaviors 2UML Behaviors 2

Interactions. Represents messages Interactions. Represents messages passed among a set of objects, in order to passed among a set of objects, in order to achieve a particular purpose.achieve a particular purpose.

In an interaction diagram the focus is on In an interaction diagram the focus is on the set of objects that interact in a system.the set of objects that interact in a system.

UML Behaviors 3UML Behaviors 3

Sequence diagramSequence diagram

UML Behaviors 4UML Behaviors 4

Collaboration diagramCollaboration diagram

UML Behaviors 5UML Behaviors 5

State machine. Represents the series of State machine. Represents the series of states an object goes through in its states an object goes through in its lifetime, in response to different events. lifetime, in response to different events.

A state machine consists of states A state machine consists of states (rendered as a rounded rectangle), (rendered as a rounded rectangle), transitions (the flow between states), transitions (the flow between states), events (that trigger a transition), and events (that trigger a transition), and activities (the response to a transition).activities (the response to a transition).

UML Behaviors 6UML Behaviors 6

In a state machine the focus is on the life In a state machine the focus is on the life cycle of a single object.cycle of a single object.

UML Behaviors 7UML Behaviors 7

State machine for enrolling a seminar.State machine for enrolling a seminar.

UML Behaviors 8UML Behaviors 8

Complete seminar life cycle.Complete seminar life cycle.

UML Behaviors 9UML Behaviors 9

In a UML activity the focus is on the In a UML activity the focus is on the sequence of actions taken.sequence of actions taken.

Each action is rendered as a rounded Each action is rendered as a rounded rectangle.rectangle.

UML Behaviors 10UML Behaviors 10

Activity Activity diagram. diagram. Workflow for Workflow for an order an order processing processing system.system.

UML GroupingsUML Groupings

The primary construct in UML for grouping The primary construct in UML for grouping things is the package.things is the package.

A package is a general purpose A package is a general purpose mechanism for organizing the design, as mechanism for organizing the design, as opposed to classes that organize opposed to classes that organize implementation constructs.implementation constructs.

Packages may include in type of UML Packages may include in type of UML things.things.

UML Groupings 2UML Groupings 2

A class package diagram groups classes A class package diagram groups classes together that are related by inheritance, together that are related by inheritance, composition, or collaboration. composition, or collaboration.

A data package diagram organizes data A data package diagram organizes data entities.entities.

A use case package diagram represents a A use case package diagram represents a high level view of a use case.high level view of a use case.

UML Groupings 3UML Groupings 3

Use case diagram package.Use case diagram package.

top related