The Composite Pattern Explained and Implemented in Java | Structural Design Patterns | Geekific

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024

ความคิดเห็น • 32

  • @fastexpand
    @fastexpand ปีที่แล้ว +17

    Now I can skip 3 hours of class going over this and completely understand it in 5 minutes! Good freaking job!

  • @BoonkiCoC14
    @BoonkiCoC14 2 ปีที่แล้ว +15

    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!

    • @geekific
      @geekific  2 ปีที่แล้ว

      Wow! Glad you like them :) Thanks a lot

  • @kineticBoss
    @kineticBoss ปีที่แล้ว +2

    Your videos definitely provide a starting point in understanding clearly what a certain design pattern is.
    This is great.

  • @sarabloss1
    @sarabloss1 2 ปีที่แล้ว +2

    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!

    • @geekific
      @geekific  2 ปีที่แล้ว

      You're very welcome! Glad it was helpful :)

  • @harveynorman8787
    @harveynorman8787 11 หลายเดือนก่อน +2

    Fantastic example and explanation

  • @DemystifyFrontend
    @DemystifyFrontend 13 วันที่ผ่านมา

    Well explained

  • @derekdevs
    @derekdevs ปีที่แล้ว

    Thank you for this series. It's been very helpful!

  • @manalahmadi992
    @manalahmadi992 2 ปีที่แล้ว

    I have to say that your videos are so helpful. Thank you very much

    • @geekific
      @geekific  2 ปีที่แล้ว

      Glad you like them!

  • @AymenTDD
    @AymenTDD 2 ปีที่แล้ว

    Thank you so much, u're saving me in the night of an exam ❤️❤️❤️

    • @geekific
      @geekific  2 ปีที่แล้ว +1

      That's exactly why am here

  • @mintdu
    @mintdu ปีที่แล้ว

    it is really helped me alot! thank you very very much !

  • @ception3513
    @ception3513 ปีที่แล้ว

    Thanks, great job!

  • @seuz7520
    @seuz7520 11 หลายเดือนก่อน

    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. :/

    • @geekific
      @geekific  11 หลายเดือนก่อน +1

      Good luck with your test! Let us know if we can help you further :)

    • @seuz7520
      @seuz7520 11 หลายเดือนก่อน

      @@geekific thanks for the support !!

  • @andresdiaz2737
    @andresdiaz2737 ปีที่แล้ว

    Very helpful indeed. IAre composite pattern and composition (meaning composition instead of regular inheritance in java ) the same concept?

    • @geekific
      @geekific  ปีที่แล้ว

      I believe watching these two videos will help clarify the concept: th-cam.com/video/Vfk6sExu8-4/w-d-xo.html & th-cam.com/video/sN2_CoB_kbw/w-d-xo.html Cheers!

  • @aldolunabueno2634
    @aldolunabueno2634 4 หลายเดือนก่อน

    4:25 The UML diagram is missing the has-a relationship from Composite class to Component internface.

    • @miichy4
      @miichy4 2 หลายเดือนก่อน

      that's right

  • @xintongma2976
    @xintongma2976 ปีที่แล้ว

    thanks

  • @engsalahmahmoud2418
    @engsalahmahmoud2418 2 ปีที่แล้ว

    Thanks,

  • @shopdemo6384
    @shopdemo6384 2 ปีที่แล้ว

    what a good video

    • @geekific
      @geekific  2 ปีที่แล้ว

      Thank you!

  • @dadlord689
    @dadlord689 2 ปีที่แล้ว

    When you have a Book that is a Box (extending the Product : Box class) - you are confused.

    • @geekific
      @geekific  2 ปีที่แล้ว +1

      It implements it and not extends it! Feel free to check our OOP basics video here: th-cam.com/video/Vfk6sExu8-4/w-d-xo.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!

  • @AfriandiHaryanto
    @AfriandiHaryanto ปีที่แล้ว

    What is the difference between Composite and Decorator?

    • @geekific
      @geekific  ปีที่แล้ว

      Please check the Decorator video here: th-cam.com/video/v6tpISNjHf8/w-d-xo.html

  • @N00BRIUM
    @N00BRIUM ปีที่แล้ว

    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();
    }
    }

    • @geekific
      @geekific  ปีที่แล้ว

      Thanks for the effort and feedback :)