What is the Singleton Pattern? (Software Design Patterns)

  Рет қаралды 8,235

Be A Better Dev

Be A Better Dev

Күн бұрын

Пікірлер: 18
@linusstockinger4571
@linusstockinger4571 2 ай бұрын
best yt channel for design patterns , thank you! great job!
@marcobaccaro
@marcobaccaro 3 жыл бұрын
That’s a classic book. Singleton, the pattern anti-pattern :) Good content...
@MrEditorBen
@MrEditorBen 3 жыл бұрын
Great job. Helped cleared some confusion on this concept
@BeABetterDev
@BeABetterDev 3 жыл бұрын
Glad you found this useful DragonLord!
@nirmesh44
@nirmesh44 4 жыл бұрын
great work buddy
@vanamutt43
@vanamutt43 3 жыл бұрын
great tutorials dude, so few views but so so good. thanks mate. also, you kinda look like the doctor dude from walking dead, siddiq i think his name was:D anyways, thanks again mate
@prabhatism
@prabhatism 2 жыл бұрын
The if condition should be inside the synchronised block?
@fyh8848
@fyh8848 3 ай бұрын
keep original if-check, then add another if-check in synchronized block.
@shivambaghel9668
@shivambaghel9668 21 күн бұрын
yes that if cond should be in sunchronized block as when we create 2 thread (e.g.) both check for null and enter in synchronization block simultaneuosly and create 2 instance with different hashcode.. code here .. public class Main implements Runnable{ @Override public void run() { DataBaseConnectionManager obj = DataBaseConnectionManager.getInstance(); System.out.println("Thread running for "+obj.hashCode()); } public static void main(String[] args) { Thread t1 = new Thread(new Main()); Thread t2 = new Thread(new Main()); t1.start(); t2.start(); try{ t1.join(); t2.join(); }catch (InterruptedException e){ e.printStackTrace(); } } } output Thread running for 687105320 Thread running for 1582306442
@khomo12
@khomo12 Жыл бұрын
Nice👍👍
@hectorprx
@hectorprx 4 жыл бұрын
Thanks
@mananabanana
@mananabanana 4 жыл бұрын
You forgot to update the description. :)
@BeABetterDev
@BeABetterDev 4 жыл бұрын
Thank you !
@LilMartyFarty
@LilMartyFarty 3 жыл бұрын
Why would you not wrap all of the code in synchronized?
@bity-bite
@bity-bite 3 жыл бұрын
Why not just make it static?
@vanamutt43
@vanamutt43 3 жыл бұрын
because static doesnt instantiate, singleton is useful when you want an instance but just one
@fyh8848
@fyh8848 3 ай бұрын
you could but instance will be created always when class is loaded. If it is no need, then resource is wasted.
What is the Command Pattern? (Software Design Patterns)
19:55
Be A Better Dev
Рет қаралды 17 М.
What is the Decorator Pattern? (Software Design Patterns)
19:41
Be A Better Dev
Рет қаралды 27 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 86 МЛН
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 6 МЛН
Singleton Pattern - Design Patterns (ep 6)
20:09
Christopher Okhravi
Рет қаралды 253 М.
Mastering the Singleton Design Pattern in Python
11:13
campbelltech
Рет қаралды 3,6 М.
What is the Factory Pattern? | Software Design Principles
26:48
Be A Better Dev
Рет қаралды 29 М.
Singleton Design Pattern in C# - Do it THAT way
13:15
tutorialsEU - C#
Рет қаралды 29 М.
Factory, Builder, Singleton... Creational Design Patterns!
16:13
What is the Observer Pattern? (Software Design Patterns)
21:49
Be A Better Dev
Рет қаралды 22 М.
Understanding The Visitor Design Pattern
32:08
Ryan Schachte
Рет қаралды 58 М.
Factory Method Design Pattern
26:55
Wes Doyle
Рет қаралды 15 М.
What is a Proxy? | System Design
8:07
Be A Better Dev
Рет қаралды 11 М.
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 440 М.