Тёмный

The Observer Design Pattern in C++ - Part 2 of n - Extensibility and Abstraction 

Mike Shah
Подписаться 20 тыс.
Просмотров 2,8 тыс.
50% 1

►Software Design and Design Patterns Playlist: • C++ Software Design an...
►Find full courses on: courses.mshah.io/
►Join as Member to Support the channel: / @mikeshah
►Lesson Description: In this lesson we continue our discussion of the Observer pattern, this time improving it with abstraction and creating an interface.
00:00 Introduction
00:27 Recap of previous lesson
03:05 Adding an interface to our subject and observer overview
05:30 Code walk through of what we are going to build.
06:52 Code Implementation of IObserver and Watcher
11:56 Code implementation of ISubject and SomeSubject
14:25 Test case of observer pattern
16:30 Review of what we coded
17:12 Pros and cons of current implementation
19:15 Conclusion
►RU-vid Channel: / mikeshah
►Please like and subscribe to help the channel!
►Join our free community: courses.mshah.io/communities/...

Наука

Опубликовано:

 

20 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 13   
@rohrbold
@rohrbold Год назад
Great series Mike. I really love how you provide a step-by-step guidance from a naïve implementation to more sophisticated solutions. That’s a powerful way how students can better understand why the pattern ended up this way. Really inspiring, thanks a lot.
@MikeShah
@MikeShah Год назад
Cheers, thank you for the kind words! There's at least another 2 more episodes coming to continue building on the implementation 😀
@user-ql7pw7ld1n
@user-ql7pw7ld1n 3 месяца назад
Fantastic,....understood fully :)
@MikeShah
@MikeShah 3 месяца назад
Cheers!
@liteal
@liteal 9 месяцев назад
Oh hi. I saw this guy on the conference :)
@MikeShah
@MikeShah 9 месяцев назад
Hello! Welcome!
@k0185123
@k0185123 3 дня назад
Hello Prof. Shah, thanks again for your video! I watched your CppCon lecture about the observer pattern and the part 1 and 2 of the observer pattern on your personal channel. One thing that I've been thinking is what if we want those observers to communicate with each other? For example, the observer 1 tells observer 2 if the angry bird hit the stone, and the observer 2 use the final position and the velocity of the bird to see if it should become "multiple small birds". So, in this case, the observer 2 needs the input from both the subject and the observer 1. It'd be something like inheritance-based observer pattern? Is there such a design pattern? Thank you! :)
@MikeShah
@MikeShah 2 дня назад
Observers can certainly 'observe' each other (i.e. one observe is the 'subject' of the other). If you think there's a lot of these types of dependencies, I might suggest some sort of 'event' system -- i.e. The observe posts events to some queue of 'hey this thing happened, now consume the event and do something with that data to create the small birds'. Check out 'event queues' or perhaps even the 'mediator pattern'
@k0185123
@k0185123 2 дня назад
@@MikeShah Thank you so much for your help! I will look into them and see what I can do! :) Have a nice weekend!
@MikeShah
@MikeShah 2 дня назад
@@k0185123 Cheers!
@valtovar
@valtovar Год назад
Hi, really great series! Thanks for sharing this with the community. It would be good if you also talk about performance on each implementation. Is there any penalty in performance by using this approach with (virtual) interfaces? Are there other options that can work better in this regard? Can we use this code in, for example, the game main loop code?
@MikeShah
@MikeShah Год назад
Cheers, thank you for the kind words! Good idea, I think I'll touch on a few of those things in some later parts coming up 🙂
@TheGobou77
@TheGobou77 10 месяцев назад
"Yes, I know you can't read this. You can download and read this later :)"
Далее
Hamster Kombat 20 July Mini Game
00:13
Просмотров 9 млн
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Просмотров 6 млн
How to Measure ANY Cliffs Height with a Rock
00:46
Cpp2 - First Impression [Programming Languages Episode 27]
1:08:19
8 Design Patterns EVERY Developer Should Know
9:47
The Only Unbreakable Law
53:25
Просмотров 320 тыс.
ASMR Programming - Spinning Cube - No Talking
20:45
Просмотров 3,7 млн
Самый быстрый пылесос!
0:30
Просмотров 22 тыс.
iPhone 16 - НЕ СТОИТ ПРОПУСКАТЬ
4:50