
Design Patterns Part 1 – You Create Me!
Coding Blocks
00:00
Is There a Singleton?
The static example, it crashes once it's done. But in this case, if it crashes creating the first time, the second time comes around, it's still going to see that object is null and it's going to try again. So you get that advantage of it, but you have the flexibility of saying, you know, if I want it to be to reinitialize itself, I can just null it out and let it do its thing, right? Provided you provide a setter. Yeah. And then if it is still null, then I'll new up an instance of it. After I break out of the ifs, I'll return that instance. That really depends
Transcript
Play full episode