hands down, best tutorials on youtube, keep it up. You are an impressive teacher, very easy to follow
@simplyexplained7 жыл бұрын
Thanks a lot!
@mohammadmohabsarhan39614 ай бұрын
I must say, whoever invented this is just a genius, Thanks for the tutorial.
@chikamichi5 жыл бұрын
Beware, in this video Xavier calls what's observed, a Subject. Yet the proper naming is "Observable". A Subject is an entity that may act as *both* an Observable and an Observer. It's the building block used in implementing Pub/Sub systems (think chat app, typically).
@ojuliomiguel4 жыл бұрын
Good!
@jananpatel9030 Жыл бұрын
7:47 why are we saying weatherStation.registerAObserver(this). Why aren't we using this.subject? This is the only part that confused me
@iqbalibrahim47132 жыл бұрын
Thank you for the video, before this I saw a video about observer pattern elsewhere but was not able to understand when needed more than one observer, your video explains really well and with good examples, deserve a like and subscribe
@elijah62832 жыл бұрын
Thank you, this is one of the best explanations of the observer design pattern implemented with TypeScript.
@raj.blazers6 жыл бұрын
Tutorials are damn good. Please post more design patterns.
@muliaarifandynasution5256 жыл бұрын
Awesome! I hope there are more videos about design patterns like this.
@hakart4115 жыл бұрын
thanks for your great tutorials there is one tiny problem in 'removeObserver' method . actually the problem is for 'splice' method and this is it : if passed observer to removeObserver method does not exist in the observers array the index become -1. then the splice remove last item from the observers array
@muhammadramzanali5843 жыл бұрын
Simply Explained! Great work!
@abdulkadirguven11732 жыл бұрын
Simple and clean explanation.Thank you ;)
@figidon-software6 жыл бұрын
If you are building a web-project you can also implement the observer pattern with events. Assuming you use jquery, it's as simple as: 1. Trigger the event with *$('body').trigger('weatherStation:tempChange', newTemp)* 2. Listen to event triggers with *$('body').on('weatherStation:tempChange', (e, newTemp) => { // logic to handle newTemp})* If you goto the Dev Tools you can see that youtube makes heavy use of custom events. In the Elements tab you can select an element, then see all the Event Listeners attached to it.
@Videosuser3 жыл бұрын
You are an impressive teacher,
@Antonym19782 жыл бұрын
Thanks for a clear explanation!
@lautaroleonhardt2600 Жыл бұрын
Need more videos like this!
@IslamGadzhiev10 ай бұрын
Why mixing the responsibilities and logic of observability between display classes and the weather station ? That is - in the constructor in Fan and TempretureDisplay classes you do: `weatherStation.registerObserver(this);`, which means that the Observer instance inside make the Subject register it. It's wrong, i think, instead the cleaner approach would be to make the Subject register the Observer separately from the Observer being able to update based on the Subject notifications.
@ManontheBroadcast7 жыл бұрын
Crystal clear explanation .. even i am not familiar with the TypeScript syntax but just plain JS , for once i think i managed to grasp this concept ...Thanks for sharing your knowledge ...
@simplyexplained7 жыл бұрын
+Man-on-the-Run Thanks man! I'm really trying to do my best with the videos.
@lukezzz4204 жыл бұрын
Hi, great tutorial! One question, shouldn't you set the return value of the functions in the interfaces to void if they return nothing? Else it will have the return type any...
@webmaker65765 жыл бұрын
Really Deserve appreciation
@Eriksonmagno3 жыл бұрын
Awesome tutorial
@H3000-v7i3 жыл бұрын
Why would you add a reference to the subject, in the observer?? If you the remove a observers, they will still carry unused reference. Seems like bad code to me? please correct me if im wrong.
@NagatoKamiPain Жыл бұрын
can you make this video with function as well?
@a.durgadevi80524 жыл бұрын
best tutorial . Thank you
@bhanuprathap31704 жыл бұрын
Great tutorial
@creative-commons-videos4 жыл бұрын
Can you please make a Playlist on building ORM in typescript using Object Oriented Programming, Just like Laravel Eloquent ?
@andredejager36373 жыл бұрын
Awesome, thank you
@hemanth69517 жыл бұрын
In Android also we are doing using same design pattern for callback methods
@coplain6 жыл бұрын
Savjee .. Thanks for the tutorial . One question though .. Imagine I have say I have large # of observers (say a billion) . Since we are using foreach loop to notify and its a O(n) operation ..by the time it reaches last observer another event happens the notify loop starts all over again.. how would we handle this scenario ? Let us say in environment like high frequency trading where trading happens in nanosecond time frames.. how can we handle this issue .. Thanks
@simplyexplained6 жыл бұрын
Hmmm you will always have O(n) is this system. Nothing you can do about that. However you could make your observers asynchronous and distributed. Being async will allow you to quickly go through the foreach loop (since you don't have to wait for the return values). After that you spread the load among a number of computers who all work on handling a part of the observers.
@coplain6 жыл бұрын
Thanks
@ys119710 ай бұрын
5:40 thank u :3
@melitt68136 жыл бұрын
good job! thanks!
@vladimirrabtsun4 жыл бұрын
Wow! Cool!
@aleksd2865 жыл бұрын
Thanks man
@hazartilirot10143 жыл бұрын
The examples are stolen from Head First Design Patters. :D