How does Builder Design Pattern solves problems like URL creation?

  Рет қаралды 47,685

sudoCODE

sudoCODE

Күн бұрын

Пікірлер
@sumitguptasg1
@sumitguptasg1 2 жыл бұрын
I saw a couple of videos for builder patterns but this is really crisp and useful. Great, keep 'em coming.
@PiyushPragyan
@PiyushPragyan 2 жыл бұрын
Loved the design pattern series. I understood this in a single go. 😊
@HariShankar-yf8di
@HariShankar-yf8di Жыл бұрын
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
@shubhamrajput37
@shubhamrajput37 Жыл бұрын
This is the best explanation I have ever went across for Builder Pattern. Thanks a lot for your work, really grateful to you !!
@letsdosomething3333
@letsdosomething3333 Жыл бұрын
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
@sekharsamanta6266
@sekharsamanta6266 10 ай бұрын
Best ever video I've seen so far on design pattern
@AshutoshSingh-mh7qm
@AshutoshSingh-mh7qm 7 ай бұрын
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 ....
@jokhakararpan31
@jokhakararpan31 2 жыл бұрын
Hey Yogita, You have explained this in very simple way, with practical example. Really liked your work.
@number1inworld
@number1inworld 3 ай бұрын
The way u organize the course is nice. This is a simple design pattern which lacks the concept of OC principle.
@rein29233
@rein29233 11 ай бұрын
Finally in forever i understood this concept!!
@aviator9728
@aviator9728 2 жыл бұрын
Best series on design patterns please complete rest as well
@narenshalivahana1111
@narenshalivahana1111 Жыл бұрын
superb example and explanation, understood in few minutes
@aakansha5889
@aakansha5889 2 жыл бұрын
One of the best explanation on builder design pattern!!
@hbhatia999
@hbhatia999 2 жыл бұрын
Refactoring has become very easy in this pattern with some cons to use according to usecase. Thanks for video.
@letsrock7354
@letsrock7354 2 жыл бұрын
In office I was writing code this way all along...just by following/understanding already written code... Never knew I was utlising Builder pattern
@AditiAgarwal1695
@AditiAgarwal1695 2 жыл бұрын
Such a crisp and easy-to-follow video. Thanks for making this... :)
@ankushvashisht1158
@ankushvashisht1158 Жыл бұрын
Wow!! You are such a good teacher.
@sumantkumar2887
@sumantkumar2887 2 жыл бұрын
Very simple and easy to understand , thank you for the design patterns series.😊
@prabhagaikwad4849
@prabhagaikwad4849 2 жыл бұрын
Loving whatever content you are creating. Most easiest ways you try. Much appreciated. Thank you so much _/\_ _/\_
@prakashbabugnanam7949
@prakashbabugnanam7949 2 жыл бұрын
Very eazy to understand and simple & clean example. Loved it!!
@blitzc8146
@blitzc8146 10 ай бұрын
Beautifully explained! Subbed, Thank you!
@democratcobra
@democratcobra 2 жыл бұрын
Thanks for the upload ..Great....Please Complete all Design Patterns.. 🙂🙂
@PkSam07
@PkSam07 Жыл бұрын
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?
@noturhomie4973
@noturhomie4973 3 ай бұрын
I have a question. Here we create two classes: URLBuilder and Builder and after coding the logic we called the constructor for URLBuilder and passed the Builder class object as a param. Why dont we make 1 class called URLBuilder and implement the same logic for each part of the url and for every part return the same object whose attributes we set(like we did in builder). We are going to create an object for the URLBuilder and for builder might as well create one class and from it create multiple instances or urls here. Is it cuz of abstraction or providing some depth as in layers to code or what?
@annabelleellis8098
@annabelleellis8098 Жыл бұрын
Awesome Explanation!! Great example use.
@lakshaythegupta
@lakshaythegupta 3 ай бұрын
Doesn't the objects still have other optional fields with value null? Its just like using a constructor with all params . Does it just helps to remove the extra nulls ,that we need to pass to the constructor, with all the params?
@shriharikulkarni07
@shriharikulkarni07 2 жыл бұрын
Thanks for the wonderful and easy explanation
@zeeshanalam4914
@zeeshanalam4914 Жыл бұрын
Clear and precise!
@prashantchamoli7263
@prashantchamoli7263 Жыл бұрын
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 Жыл бұрын
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?
@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
@shreysoni2054
@shreysoni2054 2 жыл бұрын
This is really a very good video, thank you mam for creating such good videos.
@sandeepnayak5888
@sandeepnayak5888 2 ай бұрын
how can you create an instance of the inner static class Builder ?
@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 ?
@PkSam07
@PkSam07 Жыл бұрын
​@francescovanspronsenyes, u can even rename the class UrlBuilder to just Url. In that case u ll get what u r looking.
@mickys4999
@mickys4999 6 ай бұрын
I didnt understand one thing in builder pattern. What if we need to add another attribute to the static builder class like price? Do we need to modify the static class? How will we implement it?
@mireazma
@mireazma Жыл бұрын
It's worth mentioning that C++ and C# (at least) simplifies all the charade to nothing by use of optional parameters.
@sakshamjain16
@sakshamjain16 Жыл бұрын
It does. But builder pattern is worth to use when each component creation is complex.
@mdnadeemasgar6279
@mdnadeemasgar6279 Жыл бұрын
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.
@RahulVerma-fz2jf
@RahulVerma-fz2jf 2 жыл бұрын
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?
@soumalyasahoo5184
@soumalyasahoo5184 2 жыл бұрын
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.
@sagarve
@sagarve Ай бұрын
Exactly, this is seriously misleading. I'm really surprised to see how this could've helped so many of these people commenting here.
@aaf2011
@aaf2011 2 жыл бұрын
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 7 ай бұрын
I have the same question.
@manishdadheech8440
@manishdadheech8440 Жыл бұрын
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?
@ISHANICUTIEPIE
@ISHANICUTIEPIE 2 жыл бұрын
Superb Explanation..
@ThePakChina
@ThePakChina 2 жыл бұрын
Very good. Keep it up.
@sudocode
@sudocode 2 жыл бұрын
Thanks a lot
@gauravsalunke8652
@gauravsalunke8652 2 жыл бұрын
Thanks for easy explanation
@tenshin111
@tenshin111 10 ай бұрын
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.
@himankgupta7968
@himankgupta7968 2 жыл бұрын
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 2 жыл бұрын
We can it makes the code cumbersome and lengthy for no reason.
@santosh_bhat
@santosh_bhat 2 жыл бұрын
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
@ThePakChina
@ThePakChina 2 жыл бұрын
[1,2,3,4,5].map(d=>d*2).filter(d=>d
@yaad122
@yaad122 2 жыл бұрын
Thanks allot, I am learning a lot.
@SoumikGhosh-ef1jn
@SoumikGhosh-ef1jn 7 ай бұрын
It would be very helpful if we could get the code for the same as it helps in grasping the concept even better.
@TusharBorawake
@TusharBorawake 2 жыл бұрын
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"
@Adarshpartha
@Adarshpartha 2 жыл бұрын
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 2 жыл бұрын
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.
@mireazma
@mireazma Жыл бұрын
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 10 ай бұрын
Because we need to use encapsulation to hide complexity of the code and for isolation
@SankalpCollege-f2o
@SankalpCollege-f2o Жыл бұрын
Great Video
@nitinkhulbe6234
@nitinkhulbe6234 Жыл бұрын
nicely explained
@ashish261096
@ashish261096 2 жыл бұрын
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
@rahulsrivastava1040
@rahulsrivastava1040 Жыл бұрын
Loved it
@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 Жыл бұрын
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 Жыл бұрын
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.
@nathamuni9435
@nathamuni9435 2 жыл бұрын
PLZZZ SHARE THIS PROJECT GIT LINK
@sathviksathish4243
@sathviksathish4243 Жыл бұрын
Easy peasy
@atirrasheedhashmi
@atirrasheedhashmi 2 жыл бұрын
Yeh transition bahut bakwas hai
@sudocode
@sudocode 2 жыл бұрын
I hope you find peace of mind and freedom from whatever is bothering you in life.
@virgiebert7389
@virgiebert7389 2 жыл бұрын
𝐩𝓻Ỗ𝓂Ø𝓈M
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 188 М.
The Most Important Design Pattern in React
35:04
Cosden Solutions
Рет қаралды 118 М.
10 Design Patterns Explained in 10 Minutes
11:04
Fireship
Рет қаралды 2,4 МЛН
Builder Design Pattern in Java
12:23
Coding Simplified
Рет қаралды 60 М.