34
What is UML Unified Modeling Language A language for modelling software systems from requirements to specification The goal is to become a common language for creating models of object oriented computer software

What is UML - Marmara œniversitesi Biliim Merkezi

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: What is UML - Marmara œniversitesi Biliim Merkezi

What is UML• Unified Modeling Language

• A language for modelling software systems from requirements to specification

• The goal is to become a common language for creating models of object oriented computer software

Page 2: What is UML - Marmara œniversitesi Biliim Merkezi

Benefits of UML• You know exactly what you are getting• You will have lower development costs• Your software will behave as you expect it to. Fewer surprises• The right decisions are made before you are given poorly

written code. Less overall costs• We can develop more memory and processor efficient

systems• System maintenance costs will be lower. Less relearning

takes place• Working with a new developer will be easier.• Communication with programmers and outside contractors

will be more efficient

Page 3: What is UML - Marmara œniversitesi Biliim Merkezi

Types of UML Diagrams• Use Case Diagram

– Description of a system’s behavior from a user’s point of view

• Class Diagram– Models class structure and contents using design

elements such as classes, packages, and objects– Displays relationships such as containment and

inheritance

Page 4: What is UML - Marmara œniversitesi Biliim Merkezi

Types of UML Diagrams• Sequence Diagram

– Shows the time-based dynamics of the interaction between objects

– Two dimensions; time and different objects• Collaboration Diagram

– Displays the interaction organized around the objects and their links to one another

– Numbers are used to show the sequence of messages

Page 5: What is UML - Marmara œniversitesi Biliim Merkezi

Types of UML Diagrams• State Diagram

– Displays the sequences of states that an object of an interaction goes through during its life in response to received stimuli

• Activity Diagram– Displays a special state diagram where most of

the states are action states and most of the transitions are triggered by completion of the actions in the source states

– Like a flowchart

Page 6: What is UML - Marmara œniversitesi Biliim Merkezi

Types of UML Diagrams• Component Diagram

– Displays the high level packaged structure of the code itself

– Dependencies among components are shown, including source code, binary code, and executable components

• Deployment Diagram– Displays the configuration of run-time processing

elements and the software components, processes, and objects that live on them

Page 7: What is UML - Marmara œniversitesi Biliim Merkezi

Use Case Diagrams• Use case diagrams show how a system’s

users interact with it– i.e. the system’s requirements

• Use case diagrams represent:– Actors: things (often people) outside the system

that interact with it– Use cases: tasks the system supports– Associations between the two

Page 8: What is UML - Marmara œniversitesi Biliim Merkezi

Use Case Diagram Example

Page 9: What is UML - Marmara œniversitesi Biliim Merkezi

Use Case Diagrams• Used in almost every project

• Helpful in exposing requirements analysis and planning the project

• During the initial stage of a project most use cases should be defined, but as the project continues more might become visible

Page 10: What is UML - Marmara œniversitesi Biliim Merkezi

Use Case Diagram Example

Page 11: What is UML - Marmara œniversitesi Biliim Merkezi
Page 12: What is UML - Marmara œniversitesi Biliim Merkezi

• Widely used to describe the types of objects in a system and their relationships

• Model class structure and contents using design elements such as classes, packages and objects

• Describe three different perspectives when designing a system; conceptual, specification, and implementation

Class Diagrams

Page 13: What is UML - Marmara œniversitesi Biliim Merkezi

Class Diagrams• Classes are composed of three components:

Page 14: What is UML - Marmara œniversitesi Biliim Merkezi

Class Diagrams• Used in nearly all Object Oriented software

designs

• Used to descibe the classes of the system and their relationships to each other

Page 15: What is UML - Marmara œniversitesi Biliim Merkezi

Class Diagrams• Relationships

Between Classes– Inheritance

– Composition

– Associaton

Circle Point

Student Address

Page 16: What is UML - Marmara œniversitesi Biliim Merkezi

Class Diagram Example

Page 17: What is UML - Marmara œniversitesi Biliim Merkezi

Class Diagram Example

Page 18: What is UML - Marmara œniversitesi Biliim Merkezi

• Use of templates, interfaces, and types

• Can even specify body of methods

Class Diagrams

Page 19: What is UML - Marmara œniversitesi Biliim Merkezi

Sequence Diagrams• Dynamic model view

• Details how operation are carried out, what messages are sent and when

• Two dimensions:– Time– Objects

Page 20: What is UML - Marmara œniversitesi Biliim Merkezi

Sequence Diagram Example

Page 21: What is UML - Marmara œniversitesi Biliim Merkezi

Example Sequence Diagram

Page 22: What is UML - Marmara œniversitesi Biliim Merkezi

Collaboration Diagrams• Give the same information as sequence

diagrams but they focus on object roles instead of the times that messages are sent

• Object roles are vertices and messages are the connecting links

• Each message has a sequence number

Page 23: What is UML - Marmara œniversitesi Biliim Merkezi

Collaboration Diagram Example

Page 24: What is UML - Marmara œniversitesi Biliim Merkezi

State Diagrams• Shows the possible states of the object and

the transitions that cause a change in state

• Initial state is a dummy to start the action

• Final states are also dummy states that terminate the action

Page 25: What is UML - Marmara œniversitesi Biliim Merkezi

State Diagram Example

Page 26: What is UML - Marmara œniversitesi Biliim Merkezi

Example State Diagram

Page 27: What is UML - Marmara œniversitesi Biliim Merkezi

Activity Diagrams• Similar to state diagrams

– Activity diagram focuses on the flow of activities involved in a single process

– State diagram focuses attention on an object undergoing a process

• Is essentialy a fancy flowchart

Page 28: What is UML - Marmara œniversitesi Biliim Merkezi

Activity Diagram Example

Page 29: What is UML - Marmara œniversitesi Biliim Merkezi

UML in Real Practice• You don't typically use all the diagrams

– You'll choose between them based on preference and particular situation

• You typically use many diagrams– A single use case may not capture all scenarios– If you are going to use statecharts, there are probably lots

of objects with states– Each sequence/collaboration diagram only shows one

interaction

Page 30: What is UML - Marmara œniversitesi Biliim Merkezi

Example: Student Registration System

• Not going to do all the diagrams– Not all types, not even all that completely specify

the system• But this is an application you know, so the

examples may help make sense

Page 31: What is UML - Marmara œniversitesi Biliim Merkezi

Student Registration Class Diagram

*

prereqs

0..30..30..3

prereqs

0..30..30..3

Course

namenumberdepartmentcreditHoursprerequisites

1

*****1

CourseGrade

coursegradetermEnrolled

Transcript

courseGrades

gradeForCourse:takenCourse:

1 ***

1

******

1..3 ******

*

111111

Department

coursesrequiredCourses

111Student

transcriptmajor

enrollInClass:gradeInCourse:takenCourse:

SectionSection

coursedaysAndTimedaysAndTimeroster

addStudentaddStudent

removeStudentremoveStudent **

1** sectionssections

Registrar

courses

getSectionsFor:getSectionsFor:

enrollInSection:enrollInSection:

dropFromSection:dropFromSection:

schedulescheduleregistrarregistrar

1**

1

Page 32: What is UML - Marmara œniversitesi Biliim Merkezi

Partial Use Case Diagram

Withdrawfrom a Course

Apply forAdmission

Student

Enroll inthe University

Enroll ina Course

Admissions

Page 33: What is UML - Marmara œniversitesi Biliim Merkezi

States of a Student

EnrollInClass ( Add a Transcript )

EnrolledApply [ Must be accepted first ]

Graduate [ All courses must be completed ]

AddCourseRegisteredWithdraw

Page 34: What is UML - Marmara œniversitesi Biliim Merkezi

Sequence Diagram: Registering for Course

theRegistrar aSection theTranscriptaStudent

state of prereqhave prereq

enrolled

enrollInSection:

return sections

getSectionsFor:

addStudent:

enrolled

takenCourse: prerequisite

takenCourse: prerequisite