How to BREAK and FIX Singleton Design Pattern | Interview Question

  Рет қаралды 33,865

Daily Code Buffer

Daily Code Buffer

Күн бұрын

Пікірлер
@thedarkhorseevil2635
@thedarkhorseevil2635 Жыл бұрын
Bhai faad .....abhi tk sbse best video ..no bakwas no makhan malayi.. only main content in basic and easy language
@akhiljuluru927
@akhiljuluru927 2 жыл бұрын
please make all design patterns videos. Thank you for all your videos
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏 Yes, that is the plan
@neon0wl2107
@neon0wl2107 2 жыл бұрын
Thank you for listening to our suggestions and starting with design pattern. I hope this is a series and you cover some more patters, well the most common ones at least.
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏 Planning for it
@mihirshinde4268
@mihirshinde4268 Жыл бұрын
Best part of your videos is: Complete Information in short time. Keep it up!
@roopkishore785
@roopkishore785 Жыл бұрын
The question was asked in MakeMyTrip Interview. about the multiple threads waiting time, you explained the synchronized Block. I was not able to answer that scenario, But now I got it. Thanks for the proper explanation.
@nikantchaudhary
@nikantchaudhary 2 жыл бұрын
Design Patterns is a very complicated topic. Very good tutorials are not there on KZbin. I hope you start the design patterns series.
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Yes, working on it
@sanskaragarwal582
@sanskaragarwal582 Жыл бұрын
Shandar bhai! Maza aagya. Keep posting such content!
@rachits21792
@rachits21792 2 жыл бұрын
Need one video on builder design pattern and where to use them. Please keep making informative videos.
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Working on it
@JayJayJay007
@JayJayJay007 Ай бұрын
best explanation so far!
@abhishekchatterjee3750
@abhishekchatterjee3750 4 ай бұрын
Once the first thread get a lock on synchonized block, the other thread will be waiting at that point , but the other threads has already passed the if condition, those are just waiting for their turn to execute the creation of the object again when the lock is released by the first thread. Is it like the if condition is going to be reevaluated again after the next thread get the lock. I am confused sinsed the synchronised block is inside the if condition. ?
@DeepakGupta-pz4fx
@DeepakGupta-pz4fx 2 жыл бұрын
Thank you Bro for this series start ...please complete alll topic of design patterns....Happy Diwali
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏 Yes working on it Happy Diwali
@rock_0075
@rock_0075 Жыл бұрын
Thanks for the video, quick question how can you have the instance of a class on line 13 in the same class define?
@AdityaRaj-ix5rg
@AdityaRaj-ix5rg 2 жыл бұрын
Thanks for the awesome video on design patterns. Kindly make video course of apache kafka as well.
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏🏻 Planning on it
@simo47768
@simo47768 2 жыл бұрын
Really nice Still did not grasp enum example. Enum Example is too short. Not clear. How use enum to instantiate database connection ?
@shivaanandadari6533
@shivaanandadari6533 9 ай бұрын
public enum DatabaseConnection { INSTANCE; private Connection connection; DatabaseConnection() { try { // Load the JDBC driver Class.forName("com.mysql.cj.jdbc.Driver"); // Create the database connection connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/myDatabase", "username", "password"); } catch (ClassNotFoundException | SQLException e) { throw new RuntimeException("Database connection failed!", e); } } public Connection getConnection() { return connection; } } public class DatabaseUsageExample { public static void main(String[] args) { Connection conn = DatabaseConnection.INSTANCE.getConnection(); // Use the connection for database operations // Remember to close any Statements and ResultSets, but you might not want to close the connection itself // as it is managed by the Singleton and should stay open for the lifetime of your application. } } we can use this way to create db connection using Enum.
@dhanshyamkamath8493
@dhanshyamkamath8493 2 жыл бұрын
I have seen the static instance declared as volatile. What does volatile keyword do?
@TechieTaught
@TechieTaught Жыл бұрын
Great, the enum one is something I came to know after long time.
@hardworkerbig
@hardworkerbig 2 жыл бұрын
U explain the singleton dp well..thanks
@thedarkhorseevil2635
@thedarkhorseevil2635 Жыл бұрын
Bro can you also please make videos on multithreading in brief please 🙏🙏🙏🙏
@adityarathor5300
@adityarathor5300 10 ай бұрын
Hi bro, Great explain Can you also define program via enum as solution against reflection.
@AbhijeetParate
@AbhijeetParate Жыл бұрын
Use volatile keywords while declaring refrence variable
@vineettalashi
@vineettalashi 10 ай бұрын
Thanks for sharing knowledge. Respect to you brother.
@abhishekjain6559
@abhishekjain6559 11 ай бұрын
You can also add a Clone example to break and fix Singleton design pattern.
@MrMikomi
@MrMikomi Жыл бұрын
Shouldn't your readResolve method call the getInstance() method? Otherwise it could return null no?
@ShivamKendre-fc3su
@ShivamKendre-fc3su 3 ай бұрын
Great video I have seen on singleton
@rock_0075
@rock_0075 Жыл бұрын
so you mean from line 22 the sync method will be shared across all threads?
@oshogarg5215
@oshogarg5215 Жыл бұрын
in depth explaination , hats-off
@rishabhshah8845
@rishabhshah8845 Жыл бұрын
Can u make java beginners to advanced video
@mathcss8496
@mathcss8496 Жыл бұрын
Wow nice one Shabbir 🔥🔥
@MrMikomi
@MrMikomi Жыл бұрын
Should have said though, great video, thanks.
@DailyCodeBuffer
@DailyCodeBuffer Жыл бұрын
Thanks for watching!
@anujdosad9518
@anujdosad9518 2 жыл бұрын
Hi, what about using clone method? using clone method also we can break the singleton rule..
@navinkumar6388
@navinkumar6388 2 жыл бұрын
Just throw the clone exception if the object clone is carried out
@shivaanandadari6533
@shivaanandadari6533 9 ай бұрын
Great Content brother! Appreciate it!
@dileepmidasala9754
@dileepmidasala9754 2 ай бұрын
Still we can brake Singleton using clone the object
@Anilkumar-reddy
@Anilkumar-reddy 2 жыл бұрын
Nice Explanation bro, ur the life saver
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏🏻
@unknownxengineer
@unknownxengineer Жыл бұрын
Very straightforward..
@DailyCodeBuffer
@DailyCodeBuffer Жыл бұрын
Thanks 🙏
@navinkumar6388
@navinkumar6388 2 жыл бұрын
I have a query. Why only one DB object? If created more DB connection then it will be easy to service the concurrent request coming at same time.. right?
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Yes, Absolutely 👍 This is just an example to explain singleton
@ravipanchal2259
@ravipanchal2259 Жыл бұрын
Cloning the object will also break singleton right?
@tanujarora4906
@tanujarora4906 Жыл бұрын
Yes, Implement the Cloneable Interface and Override the clone method and throw an exception. It will fix that loop hole.
@smirkedShoe
@smirkedShoe 8 ай бұрын
8:20 The instance variable has to be volatile else the logic won't work.
@Telugu_europe
@Telugu_europe Жыл бұрын
Very good explanation 😊
@DailyCodeBuffer
@DailyCodeBuffer Жыл бұрын
🙏🏻
@nikhileshyoutube4924
@nikhileshyoutube4924 2 жыл бұрын
Excellent bro happy diwali
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏 Happy Diwali
@ipsadas4233
@ipsadas4233 5 ай бұрын
Great video😊
@DailyCodeBuffer
@DailyCodeBuffer 5 ай бұрын
Glad you enjoyed
@claveralvaro6245
@claveralvaro6245 Жыл бұрын
Holly crap i learned a lot. ty so much.
@DailyCodeBuffer
@DailyCodeBuffer Жыл бұрын
🙏🙏
@anandpadamala451
@anandpadamala451 Жыл бұрын
super explanation
@DailyCodeBuffer
@DailyCodeBuffer Жыл бұрын
Thanks 🙏
@rjrobinjames
@rjrobinjames 2 жыл бұрын
Awesome bro 👌👌👌
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏
@KratosVS
@KratosVS 2 жыл бұрын
Good work brother
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏🏻
@KratosVS
@KratosVS 2 жыл бұрын
@@DailyCodeBuffer you should do live question and answer for interviews questions. Also live project it be fire where people can do supervhst and if they tipped you super chat you can give them personal help with the thing they having problem with the project
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Great Suggestion I will think about it. Thanks 🙏
@KratosVS
@KratosVS 2 жыл бұрын
@@DailyCodeBuffer you can send notifications to your to subscribers. It can be big projext like fully functional full stack e-commerce website where every can pull and push the project in git and contribute to it. You can ask people if they can do something different and if they have trouble they can send certain fee and you can do personal one on one session to improve their application. While people on super chat who is having trouble you can show and what they may do wrong and answer the questions. I think it great idea it help lot of people. It will help people to see how you going about codding and why you use certain data structures over certain data structures. I will definitely join and I am pretty sure lot of people will join
@magiccraftideas
@magiccraftideas Жыл бұрын
Bhai hindi ma video bno...
@sagarsri4143
@sagarsri4143 2 жыл бұрын
Superb
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏🏻
@АндрейБорденко
@АндрейБорденко 2 жыл бұрын
Good! New cap👍
@DailyCodeBuffer
@DailyCodeBuffer 2 жыл бұрын
Thanks 🙏🏻
Factory Design Pattern in detail | Interview Question
9:04
Daily Code Buffer
Рет қаралды 29 М.
#12 DynamoDb Hands with Spring Boot
14:16
Naresh Makhija
Рет қаралды 596
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 27 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 21 МЛН
Singleton Design pattern in Java | Best Practice | Java Techie
16:00
Singleton Design Pattern | Implementation with details & code ✌🏻
21:09
Adapter Design Pattern in detail | Interview Question
10:14
Daily Code Buffer
Рет қаралды 8 М.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
Alex Hyett
Рет қаралды 306 М.
🔥Singleton Design Pattern in Detail | Multi-Threaded Environments  | Hindi
25:59
Learn Code With Durgesh
Рет қаралды 100 М.
Prototype Design Pattern in detail | Interview Question
12:23
Daily Code Buffer
Рет қаралды 10 М.
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН