In PHP array, object implements this Iterator interface by default.
But of course you can implement it to add many more user-defined
functionalities to ease your development cycle.
Observer Pattern
You might wonder how these events actually work and how they are raised. Well, if
you are familiar with the Observer pattern, you can create event driven applications
easier than ever.
An Observer pattern solves a common problem in OOP. For example, if you want
some objects to be notified automatically when something happens (an event raised),
you can solve that problem with this pattern. Let us take a closer look.
An Observer pattern consists of two types of objects; one is an observable object,
which is observed by observer object. When the state of an observable object
changes, it notifies all observers registered with it.
So where can it be used? Actually it is being used everywhere. Think about a logging
application, which can log errors in different ways when an error occurs. Think
about a messenger application, which pops up when the latest message arrives.
Think about a web bulletin board where the latest messages display automatically
whenever a new message is posted.
Pages:
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104