100% found this document useful (13 votes)
648 views31 pages

TypeScript Design Patterns Guide

Introducing software design patterns to you in a simple, human readable, and funny (?) way - in the context of designing a soccer engine - By discussing the thought process behind applying design patterns
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (13 votes)
648 views31 pages

TypeScript Design Patterns Guide

Introducing software design patterns to you in a simple, human readable, and funny (?) way - in the context of designing a soccer engine - By discussing the thought process behind applying design patterns
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Introduction
  • Applying Observer Pattern
  • Classification
  • Applying Strategy Pattern
  • Applying Decorator Pattern
  • Conclusion and Appendix

!

" # $
% # $
% " &
% ' (
)* " +, + (
-* " + + + %+ (
.* " + % + /
* " + %0 + /
1
% " 1
' " 1
" ))
, "2 )-
! , 3 "2 )-
" " ).
% 3 " ).
4 3 " )
3 )$
)$
4 2 )&
3 )(
)/
% % )/
' % )/
% )1
% -5
% % -5
6 % 3 % -5
% 3 % -5
3 7 -)
-)
4 2 --
8 -.
% -.
' -.
-
-&
% 3 -&
! % 3 3 -&
0 9 3 3 -&
% 4 -(
! 3 -(
: ! 3 -/
3 -/
-/
4 2 .5

• ! ! ! "
# $ % & !

• & $

'( ) !
*( ) ! !
+( ) !
,( ) ! (

• ) ./0

. 1

• 2 ! ./0 3 ! ( !
2 ! " 4 2 "
(

5
6 ! (
7 & ! " 6 7
(
! (/ !
!
! (8
! # !
! 6 (
! ! ! 5
9 : ; : < < 3 = 9 !8
9$8 >
( 9 !8 9$8 ! !
(

! ($
" ! !
! (;
(

• & ( !
(
• & ! 6
! (
• & ! ./0 (

% ?
?

!
)
% ! ! 6 6 " % 8 9 5
@ (@ ! 8
! (0

• ; !
• ; !
• ; ! (

" !

8 ! ! 6 (8
2 (0
! - (

• %
• %
• A
!

• %

) ! 9 ! ( !
6

• "

• # (
• "$ (
• % (
6

• $ ! ! !

• $ ! ! (
• "

% ! (
(
! (( 9 5 9 ( 9
! ! (
(

Fig 1 - High level view

"

• ; 6
• ;
• ! ! (

8 ! ! !
(8 ! !
6 ! (

• #
o 4 ! !
! (
• "
o 4 !
5(( 8 &!
• "
o 8
&! (
• "$
o 5 ! ! "
!
! (

% ! (

" &
; ! (@
(

'( )# )

8 ! ! () !
! !
! ! (@ 2

!
! ! " #

$ % & ! !
% & ! ! ! ! #

$ ! 9$8 "
! $ (

(& ! " " 6


6 ! (

!
! (

*( ) )
) ")

@ ! (
!
5(( 8 &! (
% ! (

!
%
'## ( ) !&
! %
* & ! !
% * & #

% (

" (& ! ! !
(% !
(

+( ) " )

@ ! (8
! ! !
( (
" 8 &!
! (#
! 6 ! (

(
8 / ! &! ! (
# 8
/ ! (

! !! )
( " ! ! !! #

! !! %) ( " !
+! ! & $ % , &! "

& (

( 6 (
& ! ! !

,( ) "$ )

! ! !9
! ! (
! (;
! !
!
! (( !
!
! 5 (#
!! (

' ! ! !
- ! ! ! #
! $ % !&
% !& !" !
! #

# (% ! 6 !
!!
(

@ # (

)!

" !

. ! /
001/

"

! (! !

• ! !
" #

&

./0 ! (
Fig 2 - Observer Pattern

! (

! ! (% 6
! (8 % 6

- * !! " $
-*
$
-* Update
" #

. -

! ( !
@ !! ( % 6
(8 ConcreteSubject

-2 $
! ! !
! ! 6 ( $

-* ! "
!

! 6 ! 6
! (

-* !! #
! $ ConcreteObserver
GetState $ !
$ 3 #

@ ! (
(
Fig 3 - Solving Our First Design Problem

4 SetBallPosition ! !
Notify ! ! # ( @ !!
Update ! ! (4 . !
!
GetBallPosition ! 8 (

# -

!# (

' Subject : The Ball Class

Public Class Ball

'A private list of observers

Private observers As new [Link]

'Routine to attach an observer

Public Sub AttachObserver(ByVal obj As IObserver)


[Link](obj)
End Sub

'Routine to remove an observer

Public Sub DetachObserver(ByVal obj As IObserver)


[Link](obj)
End Sub

'Routine to notify all observers

Public Sub NotifyObservers()


Dim o As IObserver
For Each o In observers
[Link]()
Next
End Sub

End Class ' END CLASS DEFINITION Ball

# . -

!8 # (

' ConcreteSubject : The FootBall Class

Public Class FootBall


Inherits Ball
'State: The position of the ball

Private myPosition As Position

'This function will be called by observers to get current position

Public Function GetBallPosition() As Position


Return myPosition
End Function

'Some external client will call this to set the ball's position

Public Function SetBallPosition(ByVal p As Position)


myPosition = p
'Once the position is updated, we have to notify observers

NotifyObservers()
End Function

'Remarks: This can also be implemented as a get/set property

End Class ' END CLASS DEFINITION FootBall

!IObserver ( !
! ! 1 $ (

' Observer: The IObserver Class

'This class is an abstract (MustInherit) class

Public MustInherit Class IObserver

'This method is a mustoverride method

Public MustOverride Sub Update()

End Class ' END CLASS DEFINITION IObserver

" .

! ( ! IObserver

' ConcreteObserver: The Player Class

'Player inherits from IObserver, and overrides Update method

Public Class Player


Inherits IObserver
'This variable holds the current state(position) of the ball

Private ballPosition As Position

'A variable to store the name of the player

Private myName As String

'This is a pointer to the ball in the system

Private ball As FootBall

'Update() is called from Notify function, in Ball class

Public Overrides Sub Update ()


ballPosition = [Link]()
[Link]("Player {0} say that the ball is at {1},{2},{3} ", _
myName, ballPosition.X, ballPosition.Y, ballPosition.Z)
End Sub

'A constructor which allows creating a reference to a ball

Public Sub New(ByRef b As FootBall, ByVal playerName As String)


ball = b
myName = playerName
End Sub

End Class ' END CLASS DEFINITION Player

% .

!: ! (: ! !
IObserver

' ConcreteObserver : The Referee Clas

Public Class Referee


Inherits IObserver

'This variable holds the current state(position) of the ball

Private ballPosition As Position

'This is a pointer to the ball in the system

Private ball As FootBall

'A variable to store the name of the referee

Private myName As String

'Update() is called from Notify function in Ball class

Public Overrides Sub Update()


ballPosition = [Link]()
[Link]("Referee {0} say that the ball is at {1},{2},{3} ", _
myName, ballPosition.X, ballPosition.Y, ballPosition.Z)
End Sub

'A constructor which allows creating a reference to a ball


Public Sub New(ByRef b As FootBall, ByVal refereeName As String)
myName = refereeName
ball = b
End Sub

End Class ' END CLASS DEFINITION Referee

! (

'Position: This is a data structure to hold the position of the ball

Public Class Position

Public X As Integer
Public Y As Integer
Public Z As Integer

'This is the constructor

Public Sub New(Optional ByVal x As Integer = 0, _


Optional ByVal y As Integer = 0, _
Optional ByVal z As Integer = 0)

Me.X = x
Me.Y = y
Me.Z = Z
End Sub

End Class ' END CLASS DEFINITION Position

@ ! (4
! ! (
! (

'Let us create a ball and few observers

Public Class GameEngine

Public Shared Sub Main()

'Create our ball (i.e, the ConcreteSubject)

Dim ball As New FootBall()

'Create few players (i.e, ConcreteObservers)

Dim Owen As New Player(ball, "Owen")


Dim Ronaldo As New Player(ball, "Ronaldo")
Dim Rivaldo As New Player(ball, "Rivaldo")
'Create few referees (i.e, ConcreteObservers)

Dim Mike As New Referee(ball, "Mike")


Dim John As New Referee(ball, "John")

'Attach the observers with the ball

[Link](Owen)
[Link](Ronaldo)
[Link](Rivaldo)
[Link](Mike)
[Link](John)

[Link]("After attaching the observers...")


'Update the position of the ball.

'At this point, all the observers should be notified automatically

[Link](New Position())

'Just write a blank line

[Link]()

'Remove some observers

[Link](Owen)
[Link](John)

[Link]("After detaching Owen and John...")

'Updating the position of ball again

'At this point, all the observers should be notified automatically

[Link](New Position(10, 10, 30))

'Press any key to continue..

[Link]()

End Sub

End Class

% -

! 6
/ 0.
!

• 4 (
• 4 (

4 ! 1 % # (8

• $ 6
! 6
• # 6
(

; ! (
" "

(: ! "6
! (
(

• !
%
'## ( ) !&
• ! %* &
! ! % * & #

!
5(( 8 &! (
% ! (

( ! (
(0 % (

& "

% ( ./0 !% (

Fig - Strategy Pattern

! (

• "

! !
( !
(( ! !
%
& % %
&! (

• . "

(
! % (< ! !
+ 4 )

• . 1

1 ! (
6 ! (

"

@ % (
(

Fig - Solving Our Second Design Problem

; " , ! ( 2 "
" ! % (
!
! ! % &! % !
! " ! (4
, 5 ! , ! ! (B
( ! (
# ( ! !
(

"

" "

! % (

'Strategy: The TeamStrategy class

'This class provides an abstract interface


'to implement concrete strategy algorithms

Public MustInherit Class TeamStrategy

'AlgorithmInterface : This is the interface provided


Public MustOverride Sub Play ()

End Class ' END CLASS DEFINITION TeamStrategy

2 " . "

! % ( ! %

'ConcreteStrategy: The AttackStrategy class

'This class is a concrete implementation of the


'strategy class.

Public Class AttackStrategy


Inherits TeamStrategy

'Overrides the Play function.


'Let us play some attacking game

Public Overrides Sub Play()


'Algorithm to attack
[Link](" Playing in attacking mode")
End Sub

End Class ' END CLASS DEFINITION AttackStrategy

" . "

! &! % ( ! %

'ConcreteStrategy: The DefendStrategy class

'This class is a concrete implementation of the


'strategy class.

Public Class DefendStrategy


Inherits TeamStrategy
'Overrides the Play function.
'Let us go defensive
Public Overrides Sub Play()
'Algorithm to defend
[Link](" Playing in defensive mode")
End Sub

End Class ' END CLASS DEFINITION DefendStrategy

. 1

! (
(

'Context: The Team class


'This class encapsulates the algorithm

Public Class Team

'Just a variable to keep the name of team


Private teamName As String

'A reference to the strategy algorithm to use


Private strategy As TeamStrategy

'ContextInterface to set the strategy


Public Sub SetStrategy(ByVal s As TeamStrategy)
'Set the strategy
strategy = s
End Sub

'Function to play
Public Sub PlayGame()
'Print the team's name
[Link](teamName)
'Play according to the strategy
[Link]()
End Sub

'Constructor to create this class, by passing the team's


'name

Public Sub New(ByVal teamName As String)


'Set the team name to use later
[Link] = teamName
End Sub

End Class ' END CLASS DEFINITION Team

9 5
( (

'GameEngine class for demonstration


Public Class GameEngine

Public Shared Sub Main()

'Let us create a team and set its strategy,


'and make the teams play the game

'Create few strategies


Dim attack As New AttackStrategy()
Dim defend As New DefendStrategy()

'Create our teams


Dim france As New Team("France")
Dim italy As New Team("Italy")

[Link]("Setting the strategies..")

'Now let us set the strategies


[Link](attack)
[Link](defend)

'Make the teams start the play


[Link]()
[Link]()

[Link]()
[Link]("Changing the strategies..")

'Let us change the strategies


[Link](defend)
[Link](attack)

'Make them play again


[Link]()
[Link]()

'Wait for a key press


[Link]()

End Sub

End Class

% -

5 6 ! (
3

"
&
< ! ! - ($
8 / ! (

) 8
/ ! &! (# "
!
! ( ( ! C (%
(

! !! )
( " ! ! !! #

! !! %) ( " !
+! ! & $ % , &! "

&

& 6 (
( ./0 !&
(
Fig - Decorator Pattern

! (

• .

1 ! ! (0
(

• . .

1 1 ! 1 (
! 6 (

& ! 1 ( !
! ! ( ! 6
! (; !
& ! 1
(

• .

(
@ &
(

Fig - Solving Our Third Design Problem

) $ 4 "
! (4 5
(8 ''8 ($
8 &!
(4 ''! " ''!
'' ! !
! ( ! "
(

8 ! !
(

! 6 !
! ! (8
! / !
! ! ! !
(0 ! 6 ! 8
( $ ! ! &
(
% ( (

" .

' Component: The Player class

Public MustInherit Class Player

'Just give a name for this player


Private myName As String

'The property to get/set the name


Public Property Name() As String
Get
Return myName
End Get
Set(ByVal Value As String)
myName = Value
End Set
End Property

'This is the Operation in the component


'and this will be overrided by concrete components
Public MustOverride Sub PassBall()

End Class ' END CLASS DEFINITION Player

" . .

!8

' ConcreteComponent : Field Player class

'This is a concrete component. Later, we will add additional responsibilities


'like Forward, Defender etc to a field player.

Public Class FieldPlayer


Inherits Player

'Operation: Overrides PassBall operation


Public Overrides Sub PassBall ()
[Link](" Fieldplayer ({0}) - passed the ball", _
[Link])
End Sub

'A constructor to accept the name of the player


Public Sub New(ByVal playerName As String)
[Link] = playerName
End Sub

End Class ' END CLASS DEFINITION FieldPlayer

$ 4 . .
!9 B

' ConcreteComponent : GaolKeeper class

'This is a concrete component. Later, we can add additional responsibilities


'to this class if required.

Public Class GoalKeeper


Inherits Player

'Operation: Overriding the base class operation


Public Overrides Sub PassBall ()
[Link](" GoalKeeper ({0}) - passed the ball", [Link])
End Sub

'A constructor to accept the name of the player


Public Sub New(ByVal playerName As String)
[Link] = playerName
End Sub

End Class ' END CLASS DEFINITION GoalKeeper

" %

! :

'Decorator: PlayerRole is the decorator

Public Class PlayerRole


Inherits player

'The reference to the player


Protected player As player

'Call the base component's function


Public Overrides Sub PassBall()
[Link]()
End Sub

'This function is used to assign a player to this role


Public Sub AssignPlayer(ByVal p As player)
'Keep a reference to the player, to whom this
'role is given
player = p
End Sub

End Class ' END CLASS DEFINITION PlayerRole

!8

'ConcreteDecorator: Forward class is a Concrete implementation


'of the PlayerRole (Decorator) class

Public Class Forward


Inherits PlayerRole
'Added Behavior: This is a responsibility exclusively for the Forward
Public Sub ShootGoal()
[Link](" Forward ({0}) - Shooted the ball to goalpost", _
[Link])

End Sub

End Class ' END CLASS DEFINITION Forward

5 .

!/ 8

'ConcreteDecorator: MidFielder class is a Concrete implementation


'of the PlayerRole (Decorator) class

Public Class MidFielder


Inherits PlayerRole

'AddedBehavior: This is a responsibility exclusively for the Midfielder


'(Don't ask me whether only mid filders can dribble the ball - atleast
'it is so in our engine)

Public Sub Dribble()


[Link](" Midfielder ({0}) - dribbled the ball", _
[Link])
End Sub

End Class ' END CLASS DEFINITION Midfielder

!& !

'ConcreteDecorator: Defender class is a Concrete implementation


'of the PlayerRole (Decorator) class

Public Class Defender


Inherits PlayerRole

'Added Behavior: This is a responsibility exclusively for the Defender


Public Sub Defend()
[Link](" Defender ({0}) - defended the ball", _
[Link])
End Sub

End Class ' END CLASS DEFINITION Defender

'Let us put it together


Public Class GameEngine

Public Shared Sub Main()

'-- Step 1:
'Create few players (concrete components)
'Create few field Players
Dim owen As New FieldPlayer("Owen")
Dim beck As New FieldPlayer("Beckham")

'Create a goal keeper


Dim khan As New GoalKeeper("Khan")

'-- Step 2:
'Just make them pass the ball
'(during a warm up session ;))

[Link]()
[Link](" > Warm up Session... ")

[Link]()
[Link]()
[Link]()

'-- Step 3: Create and assign the responsibilities


'(when the match starts)

[Link]()
[Link](" > Match is starting.. ")

'Set owen as our first forward


Dim forward1 As New Forward()
[Link](owen)

'Set Beckham as our midfielder


Dim midfielder1 As New MidFielder()
[Link](beck)

'Now, use these players to do actions


'specific to their roles

'Owen can pass the ball


[Link]()
'And owen can shoot as well
[Link]()

'Beckham can pass ball


[Link]()
'Beckham can dribble too
[Link]()

' [ Arrange the above operations to some meaningfull sequence, like


' "Beckham dribbled and passed the ball to owen and owen shooted the
' goal ;) - just for some fun ]"

'-- Step 4: Now, changing responsibilities


'(during a substitution)

'Assume that owen got injured, and we need a new player


'to play as our forward1

[Link]()
[Link](" > OOps, Owen got injured. " & _
"Jerrard replaced Owen.. ")

'Create a new player


Dim jerrard As New FieldPlayer("Jerrard")
'Ask Jerrard to play in position of owen
[Link](jerrard)
[Link]()

'-- Step 5: Adding multiple responsibilities


'(When a player need to handle multiple roles)

'We already have Beckham as our midfielder.


'Let us ask him to play as an additional forward

Dim onemoreForward As New Forward()


[Link](beck)

[Link]()
[Link](" > Beckham has multiple responsibilities.. ")

'Now Beckham can shoot


[Link]()
'And use his earlier responsibility to dribble too
[Link]()

'According to our design, you can attach the responsibility of


'a forward to a goal keeper too, but when you actually
'play football, remember that it is dangerous ;)

'Wait for key press


[Link]()

End Sub

End Class

% -

! 6 ! (
.

• / (
• / " 6
• / ! ! D

" 6 6; " " *;; < " %

16 ( .

! = ->0 *;; < " ;-55/;5); ? ? ?? ?


6 ! 6

! .= ?0 *;; < " ;-55/;5); %? % ? ?


6 6

u0001
u0002u0003u0004u0005u0006u0007b	
u0003u000bu0001f
u0004u0004u000eu0005u0003u000fu0001u0004u0006u0001u0010u0006bu0001
u0003u0001
u0001u000f
u0011fu0012u000eu0013u0001u0014bu0011
u0003u0001
u0005u000e
u0007
u0015u0012u000eu0013u0001
u0003u0007u0001u0016bu0003u0003u0010u0001u0017u0018u0019u0001u001a
u0010u0013u0001u0015u0010u0001u0007
u000f	bu000fu000f
u0003u000bu0001u0004u0014u000eu0001
u0004u0014u0006bu000bu0014u0004u0001fu0005u0006	u000eu000fu000fu0001u0015u000eu0014
u0003u0007u0001
ffu0012
u0001u0002u0003u0004u0005u0003u0004u0006u0007
u0001
u0002u0003u0004u0005u0001u0006u0001u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007
u001du0005u0004u0003u0005u0014u001a%u0001u0002u0003u0005u0005u0014u0004	u0001u0006u001eu001fu0013u0014u001eu0014	u0005u0003u0005u000e
	u0001u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007u0007
u0001u0002u0003u0004u0005u0006u0005
u0001u0001
u0001u0002u0003u0004u0005u0006u0002u0007b	
u000bfu0006u0005
u000bu0005u000ebu000fu0010u0004u0005bu0011u0002u0004bu000bu0012u0007bu0004u0013
bu0014u0012u0005u0005
u0007u0013u000fu0001
u0015u0004u0016u0017bu0015
u0018
u0003u0002u0014
u000ebu000fu0019
u0013u001abu0010u0004u0005bu000bu0012u0007bu001bbu001c
u0005bu0006u0005bu0012u0013bu0012u0007b	u000bu0005u0006u0018
u001dbu000bu0002u0007u0005
u0002u0003u001eu000fu0001
u0006u0007
u0001
u001cu0001	u000fu0011u0005u0004u0005bu000bu0011bu0001	
u0006u0005u0005u0004!u0004	u0006bu0004u000fu0011u0001u000f!u0001
u0006bbu000bu0007u0011u0005u0001!u000fu0007u0001	u000fu0014u0014u000fu0011u0001u000eu000bu0005u0004u001eu0011u0001
u0007u000fu0016
u000bu0014u0005u0001u0006u0007u000bu0001
u0007u000fu001du0004u000eu000bu000eu0001u0016u0013u00015u0007u0004	u0003u0001
9u0006u0014u0014u0006u0015u0001:u0004	u0003u0006u0007u000eu0001;u000b
u0014u0015u0001:u0006

u0003u0001<u000fu0003u0011u0005u000f
u001c
u0005u000fu0015u0001u0013u000fu0012u0001u0014u0006u0013u0001u0011u000bu000bu000eu0001u0005u000fu0014u000bu0001
u000fu001eu0004	u0006
u0001u000fu00166u000b	bu0005u0001u0004u0011u0001u0013u000fu0012u0007u0001u001eu0006u0014u000bu0001u000bu0011u001eu0004u0011u000bu0015u0001
u0004u001fu000bu0001
• 
$u0002u001cu0012u0001u001au0003u0004	u0003u0001u000eu000b!u0004u0011u000bu0005u0001u0006u0001!u000fu000fbu0016u0006

u0001u001eu0006u0014u000bu0015u0001u001au0003u0004	u0003u0001	u000fu0011u0005bu0004bu0012bu000bu0005u0001b
• 

u0012u0002u001cu0005u0002u0007	u0005
u0012u0002u001cu001bu0004u0003u0002u0004u0012u0018"u0001u0001
o 
4u0003u000bu0011u0001bu0003u000bu0001u001eu0006u0014u000bu0001u0004u0005u0001u0004u0011u0001
u0007u000fu001eu0007u000bu0005u0005u0015u0001bu0003u000bu0001u000bu0011u000eu0001u0012u0005u000bu0007u0001	u0006u0011u0001	u0003u0006u0011u001eu000bu0001bu0003u000bu0001u0005bu0007u0006bu000bu001eu0013u0001u000f!u0001u0003u0004u0005u0001
bu000bu0006u0014u0001u00175(u001e(u0015u00018u0007u000fu0014u0001u001cbb
u000eu000fu0010u0003u0011u0007u0014u0003u000bu0003
u0015u0010u0005u0016u0003u0017u0012u0007u0013u001f
bu0007

!bu0005u0002bu0003
u0005bu0005f
bu0012u0003u001cu0002
u0006u0005fu0016b%*
u0012u0016u0001u0005
u0012u0005
u001cu0011&bu0018u0012
u0011bu0006u0007!
u0014
u0007!
u0007u0005u0003u0011b
 
u0002u0016bu000bu0003u0006
u0007u0005u0013b%u0006u0007bu0005fu0006u0013bu000bu0012u0013
u001abu0005f
b*
u0012u0016&bu0005
u000eu000fu0010u0003u0011u0007u0014u0003u000bu0003
u0015u0010u0005u0016u0003u0017u0012u0007u000fu001f
bu0007

!bu0005u0002bu0013
u0014u0012
u0012u0005
bu0005f
bu000bu0002u0007u0013u0005
u0004u000bu0005u0006u0002u0007bu0002 bu0012u0007bu0002u0017$
u000bu0005b%u001c
u0002u0004u0007!&b 
u0002u0016b
u0006u0005u0013b

u0014

u0013
u0007u0005u0012u0005u0006u0002u0007b%u0005f
bu0012u0014u0014
u0012
u0012u0007u000b
bu0002 b
u0001
Fig 2 - Observer Patternu0001
u0002u0003u000bu0001
u0006u0007bu0004	u0004
u0006u0011bu0005u0001u000f!u0001bu0003u000bu0001
u0006bbu000bu0007u0011u0001u0006u0007u000bu0001u000eu000bbu0006u0004
u000bu000eu0001u0016u000b
u000fu001a(u0001
u0001 
u001b
 -u0012u000bu0004u0001u0001
u0002u0003u0004u0005u0001	
u0006u0005u0005u0001
u0007u000fu001du0004u000eu000bu0005u0001u0006u0011u0001u0004u0011bu000bu0007!u0006

You might also like