Download presentation

Presentation is loading. Please wait.

Published byNatalie Burgess Modified over 3 years ago

1
Création dassemblage par ajout de méthode Account deposit(double) withdraw(double) getAmount():double apply Account+ Pattern ceilingManagement(Container c, Boundary d) { newPort c.hasReachedMax() : bool -> double amount = c.getAmount(); d.isFull(amount) } Boundary isFull(double):bool apply (Self, getAmount()) (Boundary, isFull(double)) deposit(double) withdraw(double) getAmount():double hasReachedMax():bool Container getAmount():double boundary isFull(double):bool setMax(double) DoubleBoundary pelAccount

2
Création dassemblage par changement de comportement (1/2) Pattern transfer(Account a1, Account a2) { replace a1.deposit(double f) -> a1._call(0.9 * f); a2._call(0.1 * f) } runningAccount Account deposit(double) apply Account deposit(double) withdraw(double) getAmount():double deposit(double) withdraw(double) getAmount():double hasReachedMax() (Boundary, isFull(double)) (Self, getAmount()) Account+ (Account, deposit(double) Account deposit(double) pelAccount

3
Création dassemblage par changement de comportement (2/2) runningAccount pelAccount apply deposit(double) withdraw(double) getAmount():double deposit(double) withdraw(double) getAmount():double hasReachedMax() (Boundary, isFull(double)) (Self, getAmount()) Account+ (Account, deposit(double) Account Pattern interestDeposit( Account a1, BoundedAccount a2) { replace a2.deposit(double f) -> if a2.hasReachedMax() then double amount = a2.getAmount(); a1._call(amount); a2.withdraw(amount); a2._call(f) else a2._call(f) endif} Account++ (Boundary, isFull(double)) (Self, getAmount()) (Account, deposit(double) (Self, withdraw(double)) (Self, hasReachedMax()) BoundedAccount deposit(double) getAmount():double hasReachedMax() Account deposit(double) withdraw(double)

4
Suppression dassemblage par retrait de méthode runningAccount pelAccount deposit(double) withdraw(double) getAmount():double deposit(double) withdraw(double) getAmount():double hasReachedMax() (Boundary, isFull(double)) (Account, deposit(double) Account Account++ unapply ceilingManagement ! hasReachedMax est requis par interestDeposit (Boundary, isFull(double)) (Self, getAmount()) (Account, deposit(double) (Self, withdraw(double)) (Self, hasReachedMax()) (Boundary, isFull(double)) (Self, getAmount()) (Account, deposit(double) (Self, withdraw(double)) (Self, hasReachedMax())

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google