Man these videos are great. They are perfect. I've been looking everywhere for explanations for some of these design patterns and not a single person could explain them the way you did. Cheers!
Currently covering this topic in my Data Structures class, and this was such a helpful explanation of a confusing chapter. Seeing everything visualized really helped me grasp the concept. Much appreciated!
Yo that's actually insane. I am having a test next week in creational/ structural/ behaviour design patterns. How am I even supposed to remember all this. I am watching this video which are really nice and they explain really well but idk all of them at the same time to be examined. :/
I believe watching these two videos will help clarify the concept: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Vfk6sExu8-4.html & ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sN2_CoB_kbw.html Cheers!
It implements it and not extends it! Feel free to check our OOP basics video here: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Vfk6sExu8-4.html for more info :) You could name the interface anything you want, but in this series our main focus is explaining the patterns and why and when to use each of them! Cheers!
Great video! "class Product implements Box" sounds a bit off. I think renaming the "Box" interface to "PriceGettable" and "CompositeBox" to just "Box" makes more sense. // Nodes public interface PriceGettable { double calculatePrice(); } // Non-leaf nodes public class Box implements PriceCalculatable { private final List boxesOrProducts; @Override public double calculatePrice() { return boxesOrProducts.stream() .mapToDouble(PriceCalculatable::calculatePrice) .sum(); } } // Leaf nodes abstract class Product implements PriceCalculatable { final String title; final String price; } public class Book extends Product { @Override public double calculatePrice() { return getPrice(); } } public class Book extends Product { @Override public double calculatePrice() { return getPrice(); } }