week08. review schedule weeks 8-14 this week o review last class o introduce class diagrams o...

50
Engineering Quality Software Week08

Upload: marvin-taylor

Post on 14-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Engineering Quality Software

Week08

Agenda Review Schedule Weeks 8-14 This week

o Review last classo Introduce Class Diagramso ICE-03

SheridanSYST30009 - Engineering Quality

Systems2

Class Diagrams- Objectives

Identify and analyze the objects and object-classes needed in a system

Learn how to identify and represent relationships between object classes.

Learn how to identify and create super/subclass relationships

Learn how to create a Unified Modeling Language (UML) class diagram using System Architect

SheridanSYST30009 - Engineering Quality

Systems3

Events and Use Cases

Use case o Activity the system carries outo Entry point into the modeling process

Event decomposition: help identify use cases Elementary business processes (EBPs)

o Basic unit of analysiso Initiated by event occurring at specific time and

placeo Discrete system response that adds business

value

SheridanSYST30009 - Engineering Quality

Systems4

Event Decomposition

Event decomposition o Develops use cases based on system response to events o Focus on business processes and business requirements

Result of the decomposition:o List of use cases triggered by business events o Use cases at the right level of analysis

SheridanSYST30009 - Engineering Quality

Systems5

Problem Domain Classes

Problem domaino Set of work-related “things” in system

component • Things have data representation within system

o Examples: products, orders, invoices, customers

OO approach to things in problem domaino Objects that interact in the system

Identify and understand things in problem domaino Key initial steps in defining requirements

SheridanSYST30009 - Engineering Quality

Systems6

SheridanSYST30009 - Engineering Quality

Systems7

Types of Things Things can be identified with methodology

Separate the tangible from the intangible

Include information from all types of users

Ask important questions about nature of event o “What actions upon things should be acknowledged

and recorded by the system?”

SheridanSYST30009 - Engineering Quality

Systems8

Procedure for Developing an Initial List of Things

List nouns users mention when discussing system

Event table as source of potential things

o Use cases, external agents, triggers, response  

Select nouns with questions concerning relevance

o Further research may be needed

SheridanSYST30009 - Engineering Quality

Systems9

SheridanSYST30009 - Engineering Quality

Systems10

Pharmacy System as Illustration

 Next Step…Associations among Things

Analyst document entity associations ( relationships)o Example: “Is placed by” and “works in”

Associations apply in two directionso Customer places an order o An order is placed by a customer

Multiplicity: the number of associations o One to one or one to many 

The associations between types of thingso Unary (recursive), binary, n-ary

SheridanSYST30009 - Engineering Quality

Systems11

SheridanSYST30009 - Engineering Quality

Systems12

Associations Naturally Occur between Things

SheridanSYST30009 - Engineering Quality

Systems13

Multiplicity of Relationships

Attributes of Things

Specific details of things are called attributes

Analyst should identify attributes of things

Identifier (key): attribute uniquely identifying thing

o Examples: Social Security number, vehicle ID number, or product ID number

Compound attribute is a set of related attributes

o Example: multiple names for the same customerSheridanSYST30009 - Engineering Quality

Systems14

SheridanSYST30009 - Engineering Quality

Systems15

Classes and Objects Domain model class diagram as UML class

o OOA applies domain model class diagram to things

Problem domain objects have attributes Software objects encapsulate attributes and

behaviors o Behavior: action that the object processes itself

Software objects communicate with messages

Information system is a set of interacting objects

SheridanSYST30009 - Engineering Quality

Systems16

SheridanSYST30009 - Engineering Quality

Systems17

SheridanSYST30009 - Engineering Quality

Systems18

SheridanSYST30009 - Engineering Quality

Systems19

Hierarchies in Class Diagram Notation

Generalization/specialization notationo Inheritance hierarchyo Rank things the more general to the more special

• Motor vehicle class includes trucks, cars, buses

Classification: means of defining classes of thingso Superclass: generalization of a classo Subclass: specialization of a class

SheridanSYST30009 - Engineering Quality

Systems20

SheridanSYST30009 - Engineering Quality

Systems21

Your Turn…ICE-03 See SLATE

SheridanSYST30009 - Engineering Quality

Systems22

SheridanSYST30009 - Engineering Quality

Systems23

Class Diagrams – Part IILearning Objectives

Construct a class diagram from a narrative including relationships and multiplicities.

Identify and represent inheritance hierarchies in a class diagram.

Learn what is meant by a concrete and/or abstract class.

How to determine and note the constraints for generalization / specialization relationships.

Learn how to describe Whole-to-Part relationships on a class diagram.

How to draw all these relationships using System Architect.

SheridanSYST30009 - Engineering Quality

Systems24

Class Diagrams Document the static

structure of the system They define what

classes there are and how they are related

The symbol on the right defines the data and behaviour encapsulated by a class.

Objects “know things and know how to do things!”

SheridanSYST30009 - Engineering Quality

Systems25

Using System Architect Demo exercise

SheridanSYST30009 - Engineering Quality

Systems26

Types of Objects From last class…

SheridanSYST30009 - Engineering Quality

Systems27

Objects- Review We need to know what types of things the user

works with routinely.o Many types

• Tangible• Intangible• Important to include information from all types of users

SheridanSYST30009 - Engineering Quality

Systems28

Jacobson’s Three TypesOf Objects

• Entity• Interface• Control

SheridanSYST30009 - Engineering Quality

Systems29

Attributes & Behaviors Attributes Behavior (methods & operations)

o Real worldo Data world

SheridanSYST30009 - Engineering Quality

Systems30

Class Diagram Showing TwoClasses

Object Diagramwith Two Instances

SheridanSYST30009 - Engineering Quality

Systems31

Associations/Relationships

relationship among object classes

solid line connecting classes

association is named i.e. drives

where line connects to class is called “association role”

SheridanSYST30009 - Engineering Quality

Systems32

SheridanSYST30009 - Engineering Quality

Systems33

Associations withMultiplicity

shows number of objects in an association

lower..upper bound bounds are inclusive

2..5 0..1 = optional one 0..* = optional many 1..* = many 1 = exactly one

* *

* *

* *

*

*

The complexity of the Many-to-many relationships

Examples

SheridanSYST30009 - Engineering Quality

Systems34

Your turn… SLATE – Lesson 08 Class Diagram Exercises

SheridanSYST30009 - Engineering Quality

Systems35

SheridanSYST30009 - Engineering Quality

Systems36

Subclasses

Some instances of a class (subclass) may be grouped together based on features not shared by the rest of the class.o Attributeso Behavior o Relationships

Key verb is “isakinda” (and inverse, “canbea”).

SheridanSYST30009 - Engineering Quality

Systems37

Subclasses and Inheritance

A subclass is made up of selected instances from another class, the “Parent class” or “superclass.”

A superclass includes all the instances of the subclass, plus possibly more as well.

SheridanSYST30009 - Engineering Quality

Systems38

Subclasses and Inheritance

Inheritance is when a subclass instance, in addition to the attributes and behavior it has by virtue of being in the subclass, also has all the attributes and behavior that instances of the superclass have.

SheridanSYST30009 - Engineering Quality

Systems39

Each subclass then adds

attributes and behaviors

that it needs but the other

one doesn’t.

Subclasses and Inheritance

The subclass relationship actually is a relationship in the way we have used that word.

It requires a verb (one in each direction).o “isakinda”o “canbea”

SheridanSYST30009 - Engineering Quality

Systems40

isak

inda ca

nbea

Object-Oriented To be considered truly O-O, a language, database,

etc. must support:o Objects,o Classes,o Inheritance, ando Polymorphism

SheridanSYST30009 - Engineering Quality

Systems41

Subclasses With subclasses, we can show

more detail about relationships on our diagram.o For instance, in most

companies, only managers can hire and fire.

o In other words, only certain kindsa employees can do certain tasks. (only a baker can bake)

We are able to show that some relationships affect only a subclass, not every instance.

SheridanSYST30009 - Engineering Quality

Systems42

Your turn…

SLATE- Inheritance Exercise

SheridanSYST30009 - Engineering Quality

Systems43

SheridanSYST30009 - Engineering Quality

Systems44

Generalization, Inheritance & Constraints

generalization path o solid line with hollow

arrowhead pointing from subclass to superclass

indicate basis of generalization

name the path for the attribute being removed = called the discriminator

discriminator shows which property is abstracted by a generalization relationshipSheridan

SYST30009 - Engineering Quality Systems

45

Constraints on Generalization

constraints on the subclasses

overlapping: descendent may be descended from more than one of the subclasseso student can be both a

research and teaching assistant

disjoint: descendent may not be descended from more than one of the subclasseso patient can not be both

out and resident

SheridanSYST30009 - Engineering Quality

Systems46

Constraints on Generalization

complete: all subclasses are listedo only have out and

resident patients incomplete: all

subclasses are not listedo more subclasses are

availableo can have casual, part-

time employees

SheridanSYST30009 - Engineering Quality

Systems47

Your turn… SLATE – Lesson 5 Vehicle Registration System

SheridanSYST30009 - Engineering Quality

Systems48

SheridanSYST30009 - Engineering Quality

Systems49

What Comes Next? Continue with relationships

o Class diagram• Whole-Part associations (Aggregation)

SheridanSYST30009 - Engineering Quality

Systems50