UML – Universal Modeling Language IT 210 Introduction to Modeling.

37
UML – Universal Modeling Language IT 210 Introduction to Modeling

Transcript of UML – Universal Modeling Language IT 210 Introduction to Modeling.

Page 1: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML – Universal Modeling Language

IT 210Introduction to Modeling

Page 2: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Modeling

Representing the world how it is—or how we want it to be

We can change the world for better, and we should

Page 3: UML – Universal Modeling Language IT 210 Introduction to Modeling.

“Today the information highway, with all of its means of communication, affords an opportunity for us to carry the mission with a thousandfold greater speed and ease than Peter, James, and John and the other intrepid disciples.”

– President James E. Faust

Page 4: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Why Model?

Create, Design, Communicate Create: Generate ideas, solutions Design: Consistent, coherent

solutions (model) Communicate: Real world solutions

Page 5: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Abstract representation

Complete solution has many aspectsAbstract and generalizable

Specific:this_num = 1print this_numthis_num = 2 print this_num…this_num = 20print this_num

Abstract:

for num = 1 to MAX print numnext

Page 6: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Software modeling

Model process (sequence of activities)Changes of stateData structuresData structure types and with methods

Need languages of abstraction …

Page 7: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML – Diagrams

Page 8: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Approaches to UML

SketchBlueprintProgramming

Ref: Martin Fowler, “UML Distilled”

Page 9: UML – Universal Modeling Language IT 210 Introduction to Modeling.
Page 10: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML Diagrams - Activity

Page 11: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Example Juke Box

Page 12: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Juke Box with Partitions

Also called swim-lanes

Page 13: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Source: CodeGear from Borland

Page 14: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML diagrams - Sequence

Page 15: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Sequence – Juke Box

Page 16: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML Diagrams - State

Page 17: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML Goals

Provide users with a ready-to-use, expressive visual modeling language so they can develop and exchange meaningful models. Provide extensibility and specialization mechanisms to extend the core concepts. Be independent of particular programming languages and development processes. Provide a formal basis for understanding the modeling language. Encourage the growth of the OO tools market. Support higher-level development concepts such as collaborations, frameworks, patterns and components. Integrate best practices.

Page 18: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Review

The concepts on the following slides you should understand from CS 142.They are used in modeling.

Page 19: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 1: Real world “thingy”

Entity, object, noun-verb Something that has a name Something that has Identity Person, place, thing Something you can point at. Something that does stuff or has stuff

done to it Can you think of another way to say it?

Page 20: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Entity/ObjectERM

Name

Attributes

Name

Attributes

Methods

UML

Page 21: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 2: Instance/Class

Thingies are grouped by similar characteristics. “Person” is a class“Janet” is an instance

Page 22: UML – Universal Modeling Language IT 210 Introduction to Modeling.

UML: Class/Instance

Person

Name:String Height:RealWeight:Real

Create(name:String,Height:Real,Weight:Real)

Delete()

Class Fred:Person

Name = Frederick G. Williams Height = 2.1Weight = 50

:Person

Name = Frederick G. Williams Height = 2.1Weight = 50

Named Person Instance

Anonymous Person Instance

Page 23: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 3: Attribute

Characteristic of an object that defines a member of a class.

Page 24: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 4: Property

Characteristic of an object that isn’t an attribute.For example: Height is an attribute of Person Location is not an attribute of the Person

object we defined.

Systems often “create” objects with attributes and “attach” properties.

Note: This is not standard terminology, but it matches most of what Microsoft does. No standard diagramming approach.

Page 25: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 5: Relationship

Objects are related to each other in the real world. John husband of Mary Julio’s Ferrari Carburator part of engine Mary is a Girl

Some relationships are special enough to have their own names and diagrams

Page 26: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 6: Value

Attributes can be assigned values.Properties can be assigned values.

Page 27: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 7: Constraints

Attributes, Properties, and Relationships can be “constrained”. What constraints are possible is determined by the semantics of the value or Relationship. Height must be greater than 0 A man can have only one wife at a time.

Page 28: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 8: Cardinality Constraints

You can count things.It is often important to constrain Cardinality of relationships: A person can only have one mother. A car can have only one VIN.

Page 29: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Cardinality

left right example

1 1 one-to-oneperson <-> weight

0..1 1optional on one side one-to-one

date of death <-> person

0..* or * 0..* or *optional on both sides many-to-many

person <-> book

1 1..* one-to-manyperson <-> language

Page 30: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 9: Participation

Objects participate in relationships.Sometimes you want to constrain an object’s participation in a relationship. A “rental” object must have a car

Page 31: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 10: Key

Something that identifies an object in a set of objects.Unique Key – no other object can have it.Composite Key – key made up of more than one attribute

Page 32: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 11:Generalization

Employee is a person.An Employee object has all the characteristics of a person, and then some.

Page 33: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 12: Specialization

Go the other way from Generalization. An object that has all of the attributes of a class, and then more attributes, is a member of the General class plus a class defined by all of the attributes.

Page 34: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 13: Object/Entity

A thingy with identity, Attributes and Methods is called an object.Of course, all of the abstract class English words have been overloaded so many times you better ask what someone means before you “assume” anything.

Page 35: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 14: Inheritance

A relationship between classes such that all of the attributes and methods of the super-class are projected into the sub-class. Two kinds Structure and Interface: difference beyond scope of lecture

Page 36: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 15: Relationships with Attributes

Sometimes a relationship between two objects can have attributes. John was married to Mary on January

3, 2999 Marriage date is not an attribute of

either John or Mary. It is an attribute of their relationship.

Page 37: UML – Universal Modeling Language IT 210 Introduction to Modeling.

Concept 16: System Modeling

This class is WEB SYSTEMS which includes data modeling, however, objects are more than just state. UML also models processing and many other attributes of a system.Data modeling is a part of what UML calls structure modeling.What the TA’s call a UML is an ACTIVITY diagram.