1 00:00:00,840 --> 00:00:07,350 The observer pattern is the one to many relationship between objects such that whenever an object changes 2 00:00:07,350 --> 00:00:11,590 its state, all of the connected objects will change their state as well. 3 00:00:12,060 --> 00:00:17,070 This pattern is characterised by two types of objects, observers and subjects. 4 00:00:18,080 --> 00:00:23,500 As you may have guessed, the observer will watch for any change in the subject's behavior. 5 00:00:24,460 --> 00:00:31,360 In the Java API, the Java Dots 820 Dunbarton is an example where the observer pattern has been used 6 00:00:31,630 --> 00:00:37,360 due to the fact that you can define a listener for a button and whenever the button is click, the listener 7 00:00:37,480 --> 00:00:39,610 is notified and some event is triggered. 8 00:00:41,200 --> 00:00:47,080 The UML diagram of this pattern looks like this, you have an observer interface and many observer objects 9 00:00:47,080 --> 00:00:47,860 that implemented. 10 00:00:48,750 --> 00:00:55,320 The observer listens for changes in the subjects object state, and whenever such change occurs and 11 00:00:55,320 --> 00:00:56,160 action is triggered. 12 00:00:57,900 --> 00:01:03,540 Some of the weaknesses of the spatter can be the fact that a large object would have a very big hit 13 00:01:03,540 --> 00:01:05,370 on the performance of the application. 14 00:01:06,300 --> 00:01:11,290 Think about working with very large files, and whenever there is an update, you need to choose something 15 00:01:11,320 --> 00:01:12,840 in a 500 megabytes file. 16 00:01:14,520 --> 00:01:19,860 Another weakness is that some updates can be a bit confusing, making debugging more difficult. 17 00:01:21,060 --> 00:01:22,980 Let's see how this pattern can be implemented. 18 00:01:23,070 --> 00:01:23,180 The.