Mediator Design Pattern

  Рет қаралды 117,835

Derek Banas

Derek Banas

Күн бұрын

Пікірлер: 106
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) Yes, design patterns are learned through practice. When a programmer gets to the point in which they begin studying topics like patterns, refactoring, OOD, etc. they have to become an artist rather then a rule follower. Most programmers never progress to that point. Anyone can paint by numbers, but great programmers expand their canvas through practice. Just my opinion
@pharoah327
@pharoah327 5 жыл бұрын
Well stated
@derekbanas
@derekbanas 11 жыл бұрын
You are correct that String.equals should be used, but == works in this situation because the == operator checks whether the references to the objects are equal.
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) I only do this because you guys have been so nice to me.
@derekbanas
@derekbanas 12 жыл бұрын
Thank you very much. I'm glad you're finding it useful :)
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) I'm glad you enjoy them. Yes you are correct it would be bad to eliminate that. At the time I deleted it just to get it out of the way.
@derekbanas
@derekbanas 12 жыл бұрын
I have that tutorial in the works along with Spring, Hibernate and much more. I'll see what I can sneak in while I make my Android / Games / C tutorial. Thanks for the compliments :)
@derekbanas
@derekbanas 11 жыл бұрын
Yes I should do an eclipse shortcut video. I try to avoid doing them only because I can never count on people seeing past tutorials. I try to make self contained videos whenever possible.
@ozgunozankilic
@ozgunozankilic 8 жыл бұрын
I have a very different educational background and I had serious doubts when I took the software design patterns course last semester. Your videos really helped me to understand design patterns and pass the course. Thanks a lot.
@derekbanas
@derekbanas 8 жыл бұрын
I'm very happy I could be of help :)
@ozgunozankilic
@ozgunozankilic 6 жыл бұрын
@@derekbanas Update in 2018: I am now assigned as the TA of the course. Better re-watch these.
@hurricanos13
@hurricanos13 12 жыл бұрын
Very nice tutorial, this is ever the best video tutorial covering such confusing subject for software developers.
@derekbanas
@derekbanas 11 жыл бұрын
If you made it all the way to the design patterns tutorials youre ready for Android. The only thing that seems to confuse people is the heavy use of the MVC pattern. If you're comfortable with that you shouldn't have any problems. Feel free to ask me questions
@derekbanas
@derekbanas 11 жыл бұрын
Yes you are correct.
@sharathkumar9876
@sharathkumar9876 11 жыл бұрын
Hi Derek! Thank you so much. I cannot tell you how much your tutorials have helped me :)
@derekbanas
@derekbanas 12 жыл бұрын
You're very welcome as always :)
@StrangerSaret
@StrangerSaret 5 жыл бұрын
This video deserves like even for Colleagues classes names))
@smuralimohan1
@smuralimohan1 11 жыл бұрын
Hi Derek, a thing about shortcuts. In eclipse, the getter/setter methods and constructor can be created in a single click by placing the mouse inside the class body, right-click->source->Generate Getters and Setters and right-click->source->Generate Constructor using fields. I am sure you must be aware of those, but if included in your videos, other viewers too can learn.
@riteshk9879
@riteshk9879 9 жыл бұрын
need a simpler example
@ashrasmun1
@ashrasmun1 7 жыл бұрын
There are two guys and they talk with mediator only. They can give stuff to him or get stuff from him. I cannot imagine a simpler example.
@PENDANTturnips
@PENDANTturnips 7 жыл бұрын
I cant tell if im stupid but I get lost in a lot of this guys videos.
@Noname0324
@Noname0324 7 жыл бұрын
Same here, I found his videos explains very little in the big picture and ideas, instead he just jumps into a lot of coding after the first 20 seconds or so.
@hexrcs2641
@hexrcs2641 6 жыл бұрын
It feels like a server-clients pattern...
@hexrcs2641
@hexrcs2641 6 жыл бұрын
Wait, feels like a mediator is like the bittorrent tracker and the colleagues are the peers
@bryantkong4642
@bryantkong4642 10 жыл бұрын
hey,teacher Derek. I have finished all your design pattern tutorials today, it is really helpful.
@derekbanas
@derekbanas 10 жыл бұрын
siyi Kong Thank you :) I'm very happy that I could help.
@derekbanas
@derekbanas 12 жыл бұрын
Thank you :) I very much appreciate that
@herp_derpingson
@herp_derpingson 12 жыл бұрын
Many of these Design Patterns are so similar that its easy to get confused :)
@sunmustbedestroyed
@sunmustbedestroyed 10 жыл бұрын
I have watched SooooOoo many of your videos now that "Well, hello internet!" and "please leave any questions or comments in the comments' section below: otherwise till next time." are now firmly ingrained in the speech centers of my brain (a bit like ghosting/retention of a menu on a plasma TV screen). I love it though!
@derekbanas
@derekbanas 10 жыл бұрын
John Thank you :) Many more videos are coming.
@usmansbk
@usmansbk 3 жыл бұрын
I see Mediator patter as basically dependency inversion principle
@Floyd-df2uq
@Floyd-df2uq 19 күн бұрын
Spot on. I was thinking the same thing.
@noherczeg
@noherczeg 8 жыл бұрын
I'm so grateful for your channel! It's a really nice thing to see someone use examples outside of the bullshit todo app stuff.
@derekbanas
@derekbanas 8 жыл бұрын
You're very welcome :)
@jamiemarshall8284
@jamiemarshall8284 7 жыл бұрын
In this pattern - wouldn't you need to make your Mediator a singleton? BTW - love these. It's like tutorials for programmers.
@tonyzhao904
@tonyzhao904 9 жыл бұрын
The video is awesome. I only spot one missing line of code in the video, which is: in "Colleague.java", the constructor doesn't have: mediator.addColleague(this); This would cause the collegecode number never reaches 2 or even 1 as shown in the results. But code in the given link is correct. Thanks again for the tutorial.
@subhashkonda5000
@subhashkonda5000 7 жыл бұрын
Whats the use of colleguecode, seems to know who is the source but i haven't seen it is used. Basically how it will stop notifying the source.
@hexrcs2641
@hexrcs2641 6 жыл бұрын
Why do you remove all the @override annotations?
@derekbanas
@derekbanas 12 жыл бұрын
Sometimes I do things the long way to collect my thoughts. Its hard for me to talk and type at the same time sometimes :)
@galtfilin2580
@galtfilin2580 9 жыл бұрын
סרטון מעולה! תודה רבה על העזרה! great video! you helped me a lot... thank you so much!
@derekbanas
@derekbanas 9 жыл бұрын
+gal tfilin You're very welcome :)
@glebsamsonov7696
@glebsamsonov7696 7 жыл бұрын
Very cool tutorial series. Don't know if somebody's already mentioned it but in this one you use reference comparison for strings and that only works because you use string literals like String s = "GOOG" so that same string object is taken from the string pool and reused. Otherwise for strings you should always use equals method.
@123japanuser
@123japanuser 12 жыл бұрын
Sincere gratitude to you Sir. No medals for me ...a sorry fourth
@xipity
@xipity 7 жыл бұрын
Dude.. Seriously... Is there a "donate" button or something... I admire you!
@derekbanas
@derekbanas 7 жыл бұрын
Thank you very much :) There is no need to donate. If you don't mind turning off AdBlock, if you use it, I'd appreciate that. Otherwise it is my pleasure to help.
@sharathkumar9876
@sharathkumar9876 11 жыл бұрын
Hi, is the mediator pattern particularly used to tackle objects that have many-to-many relationships?
@pankajtiwari12
@pankajtiwari12 10 жыл бұрын
Great presentation !
@derekbanas
@derekbanas 10 жыл бұрын
Thank you :)
@elysiafilm6215
@elysiafilm6215 4 жыл бұрын
This is an awesome explanation! Thank you, very helpful :)
@derekbanas
@derekbanas 4 жыл бұрын
Thank you :) Happy I could help
@aloneirew
@aloneirew 11 жыл бұрын
Hey Derek, Love your videos and the way you teach those stuff, i've almost seen all you design pattern videos and im planning to start the UML next, thanks a lot for your time!. Btw - why do you remove the @override annotation sometimes?..seems like a bad practice..
@anjana852
@anjana852 9 жыл бұрын
Thank you! these videos are great !
@derekbanas
@derekbanas 9 жыл бұрын
+anjana852 Thank you :) You're very welcome
@eubor8539
@eubor8539 10 жыл бұрын
Just a question. Why did you removed "@Override" annotations?
@pharoah327
@pharoah327 5 жыл бұрын
They aren't actually necessary. They are just there to give the compiler a hint as to the fact that you are trying to override a super class' (or an interface) method. If, for example, you spell the method name wrong or give it the wrong signature/header, the compiler will complain. Without @Override, if you make a mistake in the signature, the compiler will just think it is a new method and not give you any errors/warnings. So the @Override is just a safety in case you make a mistake.
@pushkarajpatil4787
@pushkarajpatil4787 8 жыл бұрын
Hello Derek, Thank you very much for this video, I have a question about this (mediator) design pattern, what is the role of colleague code while transaction is going on. I don's see any use apart from the print, is it really required?
@laststandingdeplorablemgto3637
@laststandingdeplorablemgto3637 7 жыл бұрын
Thanks for the vid. How is synchronization involved in this when Colleagues work in parallel? You need then synchronized methods in the Mediator, either on its entire class or on its internal resources if it is possible to get a more granular ie faster synchronization.
@laststandingdeplorablemgto3637
@laststandingdeplorablemgto3637 7 жыл бұрын
In your example you would probably synchronize upon Mediator.class because sell buy collections are interdependent of each other.
@UCBCteam
@UCBCteam 12 жыл бұрын
Hello Derek.... very nice videos I have learnet alot from your videos.. espacially, both java and design patterns... just wondering if you could give us some tutorials on JSP and Servlets... a bit advance level... thanks
@Arsene013
@Arsene013 Жыл бұрын
10 years old but still relevant
@derekbanas
@derekbanas 12 жыл бұрын
Almost SawMan :)
@jovcemalakovski9148
@jovcemalakovski9148 5 жыл бұрын
Nice tutorial Derek, useful even today after 8 years. But what I've noticed is that you never used the addColleague method on the mediator and you got correct result in the console output. I was following the example in c# and got wrong colleagues codes, which makes sense because the add method was never used.
@mohammedhasan946
@mohammedhasan946 8 жыл бұрын
you gave me great help thank you
@derekbanas
@derekbanas 8 жыл бұрын
You're very welcome :)
@amirkobliansky4022
@amirkobliansky4022 9 жыл бұрын
great video! helped me a lot. tank you:)
@derekbanas
@derekbanas 9 жыл бұрын
Amir Kobliansky Thank you :) I'm glad it helped
@sayedthebacktracker
@sayedthebacktracker 8 жыл бұрын
hi.. Thank you for the video.. I have learned a lot.. Just a quick question.. I am desiging a protocol..which design pattern I can use for following scenerio? From my pc , I send request every milliseconds to another hardware.. then hardware send me response and I send acknowledgement for that request and do necessary task.. It is all about sending request and response.. It would be great help for me if you can give me some idea how to maintain it.. I am using Java RxTx API for serial communication.. Sorry for long message.. Thank you in advance
@keent
@keent 3 жыл бұрын
I know this is a 8 year old video but this still might find useful for someone. If you managed to got it to the end, you might wonder why your colleague code is `undefined` and found out that the video doesn’t show where to use the `addColleague` method. Here’s my simple solution (using JS Typescript btw): put this code `this.mediator.addColleague(this); ` inside your `Colleague` constructor. hope it helps :)
@CyrilViXP
@CyrilViXP 7 жыл бұрын
It's really hard to find the case, when Mediator pattern can't be implemented as Observer
@johnlock8496
@johnlock8496 9 жыл бұрын
great tutorial
@derekbanas
@derekbanas 9 жыл бұрын
john lock Thank you :)
@smuralimohan1
@smuralimohan1 11 жыл бұрын
Which pairs of design patterns do you find similar/confusing? Could you please post your question so it gives us a chance to think about their nuances and get a better understanding of their applicability?
@derekbanas
@derekbanas 12 жыл бұрын
You guys are funny :)
@akshay288
@akshay288 3 жыл бұрын
Derek Bansa seems to working for Ibank or providing service to ibanks
@farazshah5651
@farazshah5651 3 жыл бұрын
Awesome!!!
@herp_derpingson
@herp_derpingson 12 жыл бұрын
You are the man Saw Man! XD
@monicajanethsalasrodriguez6287
@monicajanethsalasrodriguez6287 10 жыл бұрын
#Hola Buena explicación.
@derekbanas
@derekbanas 10 жыл бұрын
Mónica Janeth Salas Rodríguez Gracias :)
@rickmonarch4552
@rickmonarch4552 6 жыл бұрын
Could u make a chat program with this? :D
@bigworldmemes
@bigworldmemes 5 жыл бұрын
yes, that's actually how chat programs work, you send data to the server, server sends it to the colleague that you specify, most chat programs aren't peer-to-peer
@bigworldmemes
@bigworldmemes 5 жыл бұрын
server in this context is the mediator
@bigworldmemes
@bigworldmemes 5 жыл бұрын
one might argue though, that with chat rooms you are communicating between 2 OBJECTS of the same type, not 2 CLASSES
@CaponordRevHappy
@CaponordRevHappy 7 жыл бұрын
Simple, now that's explained!
@derekbanas
@derekbanas 7 жыл бұрын
Thank you :)
@AlphaMatt1000
@AlphaMatt1000 4 жыл бұрын
Ridiculously overcomplicated to demonstrate this pattern, and I have 25 years experience building software professionally for many large organizations.
@MrChingy5555
@MrChingy5555 5 жыл бұрын
for some reason this looks alot like the observer pattern
@AlexEttelis
@AlexEttelis 12 жыл бұрын
Did you know you can double click a word to select it? no need to select char by char :D
@ziv4545
@ziv4545 8 жыл бұрын
what is GOF? 1
@derekbanas
@derekbanas 8 жыл бұрын
This is the Gang of Four book amzn.to/2by0iZf
@fancyjohn
@fancyjohn 8 жыл бұрын
Like a dispatcher with event emitting/subscription
@faithnassiwa
@faithnassiwa 8 жыл бұрын
Hi Derek! Great videos, they helped me understand better patterns i had failed to click. Do you have any video tutorials on:- 1. Data access Object (DAO) 2. Transfer Object pattern 3. Java Connector Architecture (JCA) 4. Service Starter Pattern 5. Payload Extractor Pattern ???
@derekbanas
@derekbanas 8 жыл бұрын
+faith nassiwa Thank you :) Sorry I don't. I hope to cover them soon.
@StormCraftable
@StormCraftable 7 жыл бұрын
String comparrison with == ? o.O
@zss123456789
@zss123456789 4 жыл бұрын
It's kind of funny because the nyse is the actual broker.
@OverG88
@OverG88 12 жыл бұрын
Ok.
@Vendettaaaa666
@Vendettaaaa666 10 жыл бұрын
this is exact opposite of observer pattern.
@minaamir2648
@minaamir2648 3 жыл бұрын
example is used to explain the idea , now we need to explain the example .. !! need a simple example as airport
@MusicalSawMen
@MusicalSawMen 12 жыл бұрын
Second !!!!!!!!!!!!!!!!!!!!!!!!!
@Tomas970506
@Tomas970506 5 жыл бұрын
Your coding examples sometimes are far to much to explain people what you want to explain.
@expertreviews1112
@expertreviews1112 6 жыл бұрын
wow i understood NOTHING! The example took me to moon and back.
@Brainsucker92
@Brainsucker92 4 жыл бұрын
I had a massive cringe when I saw the string comparison via the "==" operator...
@iforgot669
@iforgot669 4 жыл бұрын
But in many languages this is how you do do string comparisons and design patterns are language agnostic. Even if that's syntactically wrong in the case of Java i think it removes clutter for anyone coming from a different language. Not saying it was intentional, but I just don't see it as a problem for the use case of this video.
@Brainsucker92
@Brainsucker92 4 жыл бұрын
@@iforgot669 It's not syntactically wrong but fuctionally wrong. The "==" operator simply does not do what your're trying to achieve in this context.
@iforgot669
@iforgot669 4 жыл бұрын
@@Brainsucker92 So your saying it's the wrong syntax for comparison; as in, syntactically wrong. I didnt say it wouldn't compile.
@Brainsucker92
@Brainsucker92 4 жыл бұрын
@@iforgot669 No, I'm saying it's the wrong functionality for comparison...
Memento Design Pattern
20:30
Derek Banas
Рет қаралды 104 М.
Decorator Design Pattern
12:57
Derek Banas
Рет қаралды 429 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
Visitor Design Pattern
13:31
Derek Banas
Рет қаралды 281 М.
Template Method Design Pattern
14:05
Derek Banas
Рет қаралды 149 М.
State Design Pattern
20:51
Derek Banas
Рет қаралды 242 М.
Observer Design Pattern
22:27
Derek Banas
Рет қаралды 665 М.
Starting with Haskell - An Introduction for Beginners
1:01:25
LigerLearn
Рет қаралды 1,9 М.
Abstract Factory Design Pattern
13:20
Derek Banas
Рет қаралды 500 М.
Iterator Design Pattern
22:47
Derek Banas
Рет қаралды 174 М.
Adapter Design Pattern
12:31
Derek Banas
Рет қаралды 313 М.
Component Diagrams - Examples
4:30
Software Design
Рет қаралды 1,4 М.
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН