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
“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
Why Model? Create, Design, Communicate Create: Generate ideas, solutions Design: Consistent, coherent solutions (model) Communicate: Real world solutions
Abstract representation Complete solution has many aspects Abstract and generalizable Specific: this_num = 1 print this_num this_num = 2 print this_num … this_num = 20 print this_num Abstract: for num = 1 to MAX print num next
Software modeling Model process (sequence of activities) Changes of state Data structures Data structure types and with methods Need languages of abstraction …
UML – Diagrams
Approaches to UML Sketch Blueprint Programming Ref: Martin Fowler, “UML Distilled”
UML Diagrams - Activity
Example Juke Box
Juke Box with Partitions Also called swim-lanes
Source: CodeGear from Borland
UML diagrams - Sequence
Sequence – Juke Box
UML Diagrams - State
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.
Review The concepts on the following slides you should understand from CS 142. They are used in 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?
Entity/Object ERM Name Attributes Name Attributes Methods UML
Concept 2: Instance/Class Thingies are grouped by similar characteristics. “Person” is a class “Janet” is an instance
UML: Class/Instance Person Name:String Height:Real Weight:Real Create(name:String,Height:Real,Weight:Real) Delete() Class Fred:Person Name = Frederick G. Williams Height = 2.1 Weight = 50 :Person Name = Frederick G. Williams Height = 2.1 Weight = 50 Named Person Instance Anonymous Person Instance
Concept 3: Attribute Characteristic of an object that defines a member of a class.
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.
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
Concept 6: Value Attributes can be assigned values. Properties can be assigned values.
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.
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.
Cardinality leftrightexample 11one-to-one person weight optional on one side one-to-one date of death person 0..* or * optional on both sides many-to- many person book 11..*one-to-many person language
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
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
Concept 11:Generalization Employee is a person. An Employee object has all the characteristics of a person, and then some.
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.
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.
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
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.
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.