UML Preview

Document Sample
UML Preview Powered By Docstoc
					UML Preview

CS6961 – Lecture 1

 Nathan Dykman
• Any questions before we move on?
• Note: There may be some scheduling
     – There are very few people in the 10:00
       section, and we are trying to balance the two
     – Stay tuned.

University of Utah      CS 6961 - Lecture 1            2
                     Buzzword Alert
• There’s lots of buzzwords and acronyms
  that appear when studying modeling and
• Keep an eye out for terms, etc. that you
  don’t know in the lectures and readings
     – And ask questions.

University of Utah       CS 6961 - Lecture 1   3
                     What We Covered
• The last lecture was a roadmap to what
  we will cover throughout the class
     – We will be learning about the UML language,
       and how to apply it in projects and larger-
       scale systems
           • With a focus on object and component models,
             both static and dynamic.
• Now, we move into the background behind
University of Utah         CS 6961 - Lecture 1              4
                     In This Lecture…
• We will explore UML in a bit more depth
• What we will look at:
     – History of UML
• Preview:
     – Sample Models
     – More UML Basics
     – Extensibility

University of Utah        CS 6961 - Lecture 1   5
                     UML: History
• When OO was evolving, multiple graphical
  notations existed for OO design methods
     – Booch, OMT, Objectory, Shaller-Mellor, CRC
     – This is not good. Standard notation good.
     – Lots of, err, “debate” in the area.
• Three creators of popular OO notations
  ended up at Rational Software (early 90s)
     – The Three Amigos: Booch, Rumbaugh
       (OMT), Jacobsen (Objectory)

University of Utah      CS 6961 - Lecture 1         6
                     UML: The History
• They came together to create what they
  termed the “Unified Modeling Language”
     – Created a initial version, 0.8 to 1.0 (mid 90s)
• Decided then to submit UML to OMG to
  standardize version 1.1
     – Big step forward. Many companies came
       together, contributed.
• Long, tough process (finished in 97).

University of Utah        CS 6961 - Lecture 1            7
             UML: Version 1.1 to 1.5
• The UML standard was refined and
  evolved somewhat in minor versions
     – UML 1.4 somewhat different from 1.1, for
       example. (97-2000)
• But, major issues remained to be
     – Now that there was experience with using it,
       there was feedback and ideas to be analyzed.

University of Utah    CS 6961 - Lecture 1         8
                     UML: Version 2.0
• Major revision of the standard was started
     – Major internal changes, fewer external
           • I was the HP representative in the UML 2.0
             standards work
     – UML 2.0 almost finished (editorial work)
     – Many UML 2.0 tools ready
• We will study version 2.0
     – Keeping on the cutting edge, after all.
University of Utah         CS 6961 - Lecture 1            9
                     UML In a Nutshell
• A standard notation for models (diagrams)
  for various aspects of software systems.
• Two major types of models:
     – Static Models
           • Use Case, Class, Composite Structure,
             Component, Deployment
     – Dynamic Models
           • Interaction (Sequence/Communication), State,

University of Utah         CS 6961 - Lecture 1              10
               UML: Under The Hood
• UML is described largely by a metamodel.
     – A model of a model. More on this later
• UML is extensible (Stereotypes, Profiles)
     – Refining existing concepts, adding new ones
       (lots of controversy on this point)
     – Extensibility in UML 2.0 a important issue
           • Some of my PhD work touches on this.

University of Utah         CS 6961 - Lecture 1       11
             Example Class Diagram
                                                              Class Name

                                                         Attributes (Fields)
                     + TopSpeed : int
                     + Go ( )
                     + Stop ( )


                                                                          - wheels     Wheel
                     - seats : int
                     + Start ( )
                                                                        - driver
                                                                           - passengers *

University of Utah                   CS 6961 - Lecture 1                                        12
                     Class Diagram
• This UML Diagram shows us that:
     – We have four classes, and their structure and
       relationships to each other.
• There are other features we don’t show,
  but you will read about
     – Template Classes, Interfaces, Association
     – Aggregation, Dependency, Realization
     – Chap. 3 UML-D, Chap. 9 UML-UG

University of Utah      CS 6961 - Lecture 1        13
              Example Sequence Diagram
sd Example

                                       StoreFront                         Warehouse                     Distributor   Shipper


  loop                 AddItemToCart

                                                             opt                      BackOrder(item)
                                                             [NoInventoryLeft]                                                  This is an interaction


                                                    This is a Message

                    This is a return

    University of Utah                                                   CS 6961 - Lecture 1                                                     14
                     Sequence Diagram
• Again, if we know UML notation, we now
  this is a interaction of class instances
     – We will go into more detail into what this
       diagram means later.
• But, the idea is that it gets an idea across
     – In this case, a sequence of messages
       between entities.
     – Chapter 4 in UML-D, Chap. 16 in UML-UG

University of Utah        CS 6961 - Lecture 1       15
          Example Activity Diagram
                     ad Example


                                             Start Car

                                                       [GasLight Is On]
                                                                                Get Gas

                                           Driv e To Work

                                              Park Car

                           Drink Coffee                        Walk To Office


University of Utah                        CS 6961 - Lecture 1                             16
                     Activity Diagram
• Again, if we know UML, we know we have
  an set of activities, and how they relate to
  each other
     – Activity Diagrams are good way of showing
       flow of various things
• Again, we will learn lots more about
  activity diagrams later on.

University of Utah       CS 6961 - Lecture 1       17
              About These Examples
• These are commonly used diagrams
     – Component Diagrams common, but much like
       Class Diagrams
• For most, the easiest to “grasp” at first.
     – Oddly, Sequence and Activity Diagrams are
       some of the most complex models in UML
           • State Diagrams quite complex as well.

University of Utah         CS 6961 - Lecture 1       18
                     The Core of UML
• The main features of UML:
     – It provides a standard set of elements
           • With a standard, graphical syntax.
     – It defines how those element can relate to
       other elements (in a strict manner)
     – The elements have a semantic meaning that
       is often useful to software designers
     – It allows for elements to be extended and for
       new elements to be added (Extensibility)
University of Utah          CS 6961 - Lecture 1        19
                     UML: Extensibility
• An important part of UML is extensibility
     – The ability to specialize certain elements via
       “stereotyping” (Lightweight extension)
     – The ability to add new elements via
       “metamodeling” (Heavyweight extension)
• Example follows

University of Utah        CS 6961 - Lecture 1           20
           UML Extensibility Example


Customer                                            StoreItem

 University of Utah                CS 6961 - Lecture 1                21
• We have three stereotypes of a class here
     – Boundary: Used as a interface for users
     – Entity: A persistent piece of information
     – Control: Logic that mediates other classes
• We can attach additional data and
  constraints to stereotypes
     – For example, we could say that Boundary
       classes can not be associated with Entity
       Classes, if we wanted.

University of Utah      CS 6961 - Lecture 1         22
                     UML Stereotypes
• Stereotypes are best thought of as
  “decorators” that extend the meaning of a
  standard element
     – They indicate that the element has additional
       (but compatible) semantic meaning
     – A <<boundary>> class is a special kind of
       UML class.

University of Utah       CS 6961 - Lecture 1           23
                     UML Stereotypes
• UML 2.0 changed the nature of
  extensibility a great deal
     – This was my main battleground in the UML
       2.0 standard efforts
• But the concept is still supported about the
  same in most tools
     – With some variations.
     – Opinion: Extensibility in tools should improve
       with UML 2.0

University of Utah       CS 6961 - Lecture 1            24
             UML and Formal Usage
• We will strive to use UML as correctly
  (formally) as possible.
     – However, informal usage is just as important
• Be aware that UML is used in lots of
  domains, each with their own set of
     – UML models in hard-time systems are much
       different than OO models we will be covering.

University of Utah    CS 6961 - Lecture 1             25
                     What To Take Away
• This is to give you a taste of what UML is
  and supports.
     – We cover what we introduced here in much
       more depth as the class goes on.
• For now, note:
     – UML has Static and Dynamic Models
     – What is the “core” of UML (Slide 19)
     – UML is extensible.

University of Utah        CS 6961 - Lecture 1     26
                     Next Time…
• We will cover the basic UML concepts and
  conventions, and how they apply to simple
  class diagrams
     – This will get us started on covering UML static
       modeling in more depth.
• Tool demonstration
     – Rational Software Modeler.

University of Utah     CS 6961 - Lecture 1           27

Shared By: