How does Builder Design Pattern solves problems like URL creation?

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • Learning system design is not a one time task. It requires regular effort and consistent curiosity to build large scale systems. Moreover, every system has different requirements and meeting them requires expertise and people with varied and specific knowledge. There are a lot of resources to learn through videos. But not everyone enjoys that mode of learning. Instead some people understand things better by reading and thinking on the points put forward by the author. Such people can access these in different ways - blogs, articles and books. We have come up with this video to put light on one such aspect, that is - Types of Design Patterns
    Important links and resources:
    ✒ github.com/topics/low-level-d...
    ✒ Quick summary: docs.google.com/document/d/17...
    ------------------------------------------------------------------
    Recommendations
    ------------------------------------------------------------------
    Our full courses on youtube:
    ✒ System Design Primer Course: • System Design Primer C...
    ✒ REST APIs made easy: • REST APIs MADE EASY
    Some paid courses that we recommend:
    ✒Educative.io: bit.ly/3qnW5ku
    ✒Interviewready.io: get.interviewready.io/ (Use coupon code SUDOCODE for extra discount)
    ------------------------------------------------------------------
    About Us
    ------------------------------------------------------------------
    Created and Instructed by:
    Yogita Sharma
    ✒ LinkedIn - / yogita-sharma-83400b55
    ✒ Instagram - / sudo.code1
    ✒ Facebook - / sudo.code
    ✒ Medium - / yogita088
    Post-production(editing, thumbnail etc) managed by:
    CiKi
    ✒ Website: www.ciki.co.in
    ✒ LinkedIn: / 74735937
    Colors and design by:
    Naini Todi
    ✒ LinkedIn - / nainitodi
    Both Arpit and Yogita are software engineers and want to help other software engineers become better by providing high quality and well researched content by adding their creativity and teaching twist.
    ------------------------------------------------------------------
    Join Us
    ------------------------------------------------------------------
    Hangout with sudoCode:
    ✒Discord Server: / discord
    For business:
    ✒Email: sudocode.yogita@gmail.com
    Timestamps:
    0:00 - What will you learn?
    0:34 - Problems solved by Builder Design Pattern
    1:29 - Analogy
    3:29 - Usability of Builder Design Pattern
    4:05 - Implementation of Builder Design Pattern
    4:53 - Code walk-through
    10:11 - Summary
    11:48 - Outro

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

  • @PiyushPragyan
    @PiyushPragyan ปีที่แล้ว +13

    Loved the design pattern series. I understood this in a single go. 😊

  • @sumitguptasg1
    @sumitguptasg1 ปีที่แล้ว +4

    I saw a couple of videos for builder patterns but this is really crisp and useful. Great, keep 'em coming.

  • @shubhamrajput37
    @shubhamrajput37 5 หลายเดือนก่อน

    This is the best explanation I have ever went across for Builder Pattern. Thanks a lot for your work, really grateful to you !!

  • @AshutoshSingh-mh7qm
    @AshutoshSingh-mh7qm 21 วันที่ผ่านมา

    what a nice value addition to my engineering life. I am enjoying watching the design pattern playlist. It's above par comparing to any paid courses. Thanks a lot ....

  • @rein29233
    @rein29233 4 หลายเดือนก่อน +1

    Finally in forever i understood this concept!!

  • @HariShankar-yf8di
    @HariShankar-yf8di ปีที่แล้ว +1

    Superb lecture. I saw 2-3 other youtube channels for understanding builder patterns. Many tried but were not clear due to bad examples, difficult code walkthrough. What separated this video from Yogita is that she explained the painful areas of non-builder pattern based examples, she explained a technical jargon of constructor telescoping, the examples made great sense, two example codes to make the understanding crystal clear.
    @Yogita Thank you so much

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

    Hey Yogita,
    You have explained this in very simple way, with practical example.
    Really liked your work.

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

    Very simple and easy to understand , thank you for the design patterns series.😊

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

    Best series on design patterns please complete rest as well

  • @letsdosomething3333
    @letsdosomething3333 6 หลายเดือนก่อน

    Mam your way of teaching is just so amazing..it gives an extra view to see the code and to understand the code in easiest way.grateful that i found you

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

    Such a crisp and easy-to-follow video. Thanks for making this... :)

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

    One of the best explanation on builder design pattern!!

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

    Refactoring has become very easy in this pattern with some cons to use according to usecase.
    Thanks for video.

  • @sekharsamanta6266
    @sekharsamanta6266 3 หลายเดือนก่อน

    Best ever video I've seen so far on design pattern

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

    Loving whatever content you are creating. Most easiest ways you try. Much appreciated. Thank you so much _/\_ _/\_

  • @narenshalivahana1111
    @narenshalivahana1111 9 หลายเดือนก่อน

    superb example and explanation, understood in few minutes

  • @blitzc8146
    @blitzc8146 3 หลายเดือนก่อน

    Beautifully explained! Subbed, Thank you!

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

    Thanks for the wonderful and easy explanation

  • @letsrock7354
    @letsrock7354 ปีที่แล้ว +3

    In office I was writing code this way all along...just by following/understanding already written code... Never knew I was utlising Builder pattern

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

    Awesome Explanation!! Great example use.

  • @ankushvashisht1158
    @ankushvashisht1158 7 หลายเดือนก่อน

    Wow!! You are such a good teacher.

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

    Clear and precise!

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

    Thanks for the upload ..Great....Please Complete all Design Patterns.. 🙂🙂

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

    Thanks for easy explanation

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

    Thanks allot, I am learning a lot.

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

    This is really a very good video, thank you mam for creating such good videos.

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

    Superb Explanation..

  • @aaf2011
    @aaf2011 ปีที่แล้ว +3

    Thank you for your efforts to deliver such great explanation and helping us understanding the weird parts about design patters however, I do have a question mark about using nested class why we had to use nested class instead of using sole abstraction builder class or interfaces?

    • @davidstigant457
      @davidstigant457 18 วันที่ผ่านมา

      I have the same question.

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

    Hi, why can't we use default constructor along with setters to set the value of field instead of making constructor for every param

  • @manishdadheech8440
    @manishdadheech8440 10 หลายเดือนก่อน

    Thanks for such a nice explanation. I have a doubt.
    Why are we using a static inner class in the builder design pattern? Can't we use a normal inner class? or can we do it without inner class?

  • @RahulVerma-fz2jf
    @RahulVerma-fz2jf ปีที่แล้ว

    Hey Yogita. Huge fan of your video, crisp and easy to understand.
    For this (builder pattern) implementation, saw some other sites as well, seems like
    1. using inner nested class is not the only to implement it. People are using combination of (interface and abstract classes to achieve the same).
    2. In your implementation isn't the code duplicated, as in the UrlBuilder and Builder class, you are writing the same fields again. Looks a bit messy. Dont you think?

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

    Very eazy to understand and simple & clean example. Loved it!!

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

    Hi Yogita, can you please upload the code online and share the code url in the description. So that we can also try manipulating the code for the given design pattern.

  • @user-fg2iw4yi7q
    @user-fg2iw4yi7q 6 หลายเดือนก่อน

    Great Video

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

    nicely explained

  • @PkSam07
    @PkSam07 9 หลายเดือนก่อน

    What if we try to make it un-immutable.
    I removed final from fields and then created getter and setters as well to make it un-immutable. I don't see any issue. If any?

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

    Thank you for providing such good videos. I have a question how is builder pattern advantageous than just having default constructor without parameters and calling setter function to initialise attributes.

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

      Firstly we want do not want to use the new keyword(which Factory pattern solves) and second we use builder pattern to make objects immutable.

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

    Loved it

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

    Very good. Keep it up.

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

      Thanks a lot

  • @tenshin111
    @tenshin111 3 หลายเดือนก่อน

    This is a good introduction into the Builder pattern but it misses a few things. How about making sure that required fields are actually enforced in the code? Right now nothing is stopping you from building the URL that contains only 'path' and 'query' parameters but is missing the protocol/hostname part.

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

    First of all thanks a lot for this series, learning a lot from it.
    I have one doubt, in build method we are hardcoding URLBuilder class.
    Can we somehow use factory pattern along with builder pattern to create the URLBuilder object?
    so that in future, if I need to create TinyURLBuilder or any other object I can do it with minimal changes

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

      Yes, u can implement multiple patterns together

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

    But at last after using builder design , the URL class is of no use? what i mean to say is , we should be able to print url.protocol , instead of urlBuilder.protocol.

  • @SoumikGhosh-ef1jn
    @SoumikGhosh-ef1jn 6 วันที่ผ่านมา

    It would be very helpful if we could get the code for the same as it helps in grasping the concept even better.

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

    [1,2,3,4,5].map(d=>d*2).filter(d=>d

  • @prashantchamoli7263
    @prashantchamoli7263 10 หลายเดือนก่อน

    Thanks! I just have one question. Why use inner static class here? Why can't we have those constructors directly in URLBuilder instead and chain individual constructors that return type URLBuilder?

    • @PkSam07
      @PkSam07 9 หลายเดือนก่อน

      Yes, I too tried so and it worked. Just fields and then field method which return object itself.
      Moreover, I removed final from fields and then created getter and setters as well to make it un-immutable. I don't see any issue? You found any ans?

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

    You have created object of static class Builder, which seems strange here... Same thing when I am trying to implement in typescript I am getting "Error"

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

    Hi, wanted to know why can't we use default params in constructor as null to resolve unwanted fields in class in this case?

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

      We can it makes the code cumbersome and lengthy for no reason.

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

      Imagine you have 10+ params and you just need to create objects with 2-3 values set. You will have to write null in all unwanted params place. (extra work)
      Imagine you need to create multiple similar objects. (unwanted code, extra work)
      Builder pattern to the rescue

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

    One correction: builder.build() call should actually return the URL object instead of the builder object. This builder object is part of the URL object constructor such that the value set in the builder could be used to construct the URL object.
    Am I missing something ?

    • @francescovanspronsen
      @francescovanspronsen 9 หลายเดือนก่อน

      This is also what I was thinking

    • @PkSam07
      @PkSam07 9 หลายเดือนก่อน

      ​@@francescovanspronsenyes, u can even rename the class UrlBuilder to just Url. In that case u ll get what u r looking.

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

    It's worth mentioning that C++ and C# (at least) simplifies all the charade to nothing by use of optional parameters.

    • @sakshamjain16
      @sakshamjain16 10 หลายเดือนก่อน

      It does. But builder pattern is worth to use when each component creation is complex.

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

    You did not explain why we can't use setters only?
    Yes, the code looks redundant but I would have liked some explanation over it.
    Moreover, @Builder annotations for classes allows its objects to be modified.

    • @PkSam07
      @PkSam07 9 หลายเดือนก่อน

      Yes I used setters and getters and then removed the final as well to make it un-immutable and it does work. I didn't get what's the problem in doing so? If anyone please let me know?

    • @narindermalik7008
      @narindermalik7008 8 หลายเดือนก่อน

      If there's no need of immutable object, then there are alternatives to builder. But immutability is a good thing specially in a threaded env.

  • @sathviksathish4243
    @sathviksathish4243 5 หลายเดือนก่อน

    Easy peasy

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

    7:41 People probably wonder why create a new object based on an existing static object instead of only using one? In other words:
    Why going through the hassle of a static Builder, private constructor and _new_ in URLBuilder.build() instead of just populating the _new_ in Demo.main()?
    The answer is immutability. And although it's not needed in this particular example, it's a clever example to follow in other situations.

    • @tharunadhits6957
      @tharunadhits6957 3 หลายเดือนก่อน

      Because we need to use encapsulation to hide complexity of the code and for isolation

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

    PLZZZ SHARE THIS PROJECT GIT LINK

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

    Yeh transition bahut bakwas hai

    • @sudocode
      @sudocode  ปีที่แล้ว +4

      I hope you find peace of mind and freedom from whatever is bothering you in life.

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

    𝐩𝓻Ỗ𝓂Ø𝓈M