executable uml the models are the code - executable uml lecture 3 - modelling with domains and...

Post on 30-Dec-2015

237 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Executable UML

The Models are the Code -Executable UML

Lecture 3 - Modelling with Domains and Classes

Paul Krause

Executable UML

Lecture 3 - Modelling with Domains and Classes Partitioning complex projects

Domains and Domain Charts

Class Modelling within Domains

Executable UML

One Thousand Classes and Beyond

We have to partition the problem. But how?

Functional decomposition is a traditional option

But typically a function represents a “vertical”slice through a system requiring application expertise knowledge of service functions - security, logging, … understanding of database functionality software architecture and implementation knowledge

In general, there are too many dependencies

Executable UML

Subject Matter Partitioning

Sally Shlaer and Stephen Mellor established the foundations for this approach in 1988 Object-oriented Systems Analysis - Modelling the

World in Data

Recognises that a system consists of a set of subject matters - domains Each domain consists of a set of classes Domains are represented as packages in UML

A Domain Chart captures the dependencies between domains

Executable UML

Air Traffic Control System

Air Traffic Control

EquipmentConfiguration

Alarms

User Interface

Radar DataProcessing

Executable UML

What is a Domain? A domain is an autonomous, real, hypothetical

or abstract world inhabited by a set of conceptual entities that behave according to characteristic rules and policies Mellor and Balcer, p30

Real Worlds Air traffic control, patient administration, banking,

Hypothetical Worlds 3D geometry, statistical analysis, …

Abstract Worlds User interface, messaging, workflow, …

Executable UML

Domain Policies

Aircraft

Air Traffic

Control

Domain “Aircraft” Class represents a real world concept

Domain Policy: An Aircraft must remain atleast 3 miles horizontally and 100 vertically

from all other Aircraft

Icon

User

Interface

Domain “Icon” Class represents an abstract concept

Domain Policy: An icon must become opaqueif it is in front of another icon

Executable UML

Advantages of Subject Matter Partitioning Reuse

Well-defined interfaces

Effective use of subject-matter knowledge

Stability to changing requirements

Stability to changing technology

Incorporation of third party software

Effective integration with Use-Case driven development

Executable UML

Domain Types

Command and Control

Application DomainsRepresents the purposeof the system from theend-user’s perspective

Recording

Service DomainsProviding generic servicesto support the applicationdomains

User Interface

SoftwareArchitecture

Architecture DomainRepresenting the globallyapplied design and codingstrategies

Oracle

Implementation DomainsRepresenting pre-existingsoftware components - eitherbought-in or ‘legacy’

Unix

Executable UML

Domain Partitioning

Flight Plan Aircraft Runway

IconPop-upMenu

1

has filed

has beenfiled for

0..*

0..1

is beingused by

is using

0..1

represents 1

is represented by 1

1

is linkedto

has

1

Executable UML

Air Traffic Control

User Interface

Domain Partitioning

Flight Plan Aircraft Runway

IconPop-upMenu

1

has filed

has beenfiled for

0..*

0..1

is beingused by

is using

0..1

1

is linkedto

has

1

Executable UML

Lecture 3 - Modelling with Domains and Classes Partitioning complex projects

Domains and Domain Charts

Class Modelling within Domains

Executable UML

Class Modelling within Domains

A class is an abstraction of some set of conceptual entities with common characteristics and common behaviour

Note the two activities Classification Abstraction

There are various kinds of “conceptual entities”, not just tangible things

Executable UML

Kinds of Classes Tangible things

Aircraft, Book, Car, Pet, …

Roles Doctor, Clerk, Employee, Department, …

Incidents Flight, Performance, Accident, Service Call, …

Interactions Purchase, Credit Card Charge, Database

Transaction, …

Specifications Insurance Product, Book Product, Credit Card Type,

Executable UML

Classes and Objects

An Object

Is a chunk of structured data in a running software system

Has properties that represent its state Its behaviour may depend on its state

Has behaviour how it acts and reacts to events and messages

Executable UML

Classes and Objects

A Class

Is an abstraction of a set of objects that are similar in some useful way its instances

Film is a class

“Anger Management” is an instance of Film

Executable UML

Classes and Objects

Film

titledirectorproducerduration

: Film

title: Anger Managementdirectorproducerduration

Executable UML

Identifying classes

Think about general properties of the domain in which you are working

Identify the nouns

These form candidate classes

A Publisher produces and markets a Book

A Customer purchases a Book

An Author writes a Book

Executable UML

Publisher Book Customer

Author

Executable UML

Publisher

nameaddresswebSite

Book

bookNumbertitleunitPrice

Customer

nameemailshippingAddress

Author

nameaddresswebSite

Executable UML

Associations

Publisher

nameaddresswebSite

Book

bookNumbertitleunitPrice

R1

publisher publication

Publisher

nameaddresswebSite

Book

bookNumbertitleunitPrice

R1

is producedand

marketedby

producesand

markets

Executable UML

Association Meanings

Name the association so that it can be unambiguously identified (e.g. R1)

The “association ends” express meaning

An association end may be a role or a verb phrase

Each class in an association has a role (e.g. a Book has the role of a publication)

But writing meaning in terms of a verb phrase is more descriptive

Executable UML

Publisher

nameaddresswebSite

Book

bookNumbertitleunitPrice

Customer

nameemailshippingAdd

Author

nameaddresswebSite

R1 R3

R2

is producedand

marketedby

producesand

markets

purchases is sold to

wrote

was written by

Executable UML

Multiplicity

We can also characterise an association by the number of instances (objects) that participate in each instance of the domain relationship

UML allows specific numbers in a multiplicity relation

Recommend you only use four kinds: unconditional; 1, or 1..* conditional;0..1, or 0..*

Executable UML

Publisher

nameaddresswebSite

Book

bookNumbertitleunitPrice

Customer

nameemailshippingAdd

Author

nameaddresswebSite

R1 R3

R2

is producedand

marketedby

producesand

markets

purchases is sold to

wrote

was written by

1 0..* 1..* 0..*

1..*

1..*

There are books not sold to any customer

To be a customer you must have purchased at least one book

But where do I put the number of books a customer purchased?

Executable UML

Publisher

nameaddresswebSite

BookProduct

bookNumbertitleunitPrice

Customer

nameemailshippingAdd

Author

nameaddresswebSite

R1 R3

R2

is producedand

marketedby

producesand

markets

is apurchase

of

is sold as

wrote

was written by

1 0..* 1..* 0..*

1..*

1..*

Order

quantitysalePricedate

makes 1..*

is made by 1

top related