outline: some points what is uml (& object-oriented methodology)?

23
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1

Upload: micol

Post on 14-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP. 1. Outline: Some Points What Is UML (& Object-Oriented Methodology)? Why & How Is UML (& OO) Related to This Course? Brief Review of OO Brief Review of UML. 2. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

Fall 2010

CS4310 Requirements Engineering

A Brief Review of UML & OO

Dr. Guoqiang Hu

Department of Computer Science

UTEP

1

Page 2: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

Outline:

1. Some Points

2. What Is UML (& Object-Oriented Methodology)?

3. Why & How Is UML (& OO) Related to This Course?

4. Brief Review of OO

5. Brief Review of UML

2

Page 3: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

3

1 Some Points

1.1 You got much much much more than you paid for

1.2 Things in SE are much much much easier said than done

1.3 Make friends and/or make a living (a degree in your case)?

Page 4: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

4

2 What Is UML (& Object-Oriented Methodology)?

UML: Unified Modeling Language

UML is a standardized general-purpose modeling language. The standard is managed, and was created by, the Object Management Group (OMG).

UML includes a set of graphic notations to create visual models of systems.

Object-Oriented Methodology

Page 5: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

5

Page 6: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

6

Page 7: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

7

3 Why & How Is UML (& OO) Related to This Course?

3.1 A new prototyping tool?

3.2 Big differences

There is big differences between the traditional functional decomposition approach (or the SASD (Structured Analysis and Structured Design)) and the OO approach right from the beginning.

Page 8: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

8

4 Brief Review of OO4.1 OO key concepts

Class

Object

instance of a class

Message

Identity

every object is a different object

Abstraction

elimination of the irrelevant ==> essential

Page 9: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

9

4.1 OO key concepts (cont’d)

Classification

Encapsulation

information hiding and access control

Inheritance

to inherit means to reuse. multi or single

Polymorphism

different reactions by different levels of objects

Persistence

object outlives the process that created it

Page 10: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

4.2 Advantages of OO approach

Mimic the world

Reuse

Consistence/Traceability

Seamless development process

Progressively refine work rather than converting from one representation to another

Incremental/Iterative development

Flexibility: Easy to change, expand

10

Page 11: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

5 Brief Review of UML5.1 OO modeling objective

To develop precise, concise, understandable, and correct models of the problem (modeling concepts, NOT implementation).

Static (or Structural) view of a system model

emphasizes the static structure of the system using objects, attributes, operations, and relationships.

Dynamic (or Behavioral) view of a system model

emphasizes the dynamic behavior of the system by showing collaborations among objects and changes to the internal states of objects.

It is important to distinguish between the UML model and the diagrams of a system: A diagram is a partial graphic representation of a system's model. The model also contains documentation that drive the model elements and diagrams (such as written use cases). 11

Page 12: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

5.2 Several OO modeling diagrams

Several structure diagrams

Class diagram: describes the structure of a system by showing the system's classes, their attributes, and the relationships among the classes.

Composite structure diagram: describes the internal structure of a class and the collaborations that this structure makes possible.

Object diagram: shows a complete or partial view of the structure of a modeled system at a specific time.

Component diagram: describes how a software system is split up into components and shows the dependencies among these components.

Package diagram: describes how a system is split up into logical groupings by showing the dependencies among these groupings.

Deployment diagram: describes the hardware used in system implementations and the execution environments and artifacts deployed on the hardware.

12

Page 13: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

5.2 Several OO modeling diagrams (cont’d)

Several behavioral diagrams (cont’d)

Activity diagram: describes the business and operational step-by-step workflows of components in a system. An activity diagram shows the overall flow of control.

State machine diagram: describes the states and state transitions of the system.

Use case diagram: describes the functionality provided by a system in terms of actors, their goals represented as use cases, and any dependencies among those use cases.

Interaction diagrams (a subset of behavioral diagrams): emphasize the flow of control and data in the system being modeled.

Communication diagram: shows the interactions between objects or parts in terms of sequenced messages. They represent a combination of information taken from Class, Sequence, and Use Case Diagrams describing both the static structure and dynamic behavior of a system.

13

Page 14: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

5.2 Several OO modeling diagrams (cont’d)

Several behavioral diagrams (cont’d)

Interaction diagrams (cont’d)

Sequence diagram: shows how objects communicate with each other in terms of a sequence of messages. Also indicates the lifespans of objects relative to those messages.

Timing diagram: a specific type of interaction diagram, where the focus is on timing constraints.

14

5.3 Class diagram (the only one briefed)

Steps:

Identify objects and classes

Identify attributes of objects and associations

Organize and simplify object classes using inheritance

Verify that paths exist for likely operations

Page 15: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

15

5.3 Class diagram (cont’d)

Object:

Physical entities: companies, people, I/O devices

Concepts: flight, transaction, purchase, business process

Attribute: a single characteristic (property, quality (adjective))

Operation: a behavior (function, transformation (verb))

Class: a set of objects with

common properties (attributes)

common behavior (operations)

common relationships to other objects

common semantics

Page 16: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

16

5.3 Class diagram (cont’d)

In-class exercise: Create a class list with attributes and operations for the following scenario:

A student may take up to five courses in a semester. Each course may have as many as 30 students in each section. Each course has one section per semester. A class room can hold at most one course at a time.

UML class diagram:

Class NameClass Name

Attributes

Operations

Page 17: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

17

5.3 Class diagram (cont’d)

Class diagram example 1:

Car

speed

direction

Level of detail varies with level of

abstraction: start with high abstraction

Page 18: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

17

5.3 Class diagram (cont’d)

Class diagram example 1:

Car

speed

direction

Refine with

Types

speed: Integer

direction: Tuple

Car

Page 19: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

17

5.3 Class diagram (cont’d)

Class diagram example 1:

Car

speed

direction

speed: Integer

direction: Tuple

Car

+speed: Integer = 0;

+direction: Tuple {readOnly}

Refine with

Visibility

Defaults

Properties

Car

Page 20: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

18

5.3 Class diagram (cont’d)

Class diagram example 2:

Employee

Employee

Name:

ID:

SetName (string): void

(Employee)

Joe

an instance of the Employee object.

Page 21: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

19

5.3 Class diagram (cont’d)

Class relationships:

Aggregation

(Comprises)

Association A connection between two classes

Generalization

(Inheritance)

An association that suggests that one class contains another. Destroying the "whole" does not destroy the parts

Composition

(Has)

An association that suggests that one class contains another. The parts are destroyed with the "whole”.

Page 22: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

20

5.3 Class diagram (cont’d)

Class relationships example 1:

Company Division1

*

Employee

*

1

Page 23: Outline: Some Points What Is UML (& Object-Oriented Methodology)?

21

5.3 Class diagram (cont’d)

Class relationships example 2:

Customer

Corporate

Customer

Private

Customer

The 2 subclasses inherit everything from the superclass Customer