OO Design Notations

23
OO Design Notations iginal version by B.Rogers/M.Utting

description

OO Design Notations. Original version by B.Rogers/M.Utting. Notations. There are a large number of OO and other design notations (text or diagram) Serve two main purposes helping express ideas during design documenting the final structure of a system Informal (personal) - PowerPoint PPT Presentation

Transcript of OO Design Notations

Page 1: OO Design Notations

OO Design Notations

Original version by B.Rogers/M.Utting

Page 2: OO Design Notations

Notations There are a large number of OO and

other design notations (text or diagram) Serve two main purposes

– helping express ideas during design– documenting the final structure of a system

Informal (personal)– allow free expression of ideas

Formal (standard)– may admit proof of correctness– permits development of tools (Rat Rose)– communication to others

Page 3: OO Design Notations

Notations Ad Hoc notations

– widget relationships UML

– class diagrams– (activity diagrams)

CRC cards– Class, Responsibility and Collaboration

Use Cases

Page 4: OO Design Notations

paper

trianglebutton

Widget Organisation

circle button

square button

lcd

quit button

window

Page 5: OO Design Notations

Organisation of Widgets

window (QWidget)

quitbutton(QPushButton)

squarebutton (QPushButton)

circlebutton (QPushButton)

trianglebutton(QPushButton)

paper (Canvas)

lcd(QLCDNumber)

Page 6: OO Design Notations

Widgets emphasising links

window lcd

square

circle

quit

triangle

paper

desktop

Page 7: OO Design Notations

Unified Modelling Language Facetiously called Union of all MLs (UML) Grady Booch, Jim Rumbaugh,

and Ivar Jacobson Unifies and standardises a number of

notations developed over the 80 and 90’s A (mainly) graphical language used to

express object oriented designs.– use case diagrams; class diagrams;

interaction diagrams; package diagrams; state, collaboration, sequence, activity diagrams; deployment diagrams.

Page 8: OO Design Notations

Class Diagram Can be used at different stages of development:

from modeling the kinds of objects in a system through to detailed implementation

Classes may be implemented as Java classes or not, may just be kinds of items in a system

A class is shown as a box:

AttributesNAME

Operations

Page 9: OO Design Notations

AttributesNAME

Operations

int atx, atygraphic

drawresize

Examples

Name in italics for an abstract class

Shape current_shape Graphic picture

Canvas

mouse down, move, up repaint set shape

Page 10: OO Design Notations

Class Diagram Association

– what uses, has, contains, is related to ... Multiplicity

– how many of each kind of object are related Navigability

– what pointers are present Generalization

– sub/super class relationships Other constraints

Page 11: OO Design Notations

int atx, atygraphic

draw resize

Shape current_shape Graphic picture

Canvas

mouse down, move, up repaint set shape

four buttons lcd display

MAIN

Page 12: OO Design Notations

int atx, atygraphic

draw resize

Shape current_shape Graphic picture

Canvas

mouse down, move, up repaint set shape

1

*

four buttons lcd display

MAIN

1 1

Page 13: OO Design Notations

int atx, atygraphic

draw resize

Shape current_shape Graphic picture

Canvas

mouse down, move, up repaint set shape

1

*

four buttons lcd display

MAIN

1 1

Page 14: OO Design Notations

int atx, atygraphic

draw resize

Shape current_shape Graphic picture

Canvas

mouse down, move, up repaint set shape

1

*

four buttons lcd display

MAIN

1 1

int sizeSquare

int width, heightTriangle

int radiusCircle

Page 15: OO Design Notations

CRC Cards Class, Responsibility and Collaboration

– Cunningham and Beck from Tektronix labs in Portland, Oregon. (Smalltalk)

– Used 15 by 10cm index cards Attempt to encourage a high level

description of the purpose of a class Avoid details of methods and attributes Small card limits the number of

responsibilities and amount of detail

Page 16: OO Design Notations

graphicknowing where on the display Canvas

surface it should be drawn

drawing itself Canvas(delegated to subclasses)

resizing, given new extent Canvas(delegated to subclasses)

Responsibilities

Name

Collaborators

Page 17: OO Design Notations

graphicknowing where on the display Canvas

surface it should be drawn

drawing itself Canvas(delegated to subclasses)

resizing, given new extent Canvas(delegated to subclasses)

Canvasresponding to mouse events Graphic(+)

by drawing a graphic

knowing which kind of graphic MAINto draw next (buttons)

maintaining a list of graphics Graphic which have been drawn

repainting the screen Canvas

Page 18: OO Design Notations

squarecircle

trianglesquare

MAINCanvas

responding to mouse events Graphic(+)by drawing a graphic

knowing which kind of graphic MAINto draw next (buttons)

maintaining a list of graphics Graphic which have been drawn

graphicknowing where on the display Canvas

surface it should be drawn

drawing itself Canvas(delegated to subclasses)

resizing, given new extent Canvas(delegated to subclasses)

Page 19: OO Design Notations

Use cases 1 What is a use case? Identify user goal’s, not system functions E.g. for a word processor:

– Build an index – Insert a picture– Ensure consistent formatting.

Describe external view, interactions with the outside world.

Page 20: OO Design Notations

Use cases 2

Express requirements at a high level The first step in software analysis is to

develop a sufficient set of use cases. (but will also useful later on for system testing)

Each use case (business task) has:– A name: – An actor: a role that a user takes when

using the system. Actors are usually human.

– A description: of interaction with system.

Page 21: OO Design Notations

Description should tell us: What are the main tasks done by the actor? What inputs/outputs will the actor give/get? Does the actor have to inform the system

about changes in the external environment? What information does the actor want from the

system? Does the actor wish to be informed about

unexpected changes?

Page 22: OO Design Notations

Use Case Diagrams

Use CaseName

Actor Name

<<uses>>

<<uses>>

<<extends>>

(special cases/exceptions)

Page 23: OO Design Notations

Use Case Diagrams 2

<<uses>>

<<uses>>

<<extends>>

Valuation

Analyze risk

Trader

Price deal

Customer

Capture deal

Limit exceeded