1 - Giới Thiệu UML

  • Upload
    kity09

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

  • 8/13/2019 1 - Gii Thiu UML

    1/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    1

    1. What is UML?

    3. The Origins Of UML

    4. The components of UML5. Object Oriented paradigm

    2. Modelling Concepts

  • 8/13/2019 1 - Gii Thiu UML

    2/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    2

    1. What is UML?

    TheUnified Modeling Language (UML) is a language forspecifying, visualizing, constructing, and documenting the

    artifacts of software systems, as well as for business

    modeling and other non-software systems.

    OMG UML Specification

    UML is a graphical notation for modeling various aspects

    of software systems.

    William H. Mitchell

  • 8/13/2019 1 - Gii Thiu UML

    3/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    3

    2. Modelling Concepts2.1. What is a Model?2.2. What is a Diagram?2.3. Model vs Diagram2.4. Model in UML2.5. Why use UML?

  • 8/13/2019 1 - Gii Thiu UML

    4/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    4

    2.1 What is a Model?A model is an abstract representation of something real

    or imaginary. Like maps, models represent something

    else. They are useful in several different ways, precisely

    because they differ from the things that they represent.

    A model is quicker and easier to build A model can be used in simulations, to learn more about the

    thing it represents

    A model can evolve as we learn more about a task or problem

    We can choose which details to represent in a model, and whichto ignore A model is an abstraction

    A model can represent real or imaginary things from any

    domain

  • 8/13/2019 1 - Gii Thiu UML

    5/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    5

    2.2. What is a Diagram?A diagram is a visual repesentation of some part of a

    model. Analyst and designers use diagrams to illustrate

    models of systems in the same way as architects use

    drawing and diagrams to model buildings. Diagrammatic

    models are used extensively by systems analyst anddesigners in order to:

    Communicate ideas

    Generate new ideas and possibilities

    Test ideas and make predictions Understand structures and relationships

  • 8/13/2019 1 - Gii Thiu UML

    6/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    6

    2.3. Model vs DiagramMost models consist of many diagrams because it is

    necessary to simplify complex systems to a level that

    people can understand and take in.

    (ex: The class libraries for Java are made up of hundreds classes,

    but books that present information about these classes rarelyshow more than about twenty on any one diagram, and each

    diagram groups together classes that are conceptually related).

    A single diagram can illustrate or document someaspect of a system. However, a model provides a

    complete view of a system at a particular stage and from

    a particular perspective.

  • 8/13/2019 1 - Gii Thiu UML

    7/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    7

    2.4 Model in UMLA model captures a view of a physical system. It is an

    abstraction of the physical system, with a certain

    purpose. This purpose determines what is to be

    included in the model and what is irrelevant. Thus the

    model completely describes those aspects of thephysical system that are relevant to the purpose of the

    model, at the relevant level of detail.

  • 8/13/2019 1 - Gii Thiu UML

    8/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    8

    2.5 Why use UML?Why use a graphical notation of any sort?

    Facilitates construction of models that in turn can be

    used to:

    Reason about system behavior

    Present proposed designs to others Document key elements of design for future

    understanding

  • 8/13/2019 1 - Gii Thiu UML

    9/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    9

    2.5 Why use UML?Which graphical notation should be used?

    UML has become the standard for modeling object

    oriented systems.

    UML is extensible and method-independent.

    UML is not perfect, but it's good enough.

  • 8/13/2019 1 - Gii Thiu UML

    10/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    10

    3. The Origins Of UML

  • 8/13/2019 1 - Gii Thiu UML

    11/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    11

    3. The Origins Of UML

    UML has been evolving since the second half of the1990s and has its roots in the object-oriented methods

    developed in the late 1980s and early 1990s.

    Before UML 1.x (~1995~1997)UML 1.x (~1997~2003)

    UML 2.x (~2003~2012)

  • 8/13/2019 1 - Gii Thiu UML

    12/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    12

    3. The Origins Of UMLBefore UML 1.x (~1995~1997)

    Three OOA/D gurus, and their methods, rose to prominence

    Grady Booch The Booch Method

    James Rumbaugh, et al. Object Modeling Technique

    Ivar Jacsobson Objectory

    In 1994, Booch and Rumbaugh, then both at Rational, started

    working on a unification of their methods. A first draft of their

    Unified Method was released in October 1995.

    In 1996, (+/-) Jacobson joined Booch and Rumbaugh at

    Rational; the name UML was coined. In 1997 the Object Management Group (OMG) accepted UML

    as an open and industry standard visual modeling language for

    objectoriented systems. UML 1.1

  • 8/13/2019 1 - Gii Thiu UML

    13/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    13

    3. The Origins Of UMLUML 1.x (~1997~2003)

    The Unified Modeling Language is an international standard:

    ISO/IEC 19501:2005 Information technologyOpen Distributed

    ProcessingUnified Modeling Language (UML) Version 1.4.2

  • 8/13/2019 1 - Gii Thiu UML

    14/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    14

    3. The Origins Of UMLUML 2.x (~2003~2012) UML has matured significantly since UML 1.1. Several minor

    revisions (UML 1.3, 1.4, and 1.5) fixed shortcomings and

    bugs with the first version of UML, followed by the UML 2.0

    major revision that was adopted by the OMG in 2005.

    Although UML 2.1 was never released as a formal

    specification, versions 2.1.1 and 2.1.2 appeared in 2007,

    followed by UML 2.2 in February 2009. UML 2.3 was formally

    released in May 2010.

    UML 2.4.1 was formally released inAugust 2011.UML 2.5 was released in October 2012 as an "In

    process" version and has yet to become formally released.

  • 8/13/2019 1 - Gii Thiu UML

    15/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    15

    3. The Origins Of UMLUML 2.x (~2003~2012)

    There are four parts to the UML 2.x specification:

    1. The Superstructure that defines the notation and semantics for

    diagrams and their model elements

    2. The Infrastructure that defines the core metamodel on which

    the Superstructure is based

    3. The Object Constraint Language (OCL) for defining rules for

    model elements

    4. The UML Diagram Interchange that defines how UML 2

    diagram layouts are exchangedThe current versions of these standards follow:

    UML Superstructure version 2.4.1, UML Infrastructure version

    2.4.1, OCL version 2.3.1, and UML Diagram Interchange version 1.0.

  • 8/13/2019 1 - Gii Thiu UML

    16/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    16

    4. The components of UML4.1. View4.2. Diagram4.3. Model element4.4. General Mechanism

  • 8/13/2019 1 - Gii Thiu UML

    17/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    17

    4.1. View4+1 View

  • 8/13/2019 1 - Gii Thiu UML

    18/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    18

    4.2. DiagramUse Case Diagram1

    Class Diagram2

    Object Diagram3

    State Diagram4

    Collaboration Diagram6

    Activity Diagram7

    Component Diagram8

    Deployment Diagram9

    Sequence Diagram5

  • 8/13/2019 1 - Gii Thiu UML

    19/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    19

    4.2. Diagram Use Case Diagram1

    Shows actors, use-cases, and the relationshipsbetween them.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    20/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    20

    4.2. Diagram Class Diagram2 Shows relationships

    between classes and

    pertinent information

    about classes themselves.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    21/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    21

    4.2. Diagram Object Diagram3

    Shows a configuration of objects at an instant in time.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    22/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    22

    4.2. Diagram State Diagram4

    Describes behavior of instances of a class in terms ofstates, stimuli, and transitions.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    23/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    23

    4.2. Diagram Sequence Diagram5

    A sequence diagramis a kind of interaction diagramthat shows how processes operate with one another

    and in what order.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    24/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    24

    4.2. Diagram Collaboration Diagram6 A collaboration diagram describes interactions among

    objects in terms of sequenced messages. Collaboration

    diagrams represent a combination of information

    taken from class, sequence, and use case diagrams

    describing both the static structure and dynamicbehavior of a system.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    25/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    25

    4.2. Diagram Activity Diagram7 Activity diagrams are graphical representations

    of workflows of stepwise activities and actions with

    support for choice, iteration and concurrency. In

    the UML, activity diagrams can be used to describe

    the business and operational step-by-step workflowsof components in a system. An activity diagram

    shows the overall flow of control.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    26/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    26

    4.2. Diagram Component Diagram8 A component diagram depicts how components are

    wired together to form larger components and

    or software systems. They are used to illustrate the

    structure of arbitrarily complex systems.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    27/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    27

    4.2. Diagram Deployment Diagram9 Shows configuration of hardware and software in a

    distributed system.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    28/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    28

    4.2. Diagram Deployment Diagram9

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    29/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    29

    4.3. Model element

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    30/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

    30

    4.3. Model element Diagrams are built from model elements

    A model element: semantic+ symbol

    A model element can exist in many different diagram

    types, according to the rules determine the type of

    elements are used in the diagram.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    31/50

    31

    4.3. Model element Association

    The link of the elements

    An association is a relationship between two classifiers,

    such as classes or use cases, that describes the reasons

    for the relationship and the rules that govern therelationship.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    32/50

    32

    4.3. Model element Generalization

    A generalization relationship is a relationship in

    which one model element (the child) is based on

    another model element (the parent). Generalization

    relationships are used in class, component,deployment, and use case diagrams.

    To comply with UML semantics, the model elements

    in a generalization relationship must be the sametype. For example, a generalization relationship can be

    used between actors or between use cases; however,

    it cannot be used between an actor and a use case.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    33/50

    33

    4.3. Model element Generalization

    Single parent with a single child Single parent with multiple children

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    34/50

    34

    4.3. Model element Generalization

    The following figure illustrates an e-commerce

    application for a Web site that sells a variety of

    merchandise. The application has an InventoryItem

    class that is a parent class (also called a superclass).This class contains the attributes, such as Price, and

    operations, such as setPrice, that all pieces of

    merchandise use.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    35/50

    35

    4.3. Model element Dependency

    A dependency relationship is a relationship in which

    changes to one model element (the supplier) impact

    another model element (the client). You can use

    dependency relationships in class diagrams,component diagrams, deployment diagrams, and use

    case diagrams.

    Dependency relationships usually do not have names.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    36/50

    36

    4.3. Model element Dependency

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    37/50

    37

    4.3. Model element Aggregation

    An aggregation relationship depicts a classifier as a part

    of, or as subordinate to, another classifier.

    Aggregation relationships do not have to be unidirectional.

    You can name any association to describe the nature of

    the relationship between two classifiers; however, names

    are unnecessary if you use association end names.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    38/50

    38

    4.3. Model element Aggregation

    Data flows from the whole classifier (the aggregate) to the

    part. A part classifier can belong to more than one

    aggregate classifier and it can exist independently of the

    aggregate. For example, a Departmentclass can have anaggregation relationship with a Companyclass, which

    indicates that the department is part of the company.

    Aggregation is closely related to composition.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    39/50

    39

    4.4. General MechanismAdornment

    Note

    Specification

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    40/50

    40

    5. Object Oriented paradigm

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    41/50

    41

    5. Object Oriented paradigm Object-Oriented Paradigm is where we focus real life

    objects while programming any solution. By focusing

    real life objects we mean that over solutions

    revolves around different objects, which represent

    respective objects in real life situation. Mains benefits of Object-Oriented Programming:

    Maintainable

    Reusable Scalable

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    42/50

    42

    5. Object Oriented paradigm

    MaintainableObject-Oriented Paradigm methods make code

    more maintainable. Identifying the source of errors

    becomes easier because objects are self-contained. The

    principles of good methods design contribute to asystemsmaintainability.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    43/50

    43

    5. Object Oriented paradigm Reusable

    Since objects contain both data and functions

    that act on data, objects can be thought of as self-

    contained boxes. This makes it easy to reuse code in

    new systems.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    44/50

    44

    5. Object Oriented paradigm Scalable

    Object-Oriented applications are more scalable

    then their structured programming roots. As an

    objects interface provides a roadmap for reusing an

    object, it also provides you with all the information you

    need to replace the object without affecting others.

    This makes it easy to replace old and inefficient code

    with faster algorithms.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    45/50

    45

    5. Object Oriented paradigmThe 4 main characteristic of Object-Oriented Paradigm:

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    46/50

    46

    5. Object Oriented paradigmAbstraction:

    Abstraction is an emphasis on the idea, qualities

    and properties rather than the particulars (a

    suppression of detail). The importance of abstraction is

    derived from its ability to hide irrelevant details andfrom the use of names to reference objects. Abstraction

    is essential in the construction of programs. It places

    the emphasis on what an object is or does rather than

    how it is represented or how it works. Thus, it is theprimary means of managing complexity in large

    programs.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    47/50

    47

    5. Object Oriented paradigmEncapsulation:

    The encapsulation is the inclusion within a program

    object of all the resources need for the object to

    function - basically, the methods and the data.

    That idea of encapsulation is to hide how a class doesit but to allow requesting what to do.

  • 8/13/2019 1 - Gii Thiu UML

    48/50

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    49/50

    49

    5. Object Oriented paradigmPolymorphism:

    Polymorphisms is a generic term that means 'many

    shapes'. More precisely Polymorphisms means the

    ability to request that the same operations be

    performed by a wide range of different types of things.

    DONG NAI UNIVERSITY OF TECHNOLOGY

  • 8/13/2019 1 - Gii Thiu UML

    50/50

    END