uml (unified modeling language) -...

34
UML (Unified Modeling Language)

Upload: hoangdan

Post on 23-Mar-2019

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

UML

(Unified Modeling Language)

Page 2: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

What is UML?

UML stands for Unified Modeling Language.

This object-oriented system of notation has evolved from the work of Grady Booch, James Rumbaugh, Ivar Jacobson, and the Rational Software Corporation.

These renowned computer scientists fused their respective technologies into a single, standardized model.

Today, UML is accepted by the Object Management Group (OMG) as the standard for modeling object oriented programs.

Andi Sunyoto, M.Kom 2

Page 3: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Types of UML Diagrams

UML defines nine types of diagrams:

class (package),

object,

use case,

sequence,

collaboration,

statechart,

activity,

component, and

deployment.

Andi Sunyoto, M.Kom 3

Page 4: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

USE CASE DIAGRAM

Andi Sunyoto, M.Kom 4

Page 5: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

What is a UML Use Case Diagram?

The use case model captures the requirements of a system.

Use cases are services or functions provided by the system to its users.

A use case is a set of scenarios that describing an interaction between a user and a system.

Use case diagrams model the functionality of a system using actors and use cases.

Andi Sunyoto, M.Kom 5

Page 6: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

The two main components of a use case diagram are use cases and actors.

An actor is represents a user or another system that will interact with the system you are modeling.

A use case is an external view of the system that represents some action the user might perform in order to complete a task.

Andi Sunyoto, M.Kom 6

Page 7: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

System

Draw your system's boundaries using a rectangle that contains use cases. Place actors outside the system's boundaries.

Andi Sunyoto, M.Kom 7

Page 8: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Use Case Symbol

Use Case

Draw use cases using ovals. Label with ovals with verbs that represent the system's functions.

Andi Sunyoto, M.Kom 8

Page 9: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Actors

Actors are the users of a system.

When one system is the actor of another system, label the actor system with the actor stereotype.

Andi Sunyoto, M.Kom 9

Page 10: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Relationships

Illustrate relationships between an actor and a use case with a simple line. For relationships among use cases, use arrows labeled either "uses" or "extends." A "uses" relationship indicates that one use case is needed by another in order to perform a task. An "extends" relationship indicates alternative options under a certain use case.

Andi Sunyoto, M.Kom 10

Page 11: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Tipe relationship

Associations

Includes

Generalization

Extends

Andi Sunyoto, M.Kom 11

Page 12: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Associations

On a use case diagram, associations are drawn between actors and use cases to show that an actor carries out a use case.

A use case can be carried out by many actors and an actor may carry out many use cases.

In the above diagram, the actors are shown as the green stick figure shapes on the left, the use cases are the blue ellipses, and the associations between them are represented by the connecting lines.

The developer and the stakeholder both are responsible for specifying the system roles, but only the developer creates the model.

Andi Sunyoto, M.Kom 12

Page 13: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Includes

Within an include relationship, one use case explicitly includes the behavior of another use case at a specified point within a course of action.

The included use case doesn't stand alone; it has to be connected with one or more base use cases. The include mechanism is very useful for factoring out behavior that would otherwise appear within multiple use cases.

Andi Sunyoto, M.Kom 13

Page 14: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Within Figure, the Add to Wish List and Check Out use cases include the behavior captured within the Log In use case, because a Customer must be logged in before he or she can add a book to a wish list or make a purchase.

Andi Sunyoto, M.Kom 14

Page 15: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Generalization

Generalization refers to a relationship between a general case and a more specific version.

Generalization is used to express some high-level functional need of a system without going into specifics. Specializations of a general use case introduce specific functionality.

Figure shows use cases that describe three different searches that a Customer can perform, all of which use the basic search technique defined by the Perform Search use case.

Andi Sunyoto, M.Kom 15

Page 16: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Extends

Within an extend relationship, a base use case implicitly includes the behavior of another use case at one or more specified points. These points are called extension points.

You generally use this construct to factor out behavior that's optional or that occurs only under certain conditions. One way to use extends is in creating a new use case in response to an alternate course of action having several steps associated with it.

Figure shows that a Customer has the option of canceling an Order in conjunction with checking the status of that Order.

Andi Sunyoto, M.Kom 16

Page 17: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Use Case #1

Andi Sunyoto, M.Kom 17

Page 18: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Use Case #2

Andi Sunyoto, M.Kom 18

Page 19: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Use Case #3

Andi Sunyoto, M.Kom 19

Page 20: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Use Case #4

Andi Sunyoto, M.Kom 20

Page 21: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Use Case #5

Andi Sunyoto, M.Kom 21

Page 23: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

CLASS DIAGRAM

Andi Sunyoto, M.Kom 23

Page 24: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

What is Class Diagram ?

The class diagram is core to object-oriented design.

It describes the types of objects in the system and the static relationships between them.

Illustrate classes with rectangles divided into compartments.

Place the name of the class in the first partition (centered, bolded, and capitalized), list the attributes in the second partition, and write operations into the third.

Andi Sunyoto, M.Kom 24

Page 25: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Sample Class Diagram

Classes are divided into three sections: Top: The name, package and stereotype are shown in the upper

section of the class. You can optionally assign a stereotype to a class.

Centre: The centre section contains the attributes of the class.

Bottom: In the lower section are the operations that can be performed on the class.

Andi Sunyoto, M.Kom 25

Page 26: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Attributes

An attribute is a property of a class. In the example above, we are told that a Contact has an address, a city, a province, a country and a postal code.

The format for attributes is:

visibility name: type = defaultValue

The visibility is as follows:

- Private : Private visibility hides information from anything outside the class partition.

+ Public : Public visibility allows all other classes to view the marked information.

# Protected : Protected visibility allows child classes to access information they inherited from a parent class.

Andi Sunyoto, M.Kom 26

Page 27: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

In object oriented design, it is generally preferred to keep most attributes private as the accessor methods allow you to control access to the data.

The most common exception to this preference are constants.

Andi Sunyoto, M.Kom 27

Page 28: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Operation

The operations listed in a class represent the functions or tasks that can be performed on the data in the class.

In the List class, there is one attribute (a private array of Objects) and three operations.

Andi Sunyoto, M.Kom 28

Page 29: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

The format for operations is:

visibility name (parameters): type

The format is very similar to that of the attribute except with the removal of a default value and the addition of parameters.

Parameters take the format:

direction name: type = default value

Andi Sunyoto, M.Kom 29

Page 30: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Class Relationship

Class diagrams also display relationships:

inheritance,

associations and others.2

Below is an example of an associative relationship:

Andi Sunyoto, M.Kom 30

Page 31: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

The association relationship is the most common relationship in a class diagram.

The association shows the relationship between instances of classes.

For example, the class Order is associated with the class Customer.

The multiplicity of the association denotes the number of objects that can participate in then relationship.

For example, an Order object can be associated to only one customer, but a customer can be associated to many orders.

Andi Sunyoto, M.Kom 31

Page 32: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Generalization

A generalization is used when two classes are similar, but have some differences. Look at the generalization below:

Andi Sunyoto, M.Kom 32

Page 33: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Contoh Class Diagram

Andi Sunyoto, M.Kom 33

Page 34: UML (Unified Modeling Language) - E-Learningelearning.amikom.ac.id/index.php/download/materi/190302052-ST063-76... · UML stands for Unified Modeling Language. This object-oriented

Andi Sunyoto, M.Kom 34