Top Banner
SYSTEM MODELING AND THE UNIFIED MODELING LANGUAGE (UML) CS 360 Lecture 6
27

CS 360 Lecture 6. A model is a simplification of reality We build models to better understand the system being developed. We build models of complex.

Dec 30, 2015

Download

Documents

Lee Dalton
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SYSTEM MODELING AND THE UNIFIED MODELING LANGUAGE (UML)CS 360

Lecture 6

Page 2: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

MODELS FOR REQUIREMENTS ANALYSIS AND SPECIFICATIONA model is a simplification of reality

We build models to better understand the system being developed.

We build models of complex systems because we cannot comprehend such a system in its entirety.

Models can be formal or informal.The more complex a project becomes, the more valuable a formal model becomes.

2

Page 3: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

PRINCIPLES OF SOFTWARE MODELINGUML “Unified Modeling Language”

Expresses an idea, not detailed description on functionality. Used to describe a software system at a high level of abstraction.

Serves as a bridge between the requirements specifications and the implementation.

Is process and programming language independent. An industry-standard process for specifying, visualizing, constructing, and documenting information about software systems.

Simplifies the complex process of software design.3

Page 4: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

MODELS: DIAGRAMS AND DOCUMENTATION IN UML In UML, a model consists of a diagram and documentation. A diagram is the graphical representation of a set of elements representing components of the software system.

Each diagram is supported by technical documentation that specifies the components represented.

A diagram without documentation is of little value.

4

Page 5: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

UML: USE OF GRAPHICAL MODELSMeans of discussion about an existing or proposed system

Way of documenting an existing system Models should be an accurate representation of the system but need not be complete.

Detailed system description that can be used to generate a system implementation Models have to be both correct and complete.

5

Page 6: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

TYPES OF UML DIAGRAMSUse Case Diagrams

Interactions between a system and its environmentClass Diagrams

Shows the object classes in the system and the associations between those classes

Sequence Diagrams Interactions between actors and the system, and between system components

State DiagramsShows how the system reacts to internal and external events

6

Page 7: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

USE CASE DIAGRAMS (DOCUMENTATION)A use case is a model of the interaction between

External users of a software product (actors) and The software product itself

describes a set of scenarioscaptures user requirementscontract between client and software developers

7

Page 8: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

USE CASE DIAGRAMSActors:

A role that a user plays with respect to the system.

Use case: A set of scenarios that describing an interaction between a user and a system.

System boundary: rectangle diagram representing the boundary between the actors and the system. 8

Page 9: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

USE CASE DIAGRAMS (LIBRARY)

9

Library System

Borrow

Order Title

Fine

ClientEmployee

Supervisor

BoundaryActor

Use Case

Page 10: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

USE CASE DIAGRAMS (FLIGHT CHECK-IN)

10

BoundaryActor

Use Case

Page 11: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

CLASS DIAGRAMS (DOCUMENTATION)A class diagram depicts classes and their interrelationshipsUsed for describing structure and behavior in the use cases

Used for requirement capture, end-user interactionDetailed class diagrams are used for developers

Used for communicating software connections/requirements

11

Page 12: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

CLASS DIAGRAMSEach class is represented by a rectangle subdivided into three compartments Name Attributes Operations

Modifiers are used to indicate visibility of attributes and operations. ‘+’ is used to denote Public visibility ‘#’ is used to denote Protected visibility ‘-’ is used to denote Private visibility

By default, attributes are hidden and operations are visible.12

Page 13: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

CLASS DIAGRAMS (BANK ACCOUNT)

13

Account_Name

- Customer_Name- Balance

+addFunds( )+withDraw( )+transfer( )

Attributes

Operations

Class Name

Page 14: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

CLASS DIAGRAMS (SHAPES)

14

Operations

Class Name

Attributes

Page 15: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

CLASS DIAGRAMS

15

Subtype2

Supertype

Subtype1

• Inheritance is a required feature of object orientation

• Promotes code reuse and flexability

Regular Customer

Loyalty Customer

Customer Example:

Page 16: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SEQUENCE DIAGRAMS (DOCUMENTATION)Sequence diagrams

Used to model the interactions between the actors and the objects within a system.

Shows interactions of specific use cases.Objects and actors are listed along the top of the diagram, with a dotted line drawn vertically from these. Interactions between objects are indicated by arrows.

16

Page 17: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SEQUENCE DIAGRAMSUsed to model the interactions between the actors and the objects within a system.Shows the sequence of interactions that take place during a particular use case.

Example:User making a phone call

17

Page 18: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SEQUENCE DIAGRAMS (TELEPHONE CALL)

18

Caller Phone Recipient

Picks up

Dial tone

Dial

Ring notification Ring

Picks up

Hello

Page 19: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SEQUENCE DIAGRAMS (BOOKING WEBSITE)

19

Page 20: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

STATE DIAGRAMS (DOCUMENTATION)Models the behavior of the system in response to external and internal events.

Shows the system’s responses to stimulioften used for modelling real-time systems.

Shows states as nodes, and events as edges between these nodes. When an event occurs, the system moves from one state to another.

20

Page 21: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

STATE DIAGRAMS (BILLING EXAMPLE)State Diagrams show the sequences of states an object goes through during its life cycleabstraction of all possible behaviors

21

Unpaid

Start End

Paid

Invoice created

paying

Invoice destroying

Page 22: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

STATE DIAGRAMS (TRAFFIC LIGHT EXAMPLE)

22

Yellow

Red

Green

Traffic LightState

Transition

Event

Start

Page 23: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

UML DIAGRAMSUML is a standardized specification language for object modeling

Several UML diagrams:Use-case diagram: models the interaction between actors and software

Class diagram: a model of classes showing the static relationships among them.

Sequence diagram: shows the way objects interact with one another as messages are passed between them.

State diagram: shows states, events that cause transitions between states.

23

Page 24: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

MODELING TOOLS: PSEUDO-CODE An informal modeling technique to show the logic behind part of a system.

Example: University Admission Decision adminDecision (application)

if application.SAT == null then error (incomplete) if application.SAT > S1 then accept(application) else if application.GPA > G1 then accept(application) else if application.SAT > S2 and application.GPA > G2

then accept(application) else reject(application)

Pseudo-code can be informal, or a standard used by a software development organization, or based on a regular programming language.

What matters is that its interpretation is understood by everybody involved.

24

Page 25: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

PROTOTYPING REQUIREMENTSRapid prototyping is the most comprehensive of all modeling methodsSpecifying requirements by building a system that demonstrates the functionality of key parts of the required system

Particularly valuable for user interfaces

25

Page 26: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

REQUIREMENTS DEFINITION: DATA DICTIONARYA data dictionary is a list of names used by the system

Name (e.g., "start date") Brief definition (e.g., what is "date") Where is it used (e.g., source, used by, etc.) May be combined with a glossary

As the system is developed, the data dictionary in the requirements is the basis of the system data dictionary, which is part of the final specification.

26

Page 27: CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.

SOFTWARE MODELING: KEY POINTSA model is an abstract view of a system that ignores system details. System models can be developed to show the system’s context, interactions, structure and behavior.

Use case diagrams and sequence diagrams are used to describe the interactions between users and systems in the product. Describes interactions between a system and external actors.

Structural models show the organization and architecture of a system. Class diagrams are used to define the static structure of classes in a system.

27