Thanks a ton Keerti! Such an awesome video including the multithreading handling part which was unexpected, and while learning I enjoyed it throughly. Paused the video in between to like it because this video and this design pattern series deserves it. Looking forward for next videos in the series :D
@KeertiPurswani2 жыл бұрын
Thank you so much. Sorry for releasing the rest of the series late but finishing it soon ❤️😇
@vaibhavjain86727 ай бұрын
Thanks a lot, Keerti. I am fresher and was super scared when I first check what it is online, but you made it super simple that even a fresher who barely knows these concepts in detail can understand it. Super happy learning this in such a simple way.
@whynesspower Жыл бұрын
To restrict access to the operator=, you can declare it as private in the class definition, as you've already done. However, you should also provide an empty definition for it to make it inaccessible and avoid compilation errors. Here's how you can do it: cpp code private: Logger& operator=(const Logger&) = delete; Adding = delete explicitly specifies that the copy assignment operator is deleted and cannot be used. This way, any attempt to use the copy assignment operator will result in a compilation error
@pratikwadekar49812 жыл бұрын
Hey Keerti, This was really great explanation. Most videos would stop showing the implementation about singleton design pattern. But the fact that you showed how to make them thread safe was a cherry on top. One request though, could you increase the font size or zoom in into your code editor in upcoming videos as it becomes difficult when viewing on phone.
@KeertiPurswani2 жыл бұрын
Thanks Pratik. Will definitely increase more from next time😇 Feedback like yours helps me improve in every video❤️😇
@ishajindal7862Ай бұрын
Keerti this is by far the best video I have watched. The way you simplify everything and explain things with so much calm, simplicity is just amazing. Waiting for this entire series. It's great learning this with you. Thankyou so much :)
@swatiacharya9073 Жыл бұрын
I use to always skip the design pattern concepts..but with your videos...its so easy to understand...i look forward to other videos... great work thanks for sharing the knowledge wirh us...😍
@AdityaNakhare2 жыл бұрын
In a main method, you can create a singleton class instance before creating a thread. There won't be any contention issue, locking is also not needed.
@RohitRaj-qv5nq2 жыл бұрын
Wonderful explanation Keerti, It is hard to find Oops tutorial in C++ and you have handled it easily. Thanks a lot again.
@KeertiPurswani Жыл бұрын
Thank you so much! Means a lot! Please do share with your friends! ❤️
@MilindKTechnology Жыл бұрын
Thank you ma'am. I have a question. If you null pointer check for loggerInstance on Ln. 21 then do you really think null check required on Ln.24 as well
@mayankprabhakar5336 Жыл бұрын
Thanks for such a simple explanation!! I have one Q. Should I also delete "move constructor" & "move assignment operator" in singleton class? If YES or No, explanation would be very helpful.
@kedarsadhu2816 Жыл бұрын
Thanks a lot Keerti. This is the most complete video I have seen so far. I like the way you explain "WHY" we need to do it. Really appreciate your work.
@KeertiPurswani Жыл бұрын
Thank you so much! Means a lot! Hoping you like rest of the videos as well! ❤️😇
@AnupTiwari-n3v2 ай бұрын
Thanks for the video Keerti. Simple and detailed. Good work!!
@sanjaygatne14243 ай бұрын
बहोत अच्छेसे और गहराईसे समझाया. फाॅंट का आकार बडा होता पढने मे आसानी होती. नलपीटिआर् दो बार चेक हो गया है. जगह और वेग के संबंध मे.
@sohelsheikh19342 жыл бұрын
For Java People, to handle multithreading do below changes in Logger class - public static Logger getLogger() { if(logger == null) { logger = getInstance(); } return logger; } synchronized public static Logger getInstance(){ if(logger == null) return new Logger(); else return logger; }
@PkSam072 жыл бұрын
Awesome explanation! but I think you missed to explain why we should go for singleton pattern? I think you mentioned in order to avoid multiple logs in different places? I didn't get that?
@SugamMaheshwari7 ай бұрын
Lovely explanation of double checking before locking for thread-safe single ton logging🔥
@insofcury6 ай бұрын
Keerti awesome work on the video. I do have a suggestion though. It would be great to if you have have those multiple files in the split window so that it is easily to reference and connect while watching the video itself. This is one way to do it, but the idea is to have visibility or maybe use lesser files. I totally understand that this way it is much more modular but I think for watching everything on a single screen helps better.
@aryanyadav3926 Жыл бұрын
Once we have checked that loggerInstance==nullptr, why is there a need to check it again, can't we just apply the lock and create a new loggerInstance as we know that it is null?
@Aman-pd4bg3 ай бұрын
Baat me dum hai
@RohitKumar-sb4qc2 ай бұрын
No, that would miss the case when both the threads have gone passed by the first if-condition, they both will eventually access the constructor, though one after the other. That's why the second if-condition is a must too
@47hriday2 жыл бұрын
Its best explanation about singleton.Thank You.
@VY-zt3ph2 жыл бұрын
Fantastic video. I came here after hearing your interview experience. I learned MULTITHREADING just to understand this video.
@KeertiPurswani Жыл бұрын
Woah! How awesome is that! ❤️😇
@VY-zt3ph Жыл бұрын
@@KeertiPurswani Thank you Di
@mohanganesh10552 жыл бұрын
Mam, please complete the design pattern playlist as fast as possible.
@PRANAVMAPPOLI Жыл бұрын
Hey, thanks for the awesome explanation. Why we need the 2 if check, cant we remove the inner if check?
@akshayyadav685411 ай бұрын
Have the same question...
@shankarBinnar-xl8en Жыл бұрын
Thanks Keerti for this video..learn singlton design pattern in detailed . can I get your codes on any website ??
@mayurbadwaik64012 жыл бұрын
wonderfull explantion keerti, one doubt -> as explained to use mutex, can we follow this approach -> run 1st thread and after that remaining threads -> anyways we are just blocking 2 threads to make instances for the first time and after the instance is created it would not matter how many threads access it
@roushanraj85302 жыл бұрын
Thank you very much Di, got this from end to end like thread safe and all.... One doubt why we use .hpp and .cpp files both..... we can't do in .cpp file only, its little bit confusing to me, i haven't code like this in cpp And please add more videos.... this Playlist is going to be best on KZbin for LLD and system design 💯💯
@osamayounus48672 жыл бұрын
Thanks for these videos. One thing which would help with visibility is if you can show all open code files side by side
@KeertiPurswani Жыл бұрын
But you won’t be able to see the code clearly on screen. I am going to upload all to github pretty soon!
@theSeniorSDE2 жыл бұрын
keerti please do a parallel code for java as well.
@sivakumardugana3272 Жыл бұрын
Very clear explanation with examples. Thanks Kreeti
@aloklakhotia72512 жыл бұрын
Great video. Thanks for this. :D One doubt: Isn't the inner if condition redundant as the lock is already captured?
@KeertiPurswani2 жыл бұрын
Thanks Suraj. For explaining so well! ❤️😇
@geeksentertainmentmedia48272 жыл бұрын
And "upper if" to just stop "locking" once you have created the instance.
@shashankcool2 жыл бұрын
Thanks Keerti for such crisp & nice video capturing all the necessary points related to singleton design pattern. Really appreciate for posting such videos which helps the entire developer community.
@KeertiPurswani Жыл бұрын
Thank you so much, means a lot! Hoping you will like the new videos as well! 😇
@venkatkrishna37742 жыл бұрын
Please increase the font size when you write code or zoom in a bit. Difficult to read from distance. Thanks
@srilakshmiuvpakala3267 Жыл бұрын
Hi Keerthi, thanks a million for the wonderful videos. I have one question in implementation of singleton design pattern. "Why do we need to make assignment operator in private. Assignment operator gets called when we try to assign existing object to another already existing object. In other words this gets called only when we have two instances already created which we already prevented from happening by making default and copy constructors private.
@anonymoushacker90942 жыл бұрын
Isn't it better to use static class for logger rather than singleton pattern. Some of the useful example can be parking lot
@powprashant2 жыл бұрын
Hello Keerti, Thanks for the video, but this is still not complete. Particularly the ownership of the instance, how the instance will be released/destroyed. You can use smart pointer (since C++11) But the best would be using Meyer's Singleton that works with C++98 and C++O3 as well
@amithtripst98516 ай бұрын
Could you please let us know what is the IDE you are using for practice?
@RaisShaikh-bs7dh2 жыл бұрын
Thanks Keerti, Such a great video including each smaller things in it. One request if you can give one session on only mutex and semaphore will help us a lot. Thank you so much again for this wonderful session.
@KeertiPurswani Жыл бұрын
Will do for sure!
@bheemsenkulkarni2471 Жыл бұрын
Thanks Keerthi, this was a very good explanation about singleton
@JRKrishna-d1e Жыл бұрын
Thanks Keerti! Very good way of explanation. God bless you.
@sammetajhansi80632 ай бұрын
Thanks Keerthi! Your explanation was very excellent.But I had a doubt.Instead of using header files can't we write all the code in a single file?.Will there be any issues in doing so? Because not everyone can create those header files that easily.I am a fresher basically So I wanted to know if this is the actual convention to be followed or if it is also fine to code everything in a single file.
@krishnasummer5603 Жыл бұрын
Hi sis, your explanation is very clean & good, if u can add more design patterns .It'll be a great help. Thanks.
@arkosnatoneogy236610 ай бұрын
after you implement the double checked lock is the inner if condition needed any more? isnt it bound to be TRUE?
@vipulpurbey4323 Жыл бұрын
goldmine of a video
@whynesspower Жыл бұрын
20:05 can you give me the code for that? Will it be something like delete Logger operator=(const Logger &)? Correct me if I am wrong
@sasageyo95712 жыл бұрын
Are freshers (university grads ) expected to face these questions ? Great video btw !!!
@durgeshrai04 Жыл бұрын
Thanks a lot Kreerti! for the wonderful explantion of singleton design pattern.
@KeertiPurswani Жыл бұрын
Thank you! Hope you like other videos on the channel as well! 😇
@SourabhDesaiBrief2 жыл бұрын
Clearly Visible, Thank You :) It complied on first time, on staging code - Truly magical!
@KeertiPurswani Жыл бұрын
Thank you! A lot of effort goes behind every single video! ❤️
@Ww-ul8oe2 жыл бұрын
Thank you Keerti. Appreciate implementing in c++
@KeertiPurswani Жыл бұрын
Thank you! Please do subscribe and share the video with your friends❤️😇
@virendramane781810 ай бұрын
Thank you Keerti! Really appreciate your work.
@nileshpatil41114 ай бұрын
Nicely explained. Understood it completely
@kingshahzadaamir2 жыл бұрын
Hey Keerti, I tried this on gcc linux terminal. without mutex also it gave single instance all the time. spent 15 minutes to figure out what wrong I wrote. but then tried it on online gdb compiler; there it varied then.
@vivekshivhare8820 Жыл бұрын
Can we delete the second time nullptr checking as we are already checking it for mtx locking, or that can also cause some problem? just curious, please do reply..
@AshishIkhar-k7b Жыл бұрын
Thanks Keerti, can you please record the session on "Smart Pointer"
@svarajdhanulkar1791 Жыл бұрын
Yar jo wo problem tha like k if Multithreading is in picture then singleton fails or tabhi muje realise hua uska bhi jugad hota hai par ye interview me pucha tha or sch me tabhi realise hua k hmm such a diff pov
@nehakale9427 Жыл бұрын
Excellent explaination Keerti!
@amarnathsama2 жыл бұрын
Can someone explain why we need to have objects of the class at all? why can't getLogger function be static also?
@Kaushikraj98452 жыл бұрын
Assuming if we write the code in java ..Can we create object during initialization like below public class Singleton { private static Singleton singleton=new Singleton();; private Singleton() { super(); } public static Singleton getSingleton() { return singleton; } }
@guruprasad_sannenahalli4 ай бұрын
Thanks Keerti. Very useful.
@mayankrai79382 жыл бұрын
Finally back ☺️
@KeertiPurswani2 жыл бұрын
With many many videos this time❤️😇
@paraskaushik2639 Жыл бұрын
Why have you made 3 files ? logger.hpp , logger.cpp and user.cpp . why cant we directly used logger.hpp in user.cpp ? is there some pattern , folder structuring you have followed ?
@meme_engineering45212 жыл бұрын
excellent!!, can someone please tell me if this playlist is enough for sde1 interviews?
@tarunkumar76565 ай бұрын
AWESOME, Great work!
@AnkitaSingh-vv5rc5 ай бұрын
Thankyou so much, Keerti Mam
@athena29862 жыл бұрын
Thank you for explaining in detail.can you please create GitHub links for the codes specially the design pattern ones
@ritikapande212 жыл бұрын
Hey Keerti, Really a good video and detailed explanation. Hats off and please continue to contribute.
@KeertiPurswani2 жыл бұрын
Thank you so much Ritika, means a lot! More videos coming up soon ❤️😇
@kartheekgoud90092 жыл бұрын
Thanks Keerthi.. Really great explanation 👏.
@rosansenapati-pl5hr Жыл бұрын
wonderful explanation thank you so much for teaching us
@KeertiPurswani Жыл бұрын
Thank you! Please do share the video with your friends!
@rosansenapati-pl5hr Жыл бұрын
@@KeertiPurswani ofcourse I will this is great stuffs and people need to know about your amazing videos
@siddeo85 Жыл бұрын
nice video but could you make videos using java?
@shyamchauhan5202 жыл бұрын
Nice explanation :) One doubt: when are we going to delete the resource(loggerInstance) which we have created dynamically using new keyword.
@rohitsankarpal7866 Жыл бұрын
Can someone help me with VS Code as the thread is not supporting !! Any idea how to resolve that ?
@rahulsagarvoduru51582 жыл бұрын
You are a great teacher !! Thank You !!
@mrCetus2 жыл бұрын
One Request: Please give the direct link to the playlist of design patterns you are covering to check other patterns easily.
@KeertiPurswani Жыл бұрын
There’s a playlist on the channel - Design Patterns kzbin.info/aero/PLliXPok7ZonlZJuAN0hvUnf5ovFepjxU0 😇😇
@aryankumar877712 жыл бұрын
wait wait what was that at the last? making constructor private and operator overloading private... as a non C++ coder that hit me like a train
@j.r.krishna1122 Жыл бұрын
You made my day
@AnkitSingh-lb9fj2 жыл бұрын
great stuff as always, waiting for next video on design pattern
@2008suryan2 жыл бұрын
Very good clear explanation. Expecting more videos on other design patterns.
@057anmolkesarwani427 күн бұрын
such good explanation
@niksgupta362 жыл бұрын
In Double-checked Locking, instead of adding another nullpointer check, could we have just added mtx.lock() and unlock() inside the initial nullpointercheck? Should work right. Let me know.
@geeksentertainmentmedia48272 жыл бұрын
You mean putting lock inside if? It would have same problem . Two threads would have entered inside the "if " condition , and then lock would have happened. So one thread would create instance , unlock , then another would have created instance.
@niksgupta362 жыл бұрын
@@geeksentertainmentmedia4827 Makes sense now. Thanks.
@bsratuoh2 жыл бұрын
It is really a great session and helpful. Thanks for this. If possible pls increase the font size while explaining codes.
@KeertiPurswani Жыл бұрын
Thanks for the feedback! Hoping it’s better in the present videos! ❤️😇
@RishabhRD2 жыл бұрын
If you are writing singleton in C++... Meyers singleton is the standard way of doing this. I guess covering meyers singleton was super important not done.... BTW singletons are anti pattern avoid it
@Archak772 жыл бұрын
Excellent video ...simple explaination 👍
@KeertiPurswani Жыл бұрын
Thank you so much! Please do share with your friends?
@potassium_cyanide_boy8515 Жыл бұрын
What if exception is thrown Inside a mutex lock ? It will never ever unlock the mutex and no other thread will be able to enter the critical section or they will keep waiting to mutex to get unlocked that will never happened. So we should use unique_lock or lock_guard i guess 😒😒
@simpleguy2020Ай бұрын
Does it not make unit testing the code hard
@matheens6689 Жыл бұрын
You can use semaphore ? Why mutex
@rohit_kapdi Жыл бұрын
Superb explanation. ❤
@KeertiPurswani Жыл бұрын
Thank you! Hope you like other videos as well! 😇
@Luckygangff6 ай бұрын
When we delete the instance and created new instance 2nd time in main we are unable to delete the instance which we created 2nd time getting double free error
@kushagrabhardwaj44362 жыл бұрын
Thank you so much for this series :)
@hrudayd42172 жыл бұрын
Normally front end developer uses js, learning dsa using js is it useful or not ?
@KeertiPurswani2 жыл бұрын
Dsa is useful for sure (language doesn’t matter that much - as long as you can solve questions) But I do know some front end developers who are doing really well and don’t know dsa much.
@sheshitkarthikeya15282 жыл бұрын
Your effort to keep things simple is amazing...Also don't worry no one will steal your logger constructor.😂
@KeertiPurswani Жыл бұрын
Hehe thank you so much! ❤️❤️
@PROTECHRAHUL2 жыл бұрын
Hey diii i didn't get what are you teaching can you please tell? So i can learn it.
@KeertiPurswani2 жыл бұрын
Hi Rahul, start watching the design pattern playlist. The first video is introduction of what design patterns are. It should help. Let me know if you have any doubts😇
@PROTECHRAHUL2 жыл бұрын
@@KeertiPurswani Thanks dii. 🤗
@jenishadsouza9072 жыл бұрын
Really great explanation!!!
@integrateeverything2 жыл бұрын
Hi didi ,your videos are just awesome keep making videos like this and motivating us
@KeertiPurswani Жыл бұрын
Thank you! Please keep sharing videos and motivating me! ❤️
@ArchanaBiradar-l5h Жыл бұрын
How about KZbin adding search option in comments section.
@skandan62662 жыл бұрын
Please make the code view bigger. It becomes difficult to read while watching on a phone
@nkjat1232 жыл бұрын
Hi Guys.. awesome videos
@vishalsethi40242 жыл бұрын
Great Teacher YOU are
@KeertiPurswani2 жыл бұрын
Thank you! Means a lot❤️😇
@vinamrajha15712 ай бұрын
You forgot to return as reference when you overloaded the assignment operator.
@fakecake76082 жыл бұрын
Great complete Video :)
@nikhillaad9412 жыл бұрын
awsome explaination
@tech_wizard93152 жыл бұрын
Please provide best resume templates for freshers to apply for tech giant's. It's need of many students