Builder Design Pattern in Java

  Рет қаралды 60,225

Coding Simplified

Coding Simplified

Күн бұрын

Пікірлер: 72
@TheTravelJunkiee
@TheTravelJunkiee 4 жыл бұрын
I have seen multiple videos, no one's clearer in explanation than you :). You're doing such an amazing work! Thank you so much!
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@vidurwadhwa6897
@vidurwadhwa6897 2 жыл бұрын
Thanks for explaining it in such an easy manner. Another important benefit of the builder pattern which you brushed upon briefly is "immutability" which is something I have personally found out to be very useful in many cases.
@hisdness1
@hisdness1 Жыл бұрын
This is the greatest explanation of the builder method that I've ever seen. Thank you for the explanation!
@jvsnyc
@jvsnyc 3 жыл бұрын
Three minutes in and I already have to give a thumbs-up. Very clear, calm, and concise.
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@tekkytammy8733
@tekkytammy8733 4 жыл бұрын
The best explanation I've seen. My instructor could learn a lot from you. Thank you. I've subbed.
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching. Sure share channel with him ;)
@rahulsharma5030
@rahulsharma5030 3 жыл бұрын
thank you .this helped me a lot.Some articles and videos are making it complex by taking complex examples.This is perfect and to the point.10/10
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@AkhilKumar
@AkhilKumar 2 жыл бұрын
This was very simple and easy to understand. Thanks a lot. 5:50 if you want to skip the theory, though.
@CodingSimplified
@CodingSimplified 2 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@veenachaudhari7346
@veenachaudhari7346 2 жыл бұрын
I had so much difficulty in understanding the builder design pattern but you made it so simple to understand its concept. Love your videos. Keep posting as they are really helpful.
@CodingSimplified
@CodingSimplified 2 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@MaheshShinde-pj5fk
@MaheshShinde-pj5fk Жыл бұрын
Very nice explanation, Thank you so much!!
@elzwang
@elzwang 3 жыл бұрын
Thank you very much!! Best builder pattern video!
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@ratulsamanta3158
@ratulsamanta3158 Жыл бұрын
You're really such a good trainer ❤️
@PeekIntoMyDiary
@PeekIntoMyDiary Жыл бұрын
Great explanation. Thank you so much
@e.ch.vidyasagarkorada7341
@e.ch.vidyasagarkorada7341 3 жыл бұрын
Helps a lot to understand the concept thank you Coding Simplified team #KnowledgeSharingCodingSimplified
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@ankurgarg5326
@ankurgarg5326 2 жыл бұрын
Thanks for explaining the concept .
@CodingSimplified
@CodingSimplified 2 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@sumatapatil860
@sumatapatil860 5 жыл бұрын
Very nice explanation with very easy example which helps is preparing for interviews. Thanks for uploading this.
@CodingSimplified
@CodingSimplified 5 жыл бұрын
Thanks for your feedback.
@minnuvlog-edigapalli3900
@minnuvlog-edigapalli3900 Жыл бұрын
Nice explanation Sir ❤
@rachamallidorasrivignesh4499
@rachamallidorasrivignesh4499 7 ай бұрын
your way of explanation is really superb brother really ...... so good please make vedeos on data structures and algorithms as well. Once again thank you so much.😊
@nagavaraprasadpuppala6715
@nagavaraprasadpuppala6715 4 жыл бұрын
explanation is too good, easily understand ..thanks
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@tirupatirao7521
@tirupatirao7521 4 жыл бұрын
simple example and clear explanation.
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@mukundpatel1768
@mukundpatel1768 4 жыл бұрын
You have explained in a very simplified way and this makes it more easy to digest.👍 Thanks
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks Mukund for nice feedback. Keep Watching.
@shashikantverma3215
@shashikantverma3215 4 жыл бұрын
content is very easy to understand. Thanks
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@djr4793
@djr4793 4 жыл бұрын
Great explanation, keep the good working going..
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your feedback. Keep Watching.
@venkataramanan2381
@venkataramanan2381 4 жыл бұрын
Thank you for sharing.good tutorial
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@sunilchausali9754
@sunilchausali9754 2 жыл бұрын
Helpful
@CodingSimplified
@CodingSimplified 2 жыл бұрын
Thanks for your nice feedback. Keep Watching :)
@AmanSharma-vb5jl
@AmanSharma-vb5jl 2 жыл бұрын
U r awesome bro
@hazhirahmadzadeh2055
@hazhirahmadzadeh2055 3 жыл бұрын
For the factory pattern I believe if you create a VehicleEnum and then put each to the VehicleFactory would be more descent
@mohsentaleb7270
@mohsentaleb7270 3 жыл бұрын
simple and great : Thanks a lot.
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@chitranshsaxena59
@chitranshsaxena59 3 жыл бұрын
Hey, so based on 2:14 , the way we mark parameters as required=true/false in jcommander, does this come in BuilderPattern too? If yes, how?
@manikantaammula9279
@manikantaammula9279 3 жыл бұрын
Your amazing, it's a great explanation.
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@fromEmotion
@fromEmotion 4 жыл бұрын
Mind blowing sir
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Thanks Sumit. Glad you liked it. Keep Watching.
@vedant6460
@vedant6460 Жыл бұрын
thanks
@supriyadivvela7400
@supriyadivvela7400 Жыл бұрын
Very nice explanation but i have a doubt like can we update the value of parameter for second time....
@ParasharShweta
@ParasharShweta 2 жыл бұрын
Hi Can you please guide me For debugging what all buttons you are using
@CodingSimplified
@CodingSimplified 2 жыл бұрын
It's all basic buttons in Eclipse. On top, you can see all debugging buttons.
@saiyaswanth8
@saiyaswanth8 4 жыл бұрын
Here Defining a builder method as static. It's not thread safe right? when multiple threads trying to create vehicle instace using this apporach.
@jvsnyc
@jvsnyc 3 жыл бұрын
I believe it is not a problem. You are correct to avoid static methods but that is not what we have here, right? In the lines: Vehicle car = new Vehicle.VehicleBuilder("1500cc", 4).setAirbags(4).build(); and Vehicle bike = new Vehicle.VehicleBuilder("500cc",2).build(); The constructor of Vehicle.VehicleBuilder() gives us back our own instance of an object. The .setAirbags() and .build() calls are NOT static methods, they are instance methods of class Vehicle.VehicleBuilder. Good question to ask, because it would be a common mistake to make, but was not made here unless I am confused. Static modifier on the nested class means only that you do not need any instance of the outer class to call the constructor of the nested class, which is essential here, because we can't get an instance of the outer class until after we have an instance of the inner one. A bit tricky, but very cool.
@viratsuresh5946
@viratsuresh5946 3 жыл бұрын
What is the reason for nested class as static ( builder)
@jvsnyc
@jvsnyc 3 жыл бұрын
If it wasn't static, we would already need an instance of the outer class to use it, so we would have a chicken-and-egg problem, right? Why nested at all instead of stand-alone separate class? We could do that and it would work, but when one class is very much associated with another, we will consider a static nested or inner class. Also, both static nested and (instance) inner classes can access all members, public, protected and private of the containing class. If it was a standalone class in the same package, in order to let that class access the members the members would need to be marked as default access, rather than private, so that is another reason we might choose this.
@jvsnyc
@jvsnyc 3 жыл бұрын
I watched another video and see a further very good reason why we do it this way. They avoided the nested static class you don't like by providing Setters for all the optionals, which to me almost makes the Builder class pointless. Here's the problem tho. You might set five or six things with the Builder, then when you are done with those and ready to actually build it, it can verify that your combination that you requested even makes any sense. Now, doing the sets one at a time you can't check that the combination is good. Let's say (not perfect example but shows what I mean) you want to say you are married, your anniversary is on April 1st and your wife's name is Taylor Swift. Doing a set on any one of these leaves us in a totally invalid state. You just set a date for your anniversary, but your object says you are not married. Maybe you are about to set the flag to say you are, or maybe you will forget to or setting the Anniversary was just a mistake. There's nothing my program can do at that point to prevent you from putting in nonsense combinations of data into the object. Sure, you aren't crazy about the static nested class (for some reason) but look at all the pain and suffering it can prevent us!
@syedovaiss
@syedovaiss 2 жыл бұрын
Don't you think Vehicle Builder violates Dependency Inversion Principle?
@DamanDhillon007
@DamanDhillon007 4 жыл бұрын
Where did you set airBags default value to zero ?
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Zero is the default value. For 'car' we called the function setAirbags, but for 'bike', we didn't call, so it initialized with default value, which is 0 because it's integer. So this what is required that if we're not setting other value, it'll set to default values.
@_akagrawal
@_akagrawal 4 жыл бұрын
What if I want to change airBags after vehicle is created ?
@kamranastanov5016
@kamranastanov5016 2 жыл бұрын
I understand whole code. But i dont get why we do in seperate class? we can do same inside Vehicle class. If you will say me for private then my answer if we can set anything from vehiclebuilder then what kind of privacy is it.
@girijaganeshbhat2713
@girijaganeshbhat2713 4 жыл бұрын
sir pls share the source code link .The link which you have shared is not working
@CodingSimplified
@CodingSimplified 4 жыл бұрын
Could you please check again. It seems to be working fine.
@DimosMos
@DimosMos 3 жыл бұрын
Чтож все индусы так коряво по английски говорят!?!
@CodingSimplified
@CodingSimplified 3 жыл бұрын
Bro you could have write in English ;)
@HimanshuSingh-ti6qw
@HimanshuSingh-ti6qw Жыл бұрын
Bekar pattern h
@sumanadey6004
@sumanadey6004 2 жыл бұрын
Great explanation...thanks a lot for making this video......!!!
@CodingSimplified
@CodingSimplified 2 жыл бұрын
Thanks for your nice feedback. Keep Watching.
Prototype Design Pattern in Java
6:42
Coding Simplified
Рет қаралды 38 М.
Observer Design Pattern in Java
21:39
Coding Simplified
Рет қаралды 16 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Builder Pattern - Design Patterns
10:49
Web Dev Simplified
Рет қаралды 139 М.
Factory Design Pattern in Java
8:09
Coding Simplified
Рет қаралды 71 М.
Builder Design Pattern in Java
8:34
Telusko
Рет қаралды 231 М.
SOLID Design Principles in java with Example | JavaTechie
34:44
Java Techie
Рет қаралды 201 М.
Composite Design Pattern in Java
7:52
Coding Simplified
Рет қаралды 24 М.
Parse JSON using Java
22:27
Coding Simplified
Рет қаралды 7 М.
JVM ( java virtual machine) architecture - tutorial
29:16
Ranjith ramachandran
Рет қаралды 523 М.
Java Design Patterns - step by step - made easy for Beginners.
54:01
Patrick WashingtonDC
Рет қаралды 148 М.
Observer Design Pattern in Java
14:34
Telusko
Рет қаралды 177 М.