uml 101. 2uml language? –provides the semantics and syntax (notation) for each model element e.g.,...

21
UML 101 UML 101

Post on 21-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

UML 101UML 101

Page 2: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

2

UMLUML• Language?

– Provides the semantics and syntax (notation) for each model element

• e.g., class, interface, association, attributes, etc. etc.

• Unified? – Major modeling languages merged to UML in 90s.

• Object Management Group (www.omg.org)

– Many religious wars before UML is born. • UML: class, association, generalization, aggregation• Booch: class, use, inheritance, containment• OMT: class association, generalization, aggregation• Class, association, subtype,

Page 3: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

3

• What UML provides– Modeling semantics and notation– 13 diagrams– Modeling viewpoints

• What UML does not provide– Method:

• e.g. how to identify classes?

– Methodology

Page 4: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

4

13 Diagrams in UML 2.x 13 Diagrams in UML 2.x • Use case

– Interactions b/w a system and its users or other external entities/systems. Requirements to a system.

– UML 1.x

• Class– Classes, interfaces, etc., and

relationships b/w them.– UML 1.x

• Object– Object instances of the classes

defined in class diagrams– UML 1.x

• Component– Components and the interfaces

they use to interact with each other.

– UML 2.0

• Composite structure– The internals of a class or

component – UML 2.0

• Package – The hierarchal organization of

groups of classes and components.

– UML 2.0

Page 5: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

5

• Communication– The ways in which objects

interact– Renamed from UML 1.x’s

collaboration diagrams

• Sequence – Interactions b/w objects where

the order of the interactions is important.

– UML 1.x

• Timing– Interactions b/w objects where

timing is an important concern. – UML 2.0

• Interaction overview– Collect communication,

sequence and timing diagrams together.

• State machine– The state of an object

throughout its lifetime, and the events that can change that state.

– UML 1.x

• Activity– Sequential and parallel

activities in a system– UML 1.x

• Deployment– A system’s deployment– UML 1.x

Page 6: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

6

Modeling ViewpointsModeling Viewpoints• Viewpoints

– A technique for abstraction using a selected set of architectural concepts and structuring rules

• to focus on particular concerns within a given system.

• Why viewpoints?– It is often impossible for a single developer to understand

everything about a software system all at once. • It is essential in a project to undertake a development or

maintenance task without understanding everything about the system.

• 5 viewpoints in UML– Logical, process, development, physical and use case

viewpoints

Page 7: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

7

Kruchten’s 4+1 View ModelKruchten’s 4+1 View Model

• Logical view– Describes the abstract

descriptions of a system’s parts.

– Models what a system is made up of and how the parts interact with each other.

– Class, object, composite str, comm, seq, timing, interaction overview and state machine diagrams

• Process view– Describes the processes

within a system • e.g., Biz processes,

processes/threads

– Activity diagrams

• Development view– Describes a system’s

parts are organized into modules and components.

• Modules/architecture/layers

– Composite str, package and component diagrams

Page 8: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

8

• Physical view– Describes how a system’s

design is realized as a set of real-world entities.

• e.g., app installation, machine/host configuration, network configuration

– Deployment diagrams

• Use case view– Describes the functionality

of a system being modeled from the perspective of the outside world.

• Use cases and scenarios that consolidate the other views.

– All of the other views rely on this view to guide them.

– Use case diagrams

Page 9: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

9

ClassesClasses

ClassAttribute1Attribute2Attribute3Operation1Operation2Operation3

Class

Attribute1Attribute2

Class

Operation1Operation2

Class

CustomerfirstName: Stringlastname: Stringid: int

getId(): int

Addressstreet: Stringcity: Stringstate: StringzipCode: intgetStreet(): StringsetStreet(street: String): void

Page 10: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

10

PackagesPackagescs680

edu

umb

cs680

Customer Address

cs680

edu::umb::cs680

Customer Address

edu::umb::cs680::Customer

Customer(from cs680)

Page 11: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

11

VisibilityVisibility

Address

+ city: String

getCity(): String

• Defines who can access an attribute or operation.– Public (+), protected (#), package (~) and private (-)

Customer

cs680

SpecialAddress

cs681

Customer

Page 12: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

12

Address

# city: String

getCity(): String

Customer

cs680

SpecialAddress

cs681

Customer

Note: Java’s protected visibility allows any other classes in the same package toaccess to protected attrs/ops of a class. It is a combination of UML’s protected andpackage visibility.

Page 13: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

13

Address

~ city: String

getCity(): String

Customer

cs680

SpecialAddress

cs681

Customer

Page 14: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

14

Address

- city: String

getCity(): String

Customer

cs680

SpecialAddress

cs681

Customer

Note: Use private/protected visibility as often as possible to encapsulate/hidethe internal attrs/ops of a class.

Page 15: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

15

AssociationAssociation

CustomerfirstName: StringLastname: Stringid: int

getAddress(): Address

AddressStreet: Stringcity: Stringstate: StringzipCode: int

getCity(): String

1

- homeAddr

CustomerfirstName: StringLastname: Stringid: inthomeAddr: Address

getAddress(): Address

Page 16: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

16

CustomerfirstName: StringLastname: Stringid: int

getHomeAddress(): AddressgetOfficeAddress(): Address

AddressStreet: Stringcity: Stringstate: StringzipCode: int

getCity(): String

1

- homeAddr

CustomerfirstName: StringLastname: Stringid: inthomeAddr: AddressofficeAddr: AddressgetHomeAddress(): AddressgetOfficeAddress(): Address

1

- officeAddr

Page 17: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

17

CustomerfirstName: StringLastname: Stringid: int

getAddress(): Address [1..2]

AddressStreet: Stringcity: Stringstate: StringzipCode: int

getCity(): String

Customer

firstName: StringLastname: Stringid: intaddresses: Address [1..2]

getAddress(): Address [1..2]

1..2

- addresses

Page 18: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

18

CustomerfirstName: StringLastname: Stringid: int

getAddress(): Address[*]

AddressStreet: Stringcity: Stringstate: StringzipCode: int

getCity(): String

Customer

firstName: StringLastname: Stringid: intaddresses: Address [*]

getAddress(): Address [*]

*

- addresses

Page 19: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

19

CustomerfirstName: StringLastname: Stringid: int = “0”

getId(): int

Page 20: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

20

HW5HW5

• Read SP 20 to 25

• Imagine (or eat!) an ice cream, and model ice creams. Make an ice cream model with a UML tool. Paste your model to a PPT file, and upload it to the course repository. – Make a new directory “hw5-ice-cream” and upload

your PPT file there.– Contact my TA for all technical questions

• Due: Sept 27 (Thu), 6pm

Page 21: UML 101. 2UML Language? –Provides the semantics and syntax (notation) for each model element e.g., class, interface, association, attributes, etc. etc

21

UML Modeling ToolsUML Modeling Tools• Visual Paradigm (Community Edition)

– http://www.visual-paradigm. • JUDE (Community Edition)

– http://jude.change-vision.com/jude-web/• EclipseUML

– http://www.omondo.com/• MagicDraw

– http://www.nomagic.com/• Poseidon (Community Edition)

– http://www.gentleware.com/index.php?id=ce• Green

– http://green.sourceforge.net/• A List of UML Tools

– http://en.wikipedia.org/wiki/List_of_UML_tools