Observer Design Pattern

Concept, photos, videos, examples, construction



Get the Code: http://goo.gl/EYGnQ Best Design Patterns Book : http://goo.gl/W0wyie Welcome to my Observer Design Pattern Tutorial. I cover a lot in this tutorial including the Observer pattern, how to use it with threads and much more. The Observer pattern is a software design pattern in which an object, called the subject (Publisher), maintains a list of its dependents, called observers (Subscribers), and notifies them automatically of any state changes, usually by calling one of their methods.

Comments

  1. @Derek Banas Can you please make a video of Pub/Sub Design Pattern ?
  2. Hi Derek ! Very nice and helpfull tutorial ! I am a begginer in java! So, I would like to ask you why in StockObserver.java variable stockGrabber is declared as Subject and not as StockGrabber ?
  3. Best tutorial series ever. I lost some classes (at college) cause I had to travel. So I started searching and ended on Derek's channel. Just got a college work finished by watching the Android for Beginners Tutorial. I just wanna say: Thank you Bro, for taking your time and making this AWESOME, extreme good quality material to us and for free! Regards, Rafael - from Brazil.
  4. Loved this video :)!
  5. Sensacional, vou usar como referência em minhas palestras.
  6. 10:22 - 10:24 how did you do that (replace all those texts), was that a jumpcut? im new on Java and currently working with intellij. maybe i need to switch to eclipse. BTW, your videos are awsome
  7. Great stuff but, kind of too fast for me. Not complaining because I like how you present. Reading a book on Design Pattern simultaneously helps me understand clearly. Thanks :)
  8. Why do you use ArrayList to define the list field, and not just List<Observer> and later define the implementation of List?

    also, if you're adding and removing from a list, isn't it better to used a linked list for better performance?
  9. Wow! thank you man. I'm a student of computer science and we never get in touch with those topics, only the basics and the fact that i can learn from your videos is just amazing so thank you so much.
  10. Hey Derek, love the videos! Just curious, would you be able to start attaching the src file on your "Get the Code" page. It would make it much easier to play with the code if I could just import it into my IDE.
  11. Insert generic comment about java being inferior to asembler, to startstandard shiiStorm

    Yet, I personally have to say that this video, created more questions at beggining, than answers... I personally feel (as person who never knew about such an topic, that you should ... make it more obvious what are we doing ... idk, maybe I am just stupid
    :( I get a Idea what are we doing after reading wikipedia page at 9:30, which is basicly not the point of video i guess... Just saying.
  12. , You wrote at the beginning each observer represents one stock, but later in your code you represent an observer as a peerson that gets information of all stocks.
  13. Thanks for the video, I love the whole series of the programming adventures =)
  14. These videos really helped me quick revise design patterns before interviews. Even when i play at 2x speed i can clearly understand what Derek is saying. All examples are fun and easy to remember. Thanks for such amazing tutorial.
  15. if i remove a observe from the list what will happen to the notifyObserver method because it is giving update to three observer but it currently have 2 observer(update method has 3 parameter i think it will throw an error if i delete an observer)
  16. Everything r nice, but as for me, for better understanding you can added @Override annotation for more clearly in some moments :)
  17. I don't know if you would be able to unravel this out of context, but I am doing this in C++, and using the code as-is causes issues (specifically I keep getting LNK2019 in VS2013). I am thinking the register/unregister/notify etc. all need to take pointers to the objects as values, i.e. function (Observer o). I did this, and made all the tumble down changes, but I am actually still getting LNK2019 errors. I think it might stem from having to use vector<Observer> instead of ArrayList<Observer>, which could also be vector<Observer> or just like I had before. Any ideas? I know that's not much to go on, but basically I wanted to know if you have done this in C++ before, and encountered similar problems. Thanks! As always, the videos are great!
  18. Ok I understand, StockObserver has a stockGrabber to register him in his constructor right ?
    so in the main we just have to do:
    StockGrabber sg1 = new StockGrabber();
    StockObservet so1 = new StockObserver(sg1);// sg1.register(so1);
    It's just faster but we can avoid to add a StockGrabber into StockObserver can we?
  19. Hi, i have a question:
    I don't understant why StockObserver has a stockGrabber attribute in his class.
    Can you explain me why ?


Additional Information:

Visibility: 303100

Duration: 22m 27s

Rating: 2374