Great video, but I’ve seen people do the same as you demonstrate, but they call it ‘decorator pattern’. How does chain of responsibility differ from the decorator pattern?
The chain-of-responsibility pattern is structurally nearly identical to the decorator pattern, the difference being that for the decorator, all classes handle the request, while for the chain of responsibility, exactly one of the classes in the chain handles the request.
Same here Mamdough, same here :) It's pretty incredible how many design patterns Taylor and the Laravel team use behind the scenes. I can't tell you how many times I've been confused while learning up on a design pattern, then finally got it after seeing it implemented properly within Laravel.
I'd recommend using a different pattern than the Chain of Responsibility for something like that. You could simply have an array of functions, and map through them if you want distinct values returned. Otherwise, if you want a single build up object that gets handed off from one function to the next you can use reduce.
This was one of the best PHP design pattern videos on youtube. I am looking forward to your next upcoming videos on design pattern.😃
Coming soon!
I just realized this video is 4 years old. Wow!
It's still really useful. Thank you!
Glad it was helpful!
Great video's, thanks to you I've finally understood my own bad coding patterns and helped me remove a few that I learned over the past few years
Nice work!
Thanks, really enjoy the design principle tutorials in Php :)
Good to hear, I really enjoy making design principle lessons in Php :)
thanks for your great content , awesome explanation : D
Glad it clicked for ya ~ Chain of responsibility is a golden design pattern
Great video, but I’ve seen people do the same as you demonstrate, but they call it ‘decorator pattern’. How does chain of responsibility differ from the decorator pattern?
The chain-of-responsibility pattern is structurally nearly identical to the decorator pattern, the difference being that for the decorator, all classes handle the request, while for the chain of responsibility, exactly one of the classes in the chain handles the request.
Love this content homie keep it up !
Will do, thanks for the support Milan!
Thanks, love Laravel because it handles this behind the scene for us :D
Same here Mamdough, same here :)
It's pretty incredible how many design patterns Taylor and the Laravel team use behind the scenes.
I can't tell you how many times I've been confused while learning up on a design pattern, then finally got it after seeing it implemented properly within Laravel.
@@CleanCodeStudio Those guys are amazing just like u :)
Can I implement this to have a chain of process and have some checks to return instead of doing a next() ?
I'd recommend using a different pattern than the Chain of Responsibility for something like that.
You could simply have an array of functions, and map through them if you want distinct values returned.
Otherwise, if you want a single build up object that gets handed off from one function to the next you can use reduce.
very useful
Glad to hear that
Coming from X