1 Example: Modem Hierarchy (contd) V ISITOR V ISITOR as a Matrix - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Example: Modem Hierarchy (contd) V ISITOR V ISITOR as a Matrix - - PDF document

Design Patterns: Set 3 Design Patterns: Set 3 V ISITOR V ISITOR The V The V The V ISITOR ISITOR family family The V ISITOR ISITOR family allows new family allows new methods to be added to existing V methods to be


slide-1
SLIDE 1

1 Design Patterns: Set 3 Design Patterns: Set 3

  • The V

The VISITOR

ISITOR family

family

  • V

VISITOR

ISITOR

  • A

ACYCLIC

CYCLIC V

VISITOR

ISITOR

  • D

DECORATOR

ECORATOR

  • E

EXTENSION

XTENSION O

OBJECT

BJECT

  • S

STATE

TATE

V VISITOR

ISITOR

  • The V

The VISITOR

ISITOR family allows new

family allows new methods to be added to existing methods to be added to existing hierarchies without modifying the hierarchies without modifying the hierarchies hierarchies

  • Every derivative of the visited

Every derivative of the visited hierarchy has a method in V hierarchy has a method in VISITOR

ISITOR

  • Dual dispatch: two polymorphic

Dual dispatch: two polymorphic dispatches dispatches

Example: Modem Hierarchy Example: Modem Hierarchy

« «interface interface» » Modem Modem + dial() + dial() + send() + send() + hangup() + hangup() + receive() + receive() Hayes Hayes Zoom Zoom Ernie Ernie

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

« «interface interface» » Modem Modem + dial() + dial() + send() + send() + hangup() + hangup() + receive() + receive() + accept( + accept( ModemVisitor ModemVisitor) ) Hayes Hayes Zoom Zoom Ernie Ernie « «interface interface» » Modem Visitor Modem Visitor + visit( + visit( Hayes Hayes) ) + visit( + visit( Zoom Zoom ) ) + visit( + visit( Ernie Ernie) )

UnixModem UnixModem Configurator Configurator W indow sModem W indow sModem Configurator Configurator

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

publ i c i nt er f ace publ i c i nt er f ace M

  • dem

M

  • dem {

{ publ i c voi d publ i c voi d di al ( di al ( St r i ng St r i ng pno) ; pno) ; publ i c voi d publ i c voi d hangup( ) ; hangup( ) ; publ i c voi d publ i c voi d send( send( char char c) ; c) ; publ i c char publ i c char r ecei ve( ) ; r ecei ve( ) ; publ i c voi d publ i c voi d accept ( accept ( M

  • dem

Vi si t or M

  • dem

Vi si t or v) ; v) ; } } publ i c i nt er f ace publ i c i nt er f ace M

  • dem

Vi si t or M

  • dem

Vi si t or { { publ i c voi d publ i c voi d vi si t ( vi si t ( HayesM

  • dem

HayesM

  • dem m
  • dem

) ; m

  • dem

) ; publ i c voi d publ i c voi d vi si t ( vi si t ( Zoom M

  • dem

Zoom M

  • dem m
  • dem

) ; m

  • dem

) ; publ i c voi d publ i c voi d vi si t ( vi si t ( Er ni eM

  • dem

Er ni eM

  • dem m
  • dem

) ; m

  • dem

) ; } }

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

publ i c cl ass publ i c cl ass HayesM

  • dem

HayesM

  • dem

i m pl em ent s i m pl em ent s M

  • dem

M

  • dem {

{ publ i c voi d publ i c voi d accept ( accept ( M

  • dem

Vi si t or M

  • dem

Vi si t or v) { v) {

  • v. vi si t (
  • v. vi si t ( t hi s

t hi s) ; ) ; } } / * r est of t he i m pl em ent at i on om i t t ed * / / * r est of t he i m pl em ent at i on om i t t ed * / } } publ i c cl ass publ i c cl ass Uni xM

  • dem

Conf i gur at or Uni xM

  • dem

Conf i gur at or i m pl em ent s i m pl em ent s M

  • dem

Vi si t or M

  • dem

Vi si t or { { publ i c voi d publ i c voi d vi si t ( vi si t ( HayesM

  • dem

HayesM

  • dem m

) { m ) { m . set Conf i gur at i onSt r i ng( m . set Conf i gur at i onSt r i ng( " " &s1=4&D=3 &s1=4&D=3" " ) ) ; ; } } publ i c voi d publ i c voi d vi si t ( vi si t ( Zoom M

  • dem

Zoom M

  • dem m

) { m ) { m . set Conf i gur at i onVal ue( 42) ; m . set Conf i gur at i onVal ue( 42) ; } } publ i c voi d publ i c voi d vi si t ( vi si t ( Er ni eM

  • dem

Er ni eM

  • dem m

) { m ) { m . set I nt er nal Pat t er n( m . set I nt er nal Pat t er n( " " C i s t oo sl ow C i s t oo sl ow" " ) ) ; ; } } } }

slide-2
SLIDE 2

2

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

  • To configure a modem for Unix,

To configure a modem for Unix, create an instance of the visitor and create an instance of the visitor and pass it to pass it to accept accept

  • The appropriate derivative calls

The appropriate derivative calls vi si t ( vi si t ( t hi s t hi s) )

  • New OS configuration can be added

New OS configuration can be added by adding a new derivative of the by adding a new derivative of the visitor visitor

V VISITOR

ISITOR as a Matrix

as a Matrix

Initialization of Initialization of Ernie in Windows Ernie in Windows Initialization of Initialization of Ernie in Unix Ernie in Unix

Ernie Ernie

Initialization of Initialization of Zoom in Windows Zoom in Windows Initialization of Initialization of Zoom in Unix Zoom in Unix

Zoom Zoom

Initialization of Initialization of Hayes in Windows Hayes in Windows Initialization of Initialization of Hayes in Unix Hayes in Unix

Hayes Hayes Windows Windows Unix Unix

Observations Observations

  • In V

In VISITOR

ISITOR

  • the visited hierarchy depends on the base class of the

the visited hierarchy depends on the base class of the visitor hierarchy visitor hierarchy

  • the base class of the visitor hierarchy has a function for

the base class of the visitor hierarchy has a function for each derivative of the visited hierarchy each derivative of the visited hierarchy

  • A cycle of dependencies ties all the visited

A cycle of dependencies ties all the visited derivatives together derivatives together

  • difficult to compile incrementally

difficult to compile incrementally

  • difficult to add new derivatives of visited hierarchy

difficult to add new derivatives of visited hierarchy

  • Visitor work well if the hierarchy is not modified

Visitor work well if the hierarchy is not modified

  • ften
  • ften

A ACYCLIC

CYCLIC V

VISITOR

ISITOR

  • For a volatile hierarchy

For a volatile hierarchy

  • new derivatives are created

new derivatives are created

  • quick compilation time is needed

quick compilation time is needed

  • A

ACYCLIC

CYCLIC V

VISITOR

ISITOR breaks the

breaks the dependency cycle by making the dependency cycle by making the visitor base class degenerate (i.e. it visitor base class degenerate (i.e. it has no methods) has no methods)

Example: Modem Hierarchy Example: Modem Hierarchy

« «interface interface» » Modem Modem

+ dial() + dial() + send() + send() + hangup() + hangup() + receive() + receive() + accept( + accept( ModemVisitor ModemVisitor) )

Hayes Hayes Zoom Zoom Ernie Ernie

« «degenerate degenerate» » Modem Visitor Modem Visitor

«interface» «interface» HayesVisitor HayesVisitor

+ visit + visit (Hayes) (Hayes)

«interface» «interface» Zoom Visitor Zoom Visitor

+ visit + visit (Zoom) (Zoom)

«interface» «interface» ErnieVisitor ErnieVisitor

+ visit + visit (Ernie) (Ernie)

UnixModem UnixModem Configurator Configurator

Example: Modem Hierarcy (cont’d) Example: Modem Hierarcy (cont’d)

publ i c i nt er f ace publ i c i nt er f ace M

  • dem

M

  • dem {

{ publ i c voi d publ i c voi d di al ( di al ( St r i ng St r i ng pno) ; pno) ; publ i c voi d publ i c voi d hangup( ) ; hangup( ) ; publ i c voi d publ i c voi d send( send( char char c) ; c) ; publ i c char publ i c char r ecei ve( ) ; r ecei ve( ) ; publ i c voi d publ i c voi d accept ( accept ( M

  • dem

Vi si t or M

  • dem

Vi si t or v) ; v) ; } } publ i c i nt er f ace publ i c i nt er f ace M

  • dem

Vi si t or M

  • dem

Vi si t or { { } }

slide-3
SLIDE 3

3

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

publ i c i nt er f ace publ i c i nt er f ace Er ni eM

  • dem

Vi si t or Er ni eM

  • dem

Vi si t or { { publ i c voi d publ i c voi d vi si t ( vi si t ( Er ni eM

  • dem

Er ni eM

  • dem m

) ; m ) ; } } publ i c cl ass publ i c cl ass Er ni eM

  • dem

Er ni eM

  • dem i m

pl em ent s i m pl em ent s M

  • dem

M

  • dem {

{ publ i c voi d publ i c voi d accept ( accept ( M

  • dem

Vi si t or M

  • dem

Vi si t or v) { v) { t r y t r y { { Er ni eM

  • dem

Vi si t or Er ni eM

  • dem

Vi si t or ev = ev = ( ( Er ni eM

  • dem

Vi si t or Er ni eM

  • dem

Vi si t or ) v; ) v;

  • ev. vi si t (
  • ev. vi si t ( t hi s

t hi s) ; ) ; } } cat ch cat ch ( ( Cl assCast Except i on Cl assCast Except i on e) { } e) { } } } / * r est of t he i m pl em ent at i on om i t t ed * / / * r est of t he i m pl em ent at i on om i t t ed * / } }

Example: Modem Hierarchy (cont’d) Example: Modem Hierarchy (cont’d)

publ i c cl ass publ i c cl ass Uni xM

  • dem

Conf i gur at or Uni xM

  • dem

Conf i gur at or i m pl em ent s i m pl em ent s M

  • dem

Vi si t or M

  • dem

Vi si t or , , HayesVi si t or HayesVi si t or , , Zoom Vi si t or Zoom Vi si t or , , Er ni eVi si t or Er ni eVi si t or { { publ i c voi d publ i c voi d vi si t ( vi si t ( HayesM

  • dem

HayesM

  • dem m

) { m ) { m . set Conf i gur at i onSt r i ng( m . set Conf i gur at i onSt r i ng( " " &s1=4&D=3 &s1=4&D=3" " ) ) ; ; } } publ i c voi d publ i c voi d vi si t ( vi si t ( Zoom M

  • dem

Zoom M

  • dem m

) { m ) { m . set Conf i gur at i onVal ue( 42) ; m . set Conf i gur at i onVal ue( 42) ; } } publ i c voi d publ i c voi d vi si t ( vi si t ( Er ni eM

  • dem

Er ni eM

  • dem m

) { m ) { m . set I nt er nal Pat t er n( m . set I nt er nal Pat t er n( " " C i s t oo sl ow C i s t oo sl ow" " ) ) ; ; } } } }

Observations Observations

  • Breaking the dependency cycle

Breaking the dependency cycle ⇒ ⇒

  • easier to add visited derivatives

easier to add visited derivatives

  • solution is much more complex

solution is much more complex

  • timing of the type casting is hard to

timing of the type casting is hard to characterize characterize

  • A

ACYCLIC

CYCLIC V

VISITOR

ISITOR is like a sparse

is like a sparse matrix matrix

  • visitor classes do no have to implement

visitor classes do no have to implement visit functions for all visited derivatives visit functions for all visited derivatives

D DECORATOR

ECORATOR

  • Allows attaching additional

Allows attaching additional responsibilities to an object responsibilities to an object dynamically (i.e. at runtime) dynamically (i.e. at runtime)

  • Provides a flexible alternative to

Provides a flexible alternative to subclassing for extending subclassing for extending functionality functionality

  • Allows adding responsibilities to an

Allows adding responsibilities to an

  • bject without adding methods to its
  • bject without adding methods to its

interface interface

Example: Loud Dial Modem Example: Loud Dial Modem

« «interface interface» » Modem Modem + dial(… ) + dial(… ) + setVolume( + setVolume( int int ) ) HayesModem HayesModem Zoom Modem Zoom Modem ErnieModem ErnieModem LoudDial LoudDial Modem Modem «delegates» «delegates» itsModem itsModem

public void dial(… ) { public void dial(… ) { itsModem.setVolume(11); itsModem.setVolume(11); itsModem.dial(… ); itsModem.dial(… ); } }

Example: Loud Dial Modem (cont’d) Example: Loud Dial Modem (cont’d)

publ i c i nt er f ace publ i c i nt er f ace M

  • dem

M

  • dem

{ { publ i c voi d publ i c voi d di al di al St r i ng St r i ng( pno) ; ( pno) ; publ i c voi d publ i c voi d set Speaker Vol um e( set Speaker Vol um e( i nt i nt vol um e) ; vol um e) ; } } publ i c cl ass publ i c cl ass HayesM

  • dem

HayesM

  • dem i m

pl em ent s i m pl em ent s M

  • dem

M

  • dem {

{ pr i vat e pr i vat e St r i ng St r i ng i t sPhoneNum ber ; i t sPhoneNum ber ; pr i vat e i nt pr i vat e i nt i t sSpeaker Vol um e; i t sSpeaker Vol um e; publ i c voi d publ i c voi d di al ( di al ( St r i ng St r i ng pno) { pno) { i t sPhoneNum ber = pno; i t sPhoneNum ber = pno; } } publ i c voi d publ i c voi d set Speaker Vol um e( set Speaker Vol um e( i nt i nt vol um e) { vol um e) { i t sSpeaker Vol um e = vol um e; i t sSpeaker Vol um e = vol um e; } } } }

slide-4
SLIDE 4

4

Example: Loud Dial Modem (cont’d) Example: Loud Dial Modem (cont’d)

publ i c cl ass publ i c cl ass LoudDi al M

  • dem

LoudDi al M

  • dem i m

pl em ent s i m pl em ent s M

  • dem

M

  • dem {

{ pr i vat e pr i vat e M

  • dem

M

  • dem i t sM
  • dem

; i t sM

  • dem

; publ i c publ i c LoudDi al M

  • dem

LoudDi al M

  • dem

( ( M

  • dem

M

  • dem m

) { m ) { i t sM

  • dem

= m ; i t sM

  • dem

= m ; } } publ i c voi d publ i c voi d di al ( di al ( St r i ng St r i ng pno) { pno) { i t sM

  • dem

. set Speaker Vol um e( 11) ; i t sM

  • dem

. set Speaker Vol um e( 11) ; i t sM

  • dem

. di al ( pno) ; i t sM

  • dem

. di al ( pno) ; } } publ i c voi d publ i c voi d set Speaker Vol um e( set Speaker Vol um e( i nt i nt vol um e) { vol um e) { i t sM

  • dem

. set Speaker Vol um e( vol um e) ; i t sM

  • dem

. set Speaker Vol um e( vol um e) ; } } } }

Observations Observations

  • Multiple decorators: base class decorator

Multiple decorators: base class decorator

  • supplies the delegation code

supplies the delegation code

  • actual decorators derive from the base class

actual decorators derive from the base class and override only those methods they need and override only those methods they need

  • Cf.

Cf.

  • Java I/ O stream s:

Java I/ O stream s: Buf f er edReader Buf f er edReader keyboar d = keyboar d = new new Buf f er edReader Buf f er edReader ( ( new new I nput St r eam Reader I nput St r eam Reader ( ( Syst em Syst em . i n) ) ; . i n) ) ;

  • j avax. swi ng.

j avax. swi ng. JScr ol l Pane JScr ol l Pane

E EXTENSION

XTENSION O

OBJECT

BJECT

  • More complex than V

More complex than VISITOR

ISITOR but more

but more powerful powerful

  • Each object in the hierarchy

Each object in the hierarchy

  • maintains a list of special extension objects

maintains a list of special extension objects

  • provides a method that allows the extension

provides a method that allows the extension

  • bject to be looked up by name
  • bject to be looked up by name
  • Extension object provides methods that

Extension object provides methods that manipulate the original hierarchy object manipulate the original hierarchy object

Example: Bill Example: Bill-

  • of
  • f-
  • Materials

Materials

Part Part Assem bly Assem bly

+ getExtension(String) + getExtension(String) + addExtension(String, + addExtension(String, PartExtension) PartExtension)

« «marker marker» » PartExtension PartExtension « «marker marker» » BadPartExtension BadPartExtension

PiecePart PiecePart 0..* 0..*

« «interface interface» » XMLPartExtension XMLPartExtension + getXMLElement() + getXMLElement()

XMLAssem bly XMLAssem bly Extension Extension XMLPiecePart XMLPiecePart Extension Extension

« «interface interface» » CSVPartExtension CSVPartExtension + getCSV() + getCSV()

CSVAssem bly CSVAssem bly Extension Extension CSVPiecePart CSVPiecePart Extension Extension

0..* 0..*

S STATE

TATE

  • Allows an object to alter its behaviour

Allows an object to alter its behaviour when its internal state changes when its internal state changes

  • the object will appear to change its class

the object will appear to change its class

  • Typically used to change the behaviour

Typically used to change the behaviour according to a state transition diagram according to a state transition diagram

  • Other implementations for an FSM

Other implementations for an FSM

  • nested switch/ case statement

nested switch/ case statement

  • transition table

transition table

Example: Turnstile FSM Example: Turnstile FSM

Locked Locked Unlocked Unlocked

coin/ unlock coin/ unlock pass/ lock pass/ lock pass/ alarm pass/ alarm coin/ thankyou coin/ thankyou

slide-5
SLIDE 5

5 Example: Turnstile Example: Turnstile

Turnstile Turnstile + coin() + coin() + pass() + pass() # lock() # lock() # unlock() # unlock() # thankyou() # thankyou() # alarm() # alarm() « «interface interface» » TurnstileState TurnstileState + coin(Turnstile) + coin(Turnstile) + pass(Turnstile) + pass(Turnstile)

Turnstile Turnstile LockedState LockedState Turnstile Turnstile UnlockedState UnlockedState

Example: Turnstile (cont’d) Example: Turnstile (cont’d)

publ i c i nt er f ace publ i c i nt er f ace Tur nst i l eSt at e Tur nst i l eSt at e { { publ i c voi d publ i c voi d coi n( coi n( Tur nst i l e Tur nst i l e t ) ; t ) ; publ i c voi d publ i c voi d pass( pass( Tur nst i l e Tur nst i l e t ) ; t ) ; } } publ i c cl ass publ i c cl ass LockedTur nst i l eSt at e LockedTur nst i l eSt at e i m pl em ent s i m pl em ent s Tur nst i l eSt at e Tur nst i l eSt at e { { publ i c voi d publ i c voi d coi n( coi n( Tur nst i l e Tur nst i l e t ) { t ) { t . set Unl ocked( ) ; t . set Unl ocked( ) ; t . unl ock( ) ; t . unl ock( ) ; } } publ i c voi d publ i c voi d pass( pass( Tur nst i l e Tur nst i l e t ) { t . al ar m ( ) ; } t ) { t . al ar m ( ) ; } } } publ i c cl ass publ i c cl ass Unl ockedTur nst i l eSt at e Unl ockedTur nst i l eSt at e i m pl em ent s i m pl em ent s Tur nst i l eSt at e Tur nst i l eSt at e { { publ i c voi d publ i c voi d coi n( coi n( Tur nst i l e Tur nst i l e t ) { t . t hankyou( ) ; } t ) { t . t hankyou( ) ; } publ i c voi d publ i c voi d pass( pass( Tur nst i l e Tur nst i l e t ) { t ) { t . set Locked( ) ; t . set Locked( ) ; t . l ock( ) ; t . l ock( ) ; } } } }

Example: Turnstile (cont’d) Example: Turnstile (cont’d)

publ i c cl ass publ i c cl ass Tur nst i l e Tur nst i l e { { pr i vat e st at i c pr i vat e st at i c Tur nst i l eSt at e Tur nst i l eSt at e l ockedSt at e = l ockedSt at e = new new LockedTur nst i l eSt at e LockedTur nst i l eSt at e( ) ; ( ) ; pr i vat e st at i c pr i vat e st at i c Tur nst i l eSt at e Tur nst i l eSt at e unl ockedSt at e = unl ockedSt at e = new new Unl ockedTur nst i l eSt at e Unl ockedTur nst i l eSt at e( ) ; ( ) ; pr i vat e pr i vat e Tur nst i l eCont r ol l er Tur nst i l eCont r ol l er t ur nst i l eCont r ol l er ; t ur nst i l eCont r ol l er ; pr i vat e pr i vat e Tur nst i l eSt at e Tur nst i l eSt at e st at e = l ockedSt at e; st at e = l ockedSt at e; publ i c publ i c Tur nst i l e Tur nst i l e( ( Tur nst i l eCont r ol l er Tur nst i l eCont r ol l er act i on) { act i on) { t ur nst i l eCont r ol l er = act i on; t ur nst i l eCont r ol l er = act i on; } } publ i c voi d publ i c voi d coi n( ) { st at e. coi n( coi n( ) { st at e. coi n( t hi s t hi s) ; } ) ; } publ i c voi d publ i c voi d pass( ) { st at e. pass( pass( ) { st at e. pass( t hi s t hi s) ; } ) ; } publ i c voi d publ i c voi d set Locked( ) { st at e = l ockedSt at e; } set Locked( ) { st at e = l ockedSt at e; } publ i c voi d publ i c voi d set UnLocked( ) { st at e = unl ockedSt at e; } set UnLocked( ) { st at e = unl ockedSt at e; } publ i c bool ean publ i c bool ean i sLocked( ) { i sLocked( ) { r et ur n r et ur n st at e == l ockedSt at e; } st at e == l ockedSt at e; } publ i c bool ean publ i c bool ean i sUnl ocked( ) { i sUnl ocked( ) { r et ur n r et ur n st at e == unl ockedSt at e; } st at e == unl ockedSt at e; } pr ot ect ed voi d pr ot ect ed voi d t hankyou( ) { t ur nst i l eCont r ol l er . t hankyou( ) ; } t hankyou( ) { t ur nst i l eCont r ol l er . t hankyou( ) ; } pr ot ect ed voi d pr ot ect ed voi d al ar m ( ) { t ur nst i l eCont r ol l er . al ar m ( ) ; } al ar m ( ) { t ur nst i l eCont r ol l er . al ar m ( ) ; } pr ot ect ed voi d pr ot ect ed voi d l ock( ) { t ur nst i l eCont r ol l er . l ock( ) ; } l ock( ) { t ur nst i l eCont r ol l er . l ock( ) ; } pr ot ect ed voi d pr ot ect ed voi d unl ock( ) { t ur nst i l eCont r ol l er . unl ock( ) ; } unl ock( ) { t ur nst i l eCont r ol l er . unl ock( ) ; } } }

S STATE

TATE vs. S

  • vs. STRATEGY

TRATEGY

  • Common

Common

  • context class

context class

  • delegation to a polymorphic base class that

delegation to a polymorphic base class that has several derivatives has several derivatives

  • Difference

Difference

  • S

STATE

TATE: derivatives hold a reference back to the

: derivatives hold a reference back to the context class context class

  • S

STRATEGY

TRATEGY: no such constraint or intent

: no such constraint or intent

  • All instances of S

All instances of STATE

TATE are also instances of

are also instances of S STRATEGY

TRATEGY

Observations Observations

  • Very strong separation between actions and the

Very strong separation between actions and the logic of state machine logic of state machine

  • action in the context class

action in the context class

  • logic distributed through the derivatives of the state

logic distributed through the derivatives of the state class class

  • Simple to change one without affecting the other

Simple to change one without affecting the other

  • reuse the context class with different state logic

reuse the context class with different state logic

  • create subclasses of context class that modify the action

create subclasses of context class that modify the action without affecting the logic without affecting the logic

  • Costs

Costs

  • writing state derivatives is tedious

writing state derivatives is tedious

  • the logic is distributed, no single place to see it all

the logic is distributed, no single place to see it all

Null Object Null Object State State Strategy Strategy Template Method Template Method Factory Factory Monostate Monostate Singleton Singleton Facade Facade Mediator Mediator Observer Observer Acyclic Visitor Acyclic Visitor Extension Object Extension Object Decorator Decorator Visitor Visitor Composite Composite Active Object Active Object Command Command Abstract Server Abstract Server Bridge Bridge Adapter Adapter Stairway to Heaven Stairway to Heaven Proxy Proxy Factory Method Factory Method Prototype Prototype Flyweight Flyweight Interpreter Interpreter Iterator Iterator Memento Memento Builder Builder Chain of Responsibility Chain of Responsibility

Design Patterns (revisited) Design Patterns (revisited)

slide-6
SLIDE 6

6 Principles, Patterns, and Practices Principles, Patterns, and Practices

System System Context Context Theory Theory Practice Practice Principles Principles Patterns Patterns Abstraction Abstraction

  • f practices
  • f practices

research, research, experience experience

Forces Forces

needs needs concretization concretization motivation, motivation, synthesis synthesis know know-

  • how

how

Examinations Examinations

  • Examination dates

Examination dates

  • May 15, 2006

May 15, 2006

  • June 20, 2006

June 20, 2006

  • September, 2006 (exact date to be

September, 2006 (exact date to be announced) announced)

  • Confirm the times and places at

Confirm the times and places at http: / / www.it.utu.fi/ opetus/ tentit/ http: / / www.it.utu.fi/ opetus/ tentit/

  • If you are not a student of University of

If you are not a student of University of Turku, you must register to receive the Turku, you must register to receive the credits credits

  • Remember to enrol in time!

Remember to enrol in time!

Examinations (cont’d) Examinations (cont’d)

  • Questions:

Questions:

  • based on both lectures and course textbook

based on both lectures and course textbook

  • three questions, à 10 points

three questions, à 10 points

  • to pass the examination, at least 15 points

to pass the examination, at least 15 points (50% ) are required (50% ) are required

  • questions are in English, but you can answer in

questions are in English, but you can answer in English or in Finnish English or in Finnish

  • Note: You can use the textbook in the

Note: You can use the textbook in the examination examination

Fin. Fin.